Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ipranjal committed Jun 8, 2022
1 parent fc6370a commit 0ddd49c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,19 @@ use Symfony\Component\HttpFoundation\Request;
$dir = /path/to/your/controllers;
$namespace = Namespace\of\your\controllers;

$router = new Router(new RouteCollection($dir,$namespace));
$collection = new RouteCollection($dir,$namespace)

/**
* As of v3.2.0 you can now enblae route caching and optionally pass your own PSR 16 implementation
* $collection = new RouteCollection($dir,$namespace,true);
* OR with your own cache adapter
* $cache = new Psr\SimpleCache\CacheInterface();
* $collection = new RouteCollection($dir,$namespace,true,$cache);
**/

$router = new Router($collection);
//Optional you can now pass your own Request object to Router for Router to work on
//$router = new Router(new RouteCollection($dir,$namespace),Request $request);
//$router = new Router($collection,Request $request);


//Dispatch route and get back the response
Expand Down

0 comments on commit 0ddd49c

Please sign in to comment.