Download the PHP package gerkirill/silex-rad without Composer
On this page you can find all versions of the php package gerkirill/silex-rad. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gerkirill/silex-rad
More information about gerkirill/silex-rad
Files in gerkirill/silex-rad
Package silex-rad
Short Description Set of dead simple Silex services for faster development
License MIT
Informations about the package silex-rad
Silex RAD tools
Set of dead simple Silex services to make development faster.
Installation
Using composer
Auto-Service
Registers all the classes located in the given directories as services (non-recursively). The constructor of the service will receive single parameter - $app. If you want to pass custom parameters to the constructor - just register the service yourself with the name auto-service would use.
E.g. class Service\MyTestService located in Service/MyTestService.php will be accessible with $app['MyTestService']. Config key 'rad.service.directories' contains associative array where keys are paths to the folders you services reside in. The values are associative arrays with settings. Possible settings keys are:
- file_extension - '.php' by default, you can change it e.g. to '.inc' if your services use that extension. Files with other extensions will be skipped.
- namespace - namespace you services are grouped under, e.g. "Services" or "MyVendor/MyProject/Services"
Default behaviour can be changed with settings $app['rad.service_name_converter'] and $app['rad.service.registrator']. You can find more details on that under "Extension points" section.
Auto-Route
Handles routes in a form of '/{controller}/{action}' automatically. Requires controllers to be classes registered as services. {action} part is optional and defaults to "index".
E.g. URL my-test/my-example will be processed with MyTest:myExample controller. The controller will be invoked with single parameter - $request. The url will match both GET and POST. If you need more precise route tuning - go create the route manually.
Auto-Template
Detects twig template name by the current controller and action. Requires controller to be a class registered as service.
In your controller you now can do like this:
And corresponding template would be my-test/my-example.twig under template directory configured for twig.