Skip to content

Commit 7ab761b

Browse files
committed
Fix readme
1 parent ce6a9b4 commit 7ab761b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ composer require marekskopal/router
88

99
## Usage
1010

11+
Create `Router` instance with `RouterBuilder` and set class directories of your controllers or actions. Optionally you can set `CacheInterface` instance for caching routes.
12+
13+
```php
14+
use MarekSkopal\Router\Builder\RouterBuilder;
15+
16+
$router = (new RouterBuilder())
17+
->setClassDirectories([__DIR__ . '/../Controllers'])
18+
->setCache(new Cache()) // optional
19+
->build();
20+
```
21+
1122
Add `Route` (or `RouteGet`,`RoutePost`,`RoutePut`,`RouteDelete`...) attribute on Class or Method you want to route to.
1223

1324
```php

0 commit comments

Comments
 (0)