From ccc49046b02476e9c09ec8c46db58ee7d17067a4 Mon Sep 17 00:00:00 2001 From: danadesrosiers Date: Sun, 22 Apr 2018 22:59:58 -0700 Subject: [PATCH] Faster Register README update --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index c590d86..ace7767 100755 --- a/README.md +++ b/README.md @@ -55,6 +55,12 @@ 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. +annot.base_uri (Enables Faster Controller Registration) +-------------- +This is the base uri of all requests. Basically, it's the part of the URI that isn't included in `$_SERVER['REQUEST_URI']`. If your bootstrap file is at the root of htdocs, the value is "/". If your bootstrap file lives in a directory called "api", all your API's URIs are prefixed with "/api" and that is value you must specify for annot.uri. + +annot.base_uri enables faster registration of controllers. Silex has to register every endpoint in your app on every request. If you have a lot of endpoints, that could be a significant overhead on each and every request. Silex Annotations can improve this by filtering the controllers that need to be registered using the `prefix` on the `Controller` annotation. We only need to register the endpoints in the Controller if the prefix matches the URI. In this way, Silex Annotations allows FASTER routing than pure Silex. + Annotate Controllers ==================== Create your controller. The following is an example demonstrating the use of annotations to register an endpoint.