This is an app skeleton for the Silex PHP Micro-Framework to get started quickly
- Doctrine ORM (Doctrine ORM Service Provider)
- CSRF protection (CSRF Service Provider)
- Security (Security Service Provider) and user management (Silex User Service Provider)
- Validation (Validator Service Provider)
- Twig (Twig Service Provider)
- CSS Framework Bootstrap 4
- Webpack Encore for SASS and JS files, and minification
- Logs (Monolog)
- Symfony Web Profiler
- Console commands for updating the database schema and creating users
- Functionnal tests base (PHPUnit)
$ composer create-project awurth/silex [project-name]
Copy .env.dist
to a .env
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 use npm:
$ npm install
If you just want to generate the default CSS and JS that comes with this skeleton, run the following command
$ yarn run encore dev
Or if you don't use yarn:
$ ./node_modules/.bin/encore dev
If you want to run a watcher and begin coding, just add the --watch
option
$ yarn run encore dev --watch
See the documentation
The skeleton uses a cache system for Twig templates, translations, Doctrine, the web profiler 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.
$ php bin/console doctrine:database:create
$ php bin/console doctrine:schema:update --force
If you're using Oh My Zsh, you can install the symfony2 plugin, which provides an alias and autocompletion:
# Without Symfony2 plugin
$ php bin/console doctrine:database:create
# With Symfony2 plugin
$ sf doctrine:database:create