ikoene / symfony-micro
Symfony 3 Micro Trait application
Installs: 218
Dependents: 0
Suggesters: 0
Security: 0
Stars: 35
Watchers: 3
Forks: 2
Open Issues: 0
Type:project
Requires
- sensio/framework-extra-bundle: ~3.0,>=3.0.2
- symfony/symfony: ~3.4
Requires (Dev)
- phpunit/phpunit: ~4.5
This package is not auto-updated.
Last update: 2024-10-26 19:26:38 UTC
README
Symfony micro-framework
Use Symfony as a microframework.
Installation
Create a new project with Composer.
composer create-project ikoene/symfony-micro
MicroKernelTrait
The MicroKernelTrait allows you to create a fully-functional Symfony application in as little as one file. It allows you to start with a tiny application, and then add features and structure as you need to. Its goal to give you the power to choose your bundles and structure. Since you're only enabling features and bundles you're actually going to use, your application gets a performance boost in comparison with using the Symfony full-stack framework.
Bundles
These bundles are registered in the MicroKernel:
While you could argue what exactly should and should not be included in a microframework, I found myself always using these bundles. So they're enabled by default. Don't want to use Twig as your template engine? Remove it in the MicroKernel.
When working in a dev or test environment, the MicroKernel also registers the necesarry bundles to be able to debug your project:
Usage
Development
Build your application in the AppBundle. You're free to structure your application as you want, but following the typical Symfony bundle structure has it's advantages. For one, it would be easier to migrate to a full-stack Symfony project if your application grows too big.
But, as I said, the choice is yours.
Register bundles
Missing some features? Register your bundles in the MicroKernel:
... $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new AppBundle\AppBundle(), ); ...
Console
While this is a microframework, chances are you'll still need the console. Use it like this:
./console
PHPUnit Testing
Run all tests with this command:
bin/phpunit -c .