1. Go to this page and download the library: Download sirix/mezzio-radixrouter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sirix / mezzio-radixrouter example snippets
// In config/config.php or similar configuration file
$aggregator = new ConfigAggregator([
// ... other config providers
\Sirix\Mezzio\Router\RadixRouter\ConfigProvider::class,
// ... other config providers
]);
// In config/autoload/dependencies.php or similar configuration file
use Mezzio\Router\RouterInterface;
use Sirix\Mezzio\Router\RadixRouter;
use Sirix\Mezzio\Router\RadixRouterFactory;
return [
'dependencies' => [
'factories' => [
RouterInterface::class => RadixRouterFactory::class,
],
],
];
// In config/routes.php or similar
$app->get('/api/users', [UserListHandler::class], 'api.users');
$app->get('/api/users/:id', [UserDetailsHandler::class], 'api.user');
$app->post('/api/users', [CreateUserHandler::class]);
// In config/autoload/router.global.php or similar
use Sirix\Mezzio\Router\Enum\CacheConfig;
return [
'router' => [
'radix' => [
CacheConfig::Enabled->value => true,
CacheConfig::File->value => 'data/cache/radix-cache.php',
],
]
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.