awurth / silex
Silex Micro-Framework skeleton
Requires
- php: >=7.0.8
- awurth/silex-user: ^1.0
- dflydev/doctrine-orm-service-provider: ^2.0
- doctrine/dbal: ^2.5
- monolog/monolog: ^1.23
- saxulum/saxulum-console: ^3.1
- saxulum/saxulum-doctrine-orm-commands: ^1.3
- saxulum/saxulum-doctrine-orm-manager-registry-provider: ^3.1
- silex/silex: ^2.0
- swiftmailer/swiftmailer: ^6.0
- symfony/asset: ^3.3
- symfony/config: ^3.3
- symfony/debug-bundle: ^3.3
- symfony/doctrine-bridge: ^3.3
- symfony/dotenv: ^3.3
- symfony/form: ^3.3
- symfony/monolog-bridge: ^3.3
- symfony/security: ^3.3
- symfony/security-bundle: ^3.3
- symfony/security-csrf: ^3.3
- symfony/translation: ^3.3
- symfony/twig-bridge: ^3.3
- symfony/validator: ^3.3
- symfony/var-dumper: ^3.3
- twig/twig: ^2.0
Requires (Dev)
- phpunit/phpunit: ^4.8|^5.0|^6.0
- silex/web-profiler: ^2.0
- symfony/browser-kit: ^3.3
README
This is an app skeleton for the Silex PHP Micro-Framework to get started quickly
Features
- 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)
Installation
Create project using Composer
$ composer create-project awurth/silex [project-name]
Setup environment variables
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.
Download front-end dependencies
$ yarn
Or if you use npm:
$ npm install
Generate assets
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
Setup cache files permissions
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.
Update your database schema
$ 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