This is an app skeleton for the Slim PHP Micro-Framework to get started quickly
- Eloquent ORM
- Flash messages (Slim Flash)
- CSRF protection (Slim Csrf) with fields rendering with a twig function
- Authentication (Sentinel)
- Validation (Respect + Slim Validation)
- Twig templating engine Slim Twig View with cache and debug
- CSS Framework Bootstrap 4
- Webpack Encore for SASS and JS files compilation and minification
- Helpers for assets management, redirections, ...
- Logs (Monolog)
- Dotenv configuration
- Console commands for updating the database schema or creating users
- Functionnal tests base (PHPUnit)
For more information, check out the project's wiki.
$ composer create-project awurth/slim-base [project-name]
Copy .env
to a .env.local
file and change the values to your needs. This file is ignored by Git so all developers working on the project can have their own configuration.
$ yarn
or if you prefer to use npm
$ npm install
This skeleton uses Webpack to manage assets. The CSS and Javascript files are located in assets/
, so you have to use Webpack after creating your project to generate the minified files in public/
, which will be ignored by Git.
If you just want to generate the default CSS and JS that comes with this skeleton, run the following command
$ yarn build
or
$ npm run build
If you want to run a watcher and begin coding
$ yarn watch
The skeleton uses a cache system for Twig templates and the Monolog library for logging, so you have to make sure that PHP has write permissions on the var/cache/
and var/log/
directories.
First, create a database with the name you set in the .env*
file. Then you can create the tables by running this command:
$ php bin/console db