An open API service indexing awesome lists of open source software.

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.

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']);
});
```