I've published a fresher, improved version of this project under the name of slim3-flex. If you like clean, beautiful code, you certainly wanna check it out! :)
A Slim 3 starter project with a clean directory structure, inspired from Laravel. This source code provides the most essential setup & libraries to help deal with most of the needs any web application has.
- MVC architecture
- Clean dependency injection & autowiring system with the php-DI bridge for Slim 3
- Config variables laying in a simple .env file
- Twig as a template engine
- Full form validation features with custom rules and errors (See : respect/validation library)
- Data persistance via Eloquent ORM
- Pagination with Eloquent's paginator
- Events and listeners/handlers classes based on the SPL library
- Mailable classes using the popular SwiftMailer library
- CSRF protection for web routes
- Custom 403/404 errors
- Handy debug() function using the symfony/vardumper library
- SQL query caching with Redis
- Integrated logging with Monolog
- JSON formatting with Fractal
- Database seeding and migrations with Phinx
Once you've downloaded or cloned the project, fill the variables in the .env file. Set APP_ENV=dev to enable debugging and disable Twig caching at the same time. Then run :
composer install
./vendor/bin/phinx migrate
./vendor/bin/phinx seed:run
In your .env file, set DB_DRIVER=sqlite and DB_NAME=<absolute_path_to_sqlite> .
I recommend creating the .sqlite file within the /storage directory.
- PhpStorm + Vagrant homestead
If you are using homestead's Redis server, remember to edit /etc/redis/redis.conf and fill the requirepass line with your own password.