Slim 3 MVC Skeleton
This is a simple skeleton project for Slim 3 that includes FluentPDO, Twig and Monolog.
Base on https://github.com/vhchung/slim3-skeleton-mvc
Prepare
-
Create your project:
`$ composer create-project -n -s dev mrmoneyc/slim-mvc-skeleton YOUR_APP_NAME`
-
Create database:
$ cat sql/db.sql | sqlite3 storage/db/db.sqlite
Run it:
$ cd YOUR_APP_NAME
$ php -S 0.0.0.0:8888 -t public/
- Browse to http://localhost:8888
Run coding style check
- Install [PHP_CodeSniffer] (https://github.com/squizlabs/PHP_CodeSniffer)
$ cd YOUR_APP_NAME
$ phpcs
Run test
- Install [PHPUnit] (https://phpunit.de/)
$ cd YOUR_APP_NAME
$ phpunit
Notice
Set storage/
folder permission to writable when deploy to production environment
Key directories
app
: Application codeapp/controllers
: Controller filesapp/models
: Model filesapp/templates
: Template filesstorage/log
: Log filesstorage/db
: SQLite DB filespublic
: Webserver rootvendor
: Composer dependenciessql
: sql dump file for sample database
Key files
public/index.php
: Entry point to applicationapp/settings.php
: Configurationapp/dependencies.php
: Services for Pimpleapp/middleware.php
: Application middlewareapp/routes.php
: All application routes are hereapp/controllers/IndexController.php
: Controller class for the home pageapp/models/ConfigurationModel.php
: Model class for configurations tableapp/templates/index.twig
: Template file for the home page