Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marlosoft/silex-routing-provider
Routing service provider for silex micro-framework using annotations
https://github.com/marlosoft/silex-routing-provider
annotations php routing silex
Last synced: about 1 month ago
JSON representation
Routing service provider for silex micro-framework using annotations
- Host: GitHub
- URL: https://github.com/marlosoft/silex-routing-provider
- Owner: marlosoft
- Created: 2017-09-14T07:51:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-14T09:05:10.000Z (over 7 years ago)
- Last Synced: 2024-11-20T17:45:31.307Z (2 months ago)
- Topics: annotations, php, routing, silex
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Silex Routing Service Provider
==============================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
```bash
composer require marlosoft/silex-routing-provider
```## Usage
1. Add Doctrine's annotation registry loader to autoload
```php
use Doctrine\Common\Annotations\AnnotationRegistry;
$autoload = require('/path/to/vendor/autoload.php');
AnnotationRegistry::registerLoader([$autoload, 'loadClass']);
```2. Register the service provider to your application
```php
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 evaluated
* `routes.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 are `FilesystemCache` or `ApcuCache`