marlosoft / silex-routing-provider
Routing service provider for silex micro-framework using annotations
1.0.0
2017-09-14 08:57 UTC
Requires
- doctrine/common: ^2.7
- sensio/framework-extra-bundle: ^3.0
- silex/silex: ^2.2
Requires (Dev)
- phpunit/phpunit: ^5.7
- symfony/browser-kit: ^3.3
- symfony/css-selector: ^3.3
This package is auto-updated.
Last update: 2024-04-26 21:28:36 UTC
README
Routing service provider for silex micro-framework using annotations.
This uses sensio/framework-extra-bundle
and doctrine/common
libraries
to use annotation for routing just like in Symfony2 framework.
Installation
- Use composer
composer require marlosoft/silex-routing-provider
Usage
-
Add Doctrine's annotation registry loader to autoload
use Doctrine\Common\Annotations\AnnotationRegistry; $autoload = require('/path/to/vendor/autoload.php'); AnnotationRegistry::registerLoader([$autoload, 'loadClass']);
-
Register the service provider to your application
use Marlosoft\Silex\Provider\RoutingServiceProvider; $app = new Application(); $app->register(new RoutingServiceProvider(), [ 'routes.directories' => ['/path/to/controllers/directory/'] ]);
Options
routes.directories
(required) is an array of directory paths where the annotations are evaluatedroutes.cache
(optional) is the cache object that will be used to store the evaluated annotations.
This is recommended in production deployments. Cache objects that can use used areFilesystemCache
orApcuCache