Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
danadesrosiers committed Jun 15, 2014
1 parent 2f1d9f4 commit ca2266b
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.org/danadesrosiers/silex-annotation-provider.svg?branch=master)](https://travis-ci.org/danadesrosiers/silex-annotation-provider)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/danadesrosiers/silex-annotation-provider/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/danadesrosiers/silex-annotation-provider/?branch=master)

silex-annotation-provider
=========================
Expand All @@ -19,31 +20,17 @@ Install the silex-annotation-provider using composer.
}
```

Service
=======
When registered, an instance of AnnotationService is available via $app['annot']; The AnnotationService's process() method parses annotations in a class to configure controllers. It is usually not necessary to use the service directly.
AnnotationService->process() takes 3 arguments:
* **controllerName**: The fully qualified class name of the controller to process.
* **isServiceController**: This matters because Silex expects a different string representation of a controller method for ServiceControllers. Default: false.
* **newCollection**: If true, all routes found will be put into a new controller collection and that collection will be returned. Default: false.


Registration
============
```php
$app->register(new DDesrosiers\SilexAnnotations\SilexAnnotationProvider(), array(
"annot.srcDir" => __DIR__ . "/vendor/ddesrosiers/silex-annotation-provider/src",
"annot.cache" => new ApcCache(),
"annot.controllers" => array("MyControllerNamespace\\MyController")
));
```

Parameters
==========
annot.srcDir
------------
The path to the silex-annotation-provider component. This project uses Doctrine Annotations, provide this path to let silex-annotation-provider register the annotations for you.

annot.cache
-----------
An instance of a class that implements Doctrine\Common\Cache\Cache. This is the cache that will be used by the AnnotationReader to cache annotations so they don't have to be parsed every time. Make sure to include Doctrine Cache as it is not a required dependency of this project.
Expand Down Expand Up @@ -138,6 +125,15 @@ class TestProviderController implements ControllerProviderInterface

The ControllerProviderInterface's connect() requirement was satisfied by calling the annotation service's process() method.

Service
=======
When registered, an instance of AnnotationService is available via $app['annot']; The AnnotationService's process() method parses annotations in a class to configure controllers. It is usually not necessary to use the service directly.
AnnotationService->process() takes 3 arguments:
* **controllerName**: The fully qualified class name of the controller to process.
* **isServiceController**: This matters because Silex expects a different string representation of a controller method for ServiceControllers. Default: false.
* **newCollection**: If true, all routes found will be put into a new controller collection and that collection will be returned. Default: false.


Annotations
===========
**@Route**
Expand Down Expand Up @@ -200,7 +196,7 @@ Silex\Controller::bind()

The Modifier annotation is a catch-all to execute any method of the Controller or Route. All methods should have an annotation, but this annotation is provided as a way to "future-proof" the annotation provider. In case something is added in the future, users can use it right away instead of waiting for a new annotation to be added.

Silex\Route::*()
Silex\Controller::*()
Silex\Route::{method}()
Silex\Controller::{method}()
* method (name of the method to call on the Route object)
* args (array of arguments to send the the method)

0 comments on commit ca2266b

Please sign in to comment.