Skip to content

Commit 096f244

Browse files
author
rokde
committed
routes support with RouteRegistrar added
1 parent ec3c4cc commit 096f244

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,31 @@ Add your routes source path:
113113
}
114114
```
115115

116+
### Package providing routes via Route Registrar
117+
118+
Simply implement our `DefinesRouteRegistrar` interface.
119+
120+
```php
121+
class YOURPACKAGEServiceProvider extends PackageServiceProvider implements DefinesRouteRegistrar
122+
```
123+
124+
Add your routes source path:
125+
```php
126+
/**
127+
* defines routes by using the router
128+
*
129+
* @param \Illuminate\Routing\Router $router
130+
*
131+
* @return void
132+
*/
133+
public function registerRoutesWithRouter(Router $router)
134+
{
135+
(new RouteRegistrar($router))->all();
136+
}
137+
```
138+
139+
[RouteRegistrar](https://github.com/laravel/passport/blob/1.0/src/RouteRegistrar.php) can be seen at [laravel/passport](https://github.com/laravel/passport) project for example.
140+
116141

117142
## License
118143

0 commit comments

Comments
 (0)