Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

fidanf/slim3-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important UPDATE:

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! :)

slim3-starter : A fullstack boilerplate for Slim 3

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.

Features :

  • 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

Setting up :

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

Using Sqlite instead of MySQL

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.

Recommended dev environment :

  • 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.