jguyomard / silex-pdo-boilerplate
A Boilerplate for Silex 2 using PDO
Requires
- csanquer/pdo-service-provider: ~1.1@dev
- jeromemacias/silex-debug: ~2.0@dev
- silex/silex: ~2.0@dev
- silex/web-profiler: ~2.0@dev
- symfony/config: ^3.0
- symfony/monolog-bridge: ~2.7|3.0.*
- symfony/twig-bridge: ~2.7|3.0.*
Requires (Dev)
- symfony/browser-kit: ^3.0
- symfony/css-selector: ^3.0
This package is not auto-updated.
Last update: 2024-11-07 00:53:18 UTC
README
This boilerplate is a fully functional Silex Application. You can use it for your new applications.
This boilerplate is configured with PDO Service Provider (instead of Doctrine, for instance) and Twig.
It also comes with Gulp to build js/sass files (but you can find a version without gulp on master/no-npm
branch if you prefer).
Note: I only make this boilerplate for my quick and fun projects. It's configured with Silex 2.0@dev. Use it at your own risk.
Code Organization
I like organizing my app in terms of features.
For instance, all Controllers/Repositories/Entities/Tests/Views and CSS/JS related to the "Blog" module can be found in ./src/Blog
directory tree.
Config is in ./config
directory.
Creating a new Silex Application
composer create-project jguyomard/silex-pdo-boilerplate ./myapp 2.0.x-dev
cd ./myapp
Running
Create a sql database, import boilerplate.sql
and update ./config/dev.config.php
width information required to connect to the database. With mysql:
mysql -u ... < boilerplate.sql
vi ./config/dev.config.php
To build js/sass files:
npm install
gulp build
To run this app with PHP built-in web server:
APP_ENV=dev php -S localhost:8080 -t web/ web/index.php
About this boilerplate
This Silex Boilerplate is configured with:
Service Providers
- PDOServiceProvider (~1.1@dev)
- TwigServiceProvider
- UrlGeneratorServiceProvider
- ServiceControllerServiceProvider
- HttpFragmentServiceProvider
- WebProfilerServiceProvider (~2.0@dev)
- DebugServiceProvider (~2.0@dev)
- MonologServiceProvider
Front-End
This Gulp version is also configured with :
You can run :
gulp build // to build js/sass files with sourcemaps
gulp build --production // to build js/sass files
gulp watch // to watch for files changes
Testing
To run the test suite, you need PHPUnit:
phpunit
Issues
If you have any problems with or questions about this boilerplate, please contact me through a GitHub issue. If the issue is related to Silex itself, or any configured packages, please leave an issue on their official repository.
Contributing
You are invited to contribute new features, fixes or updates to this container, through a Github Pull Request.