GithubHelp home page GithubHelp logo

antogno / blogsonic Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 3.53 MB

Blogsonic is a simple CRUD Web Application in PHP.

License: Creative Commons Zero v1.0 Universal

PHP 92.18% HTML 0.27% Less 3.64% SCSS 3.68% JavaScript 0.23%
php codeigniter codeception mysql website crud

blogsonic's Introduction

Blogsonic

License Last commit Last release

Blogsonic is a simple CRUD Web Application in PHP.

Blogsonic screenshot


Table of contents

What is Blogsonic?

Blogsonic is a simple CRUD Web Application in PHP. It could be defined as a mini Social Network that allows you to post text content (called Blogs) visible to all.

Note: The existence of Blogsonic has the sole purpose of showing a very basic example of a CRUD Web Application. This means that not much attention has been paid to the general appereance of the website and to the code and its structure. Therefore, Blogsonic should not be used as a reference point in these respects, but should be considered as a starting point for beginners from which to start understanding the basic concepts.

How was Blogsonic created?

Blogsonic was created using the following tools and technologies:

  • Front-end:
    • HTML;
    • CSS (framework: Bootstrap);
    • JavaScript;
    • jQuery;
    • AJAX.
  • Back-end:
    • PHP (framework: CodeIgniter 3.1.11);
    • MySQL.

Blogsonic also exists thanks to:

Who created Blogsonic?

The designer and creator of Blogsonic it's me, that is Antonio Granaldi. You can see my LinkedIn profile by clicking here.

How can I contact you?

You can contact me on my LinkedIn profile above, or by sending an email to [email protected].

Can I use the Blogsonic source code?

Of course! You can find everything you need on GitHub.

Installation

Follow the next steps to set up Blogsonic.

Set up database

Create a database and add the following tables. You can also find these tables in application/tables/.

CREATE TABLE `users` (
	`id` int NOT NULL AUTO_INCREMENT,
	`name` varchar(50) NOT NULL,
	`surname` varchar(50) NOT NULL,
	`gender` varchar(1) NOT NULL,
	`username` varchar(50) NOT NULL,
	`password` varchar(255) NOT NULL,
	`email` varchar(50) NOT NULL,
	`phone` varchar(13) NOT NULL,
	`language` varchar(2) NOT NULL,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	PRIMARY KEY (`id`)
);
CREATE TABLE `blogs` (
	`id` int NOT NULL AUTO_INCREMENT,
	`user_id` int NOT NULL,
	`title` varchar(20) NOT NULL,
	`body` text NOT NULL,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
	PRIMARY KEY (`id`),
	CONSTRAINT `fk_usersblogs` FOREIGN KEY (`user_id`)
	REFERENCES `users`(`id`)
	ON UPDATE CASCADE
	ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS `sessions` (
	`id` varchar(128) NOT NULL,
	`ip_address` varchar(45) NOT NULL,
	`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
	`data` blob NOT NULL,
	KEY `sessions_timestamp` (`timestamp`)
);

Create the .env file

Copy the .env.example file in the root of the project and name it .env.

$ cp .env.example .env

The valid variables are:

  • CI_ENV: defines the current environment. The available options are: development, testing and production. Setting the variable to a value of development will cause all PHP errors to be rendered to the browser when they occur. Conversely, setting the variable to production will disable all error output;
  • BLOGSONIC_BASE_URL
  • BLOGSONIC_ENCRYPTION_KEY: to generate an encryption key, you can go to RandomKeygen and scroll down to "CodeIgniter Encryption Keys";
  • BLOGSONIC_IN_EMAIL: email address to be used publicly for contact purposes;
  • BLOGSONIC_OUT_EMAIL: the outgoing email (e.g.: sending the forgotten password email);
  • BLOGSONIC_OUT_EMAIL_SMTP_PORT
  • BLOGSONIC_OUT_EMAIL_SMTP_HOST
  • BLOGSONIC_OUT_EMAIL_SMTP_USER
  • BLOGSONIC_OUT_EMAIL_SMTP_PASS
  • DB_HOST
  • DB_USER
  • DB_PASS
  • DB_NAME

Running the acceptance tests

If you want to, you can also run the acceptance tests made with Codeception. To do this, follow the next steps.

Note: If you decide to run the acceptance tests before actually using Blogsonic, you can skip the previous tables creation step.

Install Google Chrome and ChromeDriver

Install Google Chrome and check its version.

$ google-chrome --version

Go to the ChromeDriver website and check which ChromeDriver version is the closest to your Google Chrome version.

Then:

$ wget https://chromedriver.storage.googleapis.com/<version>/chromedriver_linux64.zip
$ unzip chromedriver_linux64.zip
# mv chromedriver /usr/bin/chromedriver

Install the Composer packages

From the blogsonic/ folder, run the following command:

$ bin/composer install

Start ChromeDriver

$ chromedriver --url-base=/wd/hub

Run the acceptance tests

$ vendor/bin/codecept run

You can also use the following command if you want to see all the single steps.

$ vendor/bin/codecept run --steps

Note: Running the acceptance tests will empty all the tables.

All tests are independent of each other. This means that you can run a single test (or a single suite) individually.

To run a single suite (found in the tests/acceptance/ folder), use:

$ vendor/bin/codecept run acceptance <name of the suite>

To run a single test from a suite, use:

$ vendor/bin/codecept run acceptance <name of the suite>::<name of the test>

For example:

$ vendor/bin/codecept run acceptance ProfilesCest
$ vendor/bin/codecept run acceptance ProfilesCest::register

For more information, see the official Codeception documentation.

License

Blogsonic is licensed under the terms of the Creative Commons Zero v1.0 Universal license.

For more information, see the Creative Commons website.

Links

blogsonic's People

Contributors

antogno avatar

Stargazers

Askar Uvaliyev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.