https://github.com/anhoder/imi-route
The library enables the IMI framework to support the management of routes through PHP files.
https://github.com/anhoder/imi-route
imi php route router routers routes
Last synced: 7 months ago
JSON representation
The library enables the IMI framework to support the management of routes through PHP files.
- Host: GitHub
- URL: https://github.com/anhoder/imi-route
- Owner: anhoder
- Created: 2020-05-27T09:13:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-27T16:35:31.000Z (over 5 years ago)
- Last Synced: 2025-01-27T06:15:11.822Z (8 months ago)
- Topics: imi, php, route, router, routers, routes
- Language: PHP
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-en.md
Awesome Lists containing this project
README
# imi-route
[中文](./README.md) | English
The library enables the IMI framework to support the management of routes through PHP files.
## Usage
1. Install package
```sh
composer require alanalbert/imi-route
```2. Add code
Add the following code to the `/project/Main.php` file:
```php
group(['middleware' => TestMiddleware::class], function (Route $router) {$router->group(
[
'middleware' => Test2Middleware::class,
'ignoreCase' => true,
'prefix' => 'prefix'
], function (Route $router) {
$router->get('hi', 'ImiApp\ApiServer\Controller\IndexController@index');
});$router->any('/hi/api/abc', [IndexController::class, 'index']);
$router->any('/hi/api/{time}', [IndexController::class, 'api']);
});
$router->group(['prefix' => 'prefix'], function (Route $router) {
$router->get('/TEST/{time}', [IndexController::class, 'api']);
});
```