1. Go to this page and download the library: Download rudra/router 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/ */
rudra / router example snippets
$router->get('callback/:name', function ($name) {
echo "Hello $name!";
});
use Rudra\Router\RouterFacade as Router;
Router::get('callback/:name', function ($name) {
echo "Hello $name!";
});
namespace App\Middleware;
use Rudra\Router\Router;
use Rudra\Router\MiddlewareInterface;
class FirstMiddleware extends Router implements MiddlewareInterface
{
public function __invoke(array $middlewares)
{
$this->next($middlewares);
}
public function next(array $middlewares): void
{
$this->handleMiddleware($middlewares);
}
}
namespace App\Middleware;
use Rudra\Router\MiddlewareInterface;
use Rudra\Router\RouterFacade as Router;
class SecondMiddleware implements MiddlewareInterface
{
public function __invoke(array $middlewares, array $params)
{
var_dump($params);
$this->next($middlewares);
}
public function next(array $middlewares): void
{
Router::handleMiddleware($middlewares);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.