Simple MVC
Description
This repository is a simple PHP MVC structure from scratch.
It uses some cool vendors/libraries such as Twig and Grumphp. For this one, just a simple example where users can choose one of their databases and see tables in it.
Check on Travis
- Go on https://travis-ci.com.
- Sign up if you don't have account,
- Look for your project in search bar on the left,
- As soon as your repository have a
.travis.yml
in root folder, Travis should detect it and run test.
Steps
- Clone the repo from Github.
- Run
composer install
. - Create config/db.php from config/db.php.dist file and add your DB parameters. Don't delete the .dist file, it must be kept.
define('APP_DB_HOST', 'your_db_host');
define('APP_DB_NAME', 'your_db_name');
define('APP_DB_USER', 'your_db_user_wich_is_not_root');
define('APP_DB_PWD', 'your_db_password');
- Import
simple-mvc.sql
in your SQL server, - Run the internal PHP webserver with
php -S localhost:8000 -t public/
. The option-t
withpublic
as parameter means your localhost will target the/public
folder. - Go to
localhost:8000
with your favorite browser. - From this starter kit, create your own web application.
Windows Users
If you develop on Windows, you should edit you git configuration to change your end of line rules with this command :
git config --global core.autocrlf true
URLs availables
- Home page at localhost:8000/
- Items list at localhost:8000/item/index
- Item details localhost:8000/item/index/show/:id
- Item edit localhost:8000/item/index/edit/:id
- Item add localhost:8000/item/index/add
- Item deletion localhost:8000/item/index/delete/:id