glaubinix / silex-no-framework
Various improvements for Silex applications
Requires
- qafoolabs/no-framework-bundle: ^2.5
- silex/silex: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.9
- glaubinix/silex-twig-engine: ^2.0
- phpunit/phpunit: ^6.5
- symfony/browser-kit: ^3.0|^4.0
- symfony/form: ^2.8|^3.0|^4.0
- symfony/security: ^2.8|^3.0|4.0
- twig/twig: ~1.18
Suggests
- glaubinix/silex-twig-engine: Requirement for usage of ViewListener with twig. The View Listener can also be used without Twig!
- symfony/form: Allows usage of FormRequest in controller methods via ParamConverter
- symfony/security: Allows usage of TokenContext in controller methods via ParamConverter
- twig/twig: Requirement for usage of ViewListener with twig. The View Listener can also be used without Twig!
This package is auto-updated.
Last update: 2022-05-02 14:17:16 UTC
README
silex-no-framework
This library mostly contains silex ServiceProviders for the QafooLabsNoFrameworkBundle. Only use what you want to use.
Features
All supported features have a sample file in the examples folder and web test cases in the tests folder.
Exception Converter
Maps uncaught exceptions to other exceptions or status codes.
See convert_exception example file.
No additional libraries necessary.
Redirect Route
Return a RedirectRoute from controller methods, only using the route name and parameters. The response will be converted to a RedirectResponse.
See redirect_route example file.
No additional libraries necessary.
Param Converter
Allows inject of TokenContext, FormRequest, Flash and Session via ParamConverter into controller methods.
See param_converter example file.
Install symfony/security for usage of TokenContext with symfony security. Install symfony/form for usage of FormRequest with symfony form.
Return ViewModels, TemplateViews or arrays from controller
Tries to guess the template name base on controller and method name or for the TemplateView uses the template name which is provided. For ViewModels the object will be available as view variable in the template.
See view example file.
Install twig/twig and glaubinix/silex-twig-engine for usage with twig. You can also use another template engine. Simply register a service which implements the Symfony\Component\Templating\EngineInterface.