Fast PSR-7 based routing and dispatch component including PSR-15 middleware, built on top of FastRoute.

Overview

Route

Author Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

This package is compliant with PSR-1, PSR-2, PSR-4, PSR-7, PSR-11 and PSR-15. If you notice compliance oversights, please send a patch via pull request.

Install

Via Composer

$ composer require league/route

Requirements

The following versions of PHP are supported by this version.

  • PHP 7.2
  • PHP 7.3
  • PHP 7.4
  • PHP 8.0

Documentation

Route has full documentation, powered by Jekyll.

Contribute to this documentation in the docs directory.

Testing

$ vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments
  • Implement PSR-7 to replace HTTP Foundation throughout strategies

    Implement PSR-7 to replace HTTP Foundation throughout strategies

    What are your thoughts about supporting the PSR-7 request and response interfaces in the Request/Response strategy instead of a hard dependency on Symfony HTTP foundation?

    enhancement 
    opened by codeguy 50
  • v2.0.0 RC

    v2.0.0 RC

    @kayladnls @localheinz @hannesvdvreken

    Will have documentation ready ASAP. For now, here is a quick example bootstrap using Zend\Diactoros.

    https://gist.github.com/philipobenito/b3977c5b5e30fe386c76

    opened by philipobenito 30
  • getNamedRoute()->getPath() returning the route, with wildcard?

    getNamedRoute()->getPath() returning the route, with wildcard?

    route 3.1

    I'm curious if I'm doing something wrong, if I have a misconfiguration somewhere or if this is expected. Calling getNamedRoute('the-route-name')->getPath() from the RouteCollection returns the route name, with wildcards, is this expected behaviour?

    Example route: $route->get('/the-route/{id:number}/', Action::class.'::index')->setName('the-route-name');

    Currently I feel like I'm hacking around it by doing:

            if (strpos($this->route->getNamedRoute($name)->getPath(), '{') !== false) {
                return substr($this->route->getNamedRoute($name)->getPath(), 0,
                    strrpos($this->route->getNamedRoute($name)->getPath(), "{"));
            } else {
                return $this->route->getNamedRoute($name)->getPath();
            }
    

    But that's because I'm just unsure if I should be getting the route path with the wildcards or not...

    opened by alturic 24
  • Could not instance Controller with container.

    Could not instance Controller with container.

    Please provide login for instantiating Controllers with DI Container, because right now I have to write my own strategy and implement a logic for $route->getCallable() which make call inside from file Route.php line 87

    My code flow:

    class HomeController extends BaseController
    {
      public function home($request, $response) {
        return $response;
      }
    }
    
    abstract class BaseController
    {
      use \League\Container\ContainerAwareTrait;
    }
    `
    opened by vv3d0x 17
  • Pass a route configuration file

    Pass a route configuration file

    Hi,

    I have been using your fastroute extension and am enjoying it very much.

    I was wondering if you would be interested in a Pull Request which adds a method to pass a configuration array?

        /**
         * Add a collection of routes from a configuration
         * array
         *
         * @param  array $routes
         * @param  \League\Route\Strategy\StrategyInterface $strategy
         * @throws \League\Route\Exception\EmptyRoutingPassedException
         * @throws \League\Route\Exception\MalformedRouteConfigurationException
         */
        public function addRoutesFromConfig(
            array $routes = [],
            Strategy\StrategyInterface $strategy = null
        ) {
            // Check if the array is empty
            if (true === empty($routes)) {
                throw new EmptyRoutingPassedException;
            }
    
            // Loop through each modules routing data
            foreach ($routes as $module => $route) {
                foreach($route as $name => $body) {
                    // Check configuration is passed correctly
                    if (
                        false === isset($body['method'])
                        || false === isset($body['pattern'])
                        || false === isset($body['controller'])
                    ) {
                        throw new MalformedRouteConfigurationException(
                            sprintf(
                                'The route [%s] in the [%s] section has not been configured correctly',
                                $name,
                                $module
                            )
                        );
                    }
    
                    $this->addRoute($body['method'], $body['pattern'], $body['controller'], $strategy);
                }
            }
        }
    

    and then called like:

    $routes = [
        'demo_page' => [
            'pattern'    => '/demo/{name}',
            'controller' => 'Demo\Controller\DemoController::index',
            'method'     => 'GET',
        ],
    ];
    
    
    $router = new RouteCollection();
    $router->setStrategy(new RequestResponseStrategy);
    $router->addRoutesFromConfig($routes);
    

    In terms of the exceptions, not sure if they are the best place for them as they are not Http exceptions but more argument exceptions?

    opened by NigelGreenway 17
  • Middleware

    Middleware

    READ FURTHER DOWN THREAD FOR UPDATED FUNCTIONALITY

    After small discussion, closes #113

    Ended up not bringing in an external middleware runner, really wasn't worth it.

    As this PR stands

    • You can add middleware to the collection to run before or after any matched route.
    • You can add middleware to a route group that will only run when a route within that group is matched.
    • You can add middleware directly to a route meaning that it will only run if that route is matched.
    <?php
    
    $route = new League\Route\RouteCollection;
    
    $route->before(/* callable */);
    $route->after(/* callable */);
    
    $route
        ->get('/something', function ($request, $response) {})
        ->before(/* callable */)
        ->after(/* callable */)
    ;
    
    $route->group('/group', function ($route) {
        $route->get('/', function ($request, $response) {})
            ->before(/* callable */)
            ->after(/* callable */)
        ;
    })
        ->before(/* callable */) 
        ->after(/* callable */)
    ;
    

    As things stand, middleware will be invoked in the following order.

    1. Before middleware registered on the collection.
    2. Before middleware registered on the group.
    3. Before middleware registered on the route.
    4. The route callable.
    5. After middleware registered on the collection.
    6. After middleware registered on the group.
    7. After middleware registered on the route.

    I'd like some input on how we might swap 5 and 7 around whilst maintaining the order they were actually registered within that section.

    opened by philipobenito 16
  • Catch all route

    Catch all route

    Is there a way to add a catch all route that deals with every request that doesn't match one of the other specified routes.

    Something like this:

    $router->addRoute(
        'GET', '/foo',
        function(Request $request, Response $response)
        {
            // handles GET /foo
        }
    );
    
    $router->addCatchAllRoute(function(Request $request, Response $response)
    {
        // handles everything else, e.g. POST /foo
    });
    
    opened by felixkiss 16
  • Allow route arguments to be passed in to controller of MethodArgumentStrategy

    Allow route arguments to be passed in to controller of MethodArgumentStrategy

    The MethodArgumentStrategy allows you to inject anything into the controller method.

    class HelloController
    {
        protected $repository;
    
        public function __construct(Repository $repository)
        {
            $this->repository = $repository;
        }
    
        public function index(Validator $validator, Request $request)
        {
             $filter = $request->get('filter');
    
             $validator->validate(compact('filter'));
             ...
        }
    }
    

    But with this simple change you can do this:

    class HelloController
    {
        protected $repository;
    
        public function __construct(Repository $repository)
        {
            $this->repository = $repository;
        }
    
        public function show(ViewFactory $view, $name)
        {
             $user = $this->repository->findByName($name);
             return $view->render('user/show.twig', compact('user'));
        }
    }
    
    $router = new League\Route\RouteCollection();
    $router->setStrategy(new MethodArgumentStrategy());
    
    $router->get('/user/{name}', 'UserController::show');
    
    $response = $router->getDispatcher()->dispatch('GET', '/users/username');
    
    opened by hannesvdvreken 15
  • Lazy-load middleware

    Lazy-load middleware

    Was just about to start using this. Even though I feel like it is very bloated, still the features look great.

    I wanted my application to be based solely on middleware, and avoid controllers, because I want to force myself to write all functionality in the most re-usable way, and middleware appears to be a good fit. So I write a function that would take a config, and map endpoint + method combination to a middleware pipe. And I understand that I cannot have middleware be lazy-loaded by retrieving it out of the DI container, because MiddlewareAwareInterface#middleware() does not accept string, which is what the key would need to be.

    This is a deal-breaker for me. Other libraries, such as Broker, do this, and it's very convenient. I think this is definitely a feature worth adding.

    enhancement 4.x 
    opened by XedinUnknown 14
  • Route doesn't allow an array callable (eg.: [$obj, 'method'])

    Route doesn't allow an array callable (eg.: [$obj, 'method'])

    Simple example of this not working:

    $test = new Test();
    $router = new League\Route\RouteCollection;
    $router->addRoute('GET', '/', [$test, 'index']);
    
    $request    = Request::createFromGlobals();
    $dispatcher = $router->getDispatcher();
    
    try {
        $response   = $dispatcher->dispatch($request->getMethod(), $request->getPathInfo());
        $response->send();
    } catch(Exception $e) {
        echo $e->getMessage();
    }
    
    class Test
    {
        public function index(Request $req, Response $resp) 
        {
            $resp->setContent("Testing");
            return $resp;
        }
    }
    

    Errors:

    Warning: Illegal offset type in /var/www/source/vendor/league/route/src/RouteCollection.php on line 84
    
    Warning: Illegal offset type in /var/www/source/vendor/league/route/src/RouteCollection.php on line 84
    
    Warning: Illegal offset type in /var/www/source/vendor/league/route/src/Dispatcher.php on line 69
    
    Warning: Illegal offset type in /var/www/source/vendor/league/route/src/Dispatcher.php on line 70
    
    Catchable fatal error: Argument 2 passed to League\Route\Dispatcher::handleFound() must implement interface League\Route\Strategy\StrategyInterface, null given, called in /var/www/source/vendor/league/route/src/Dispatcher.php on line 73 and defined in /var/www/source/vendor/league/route/src/Dispatcher.php on line 85
    

    Doing the following works as expected though:

    $router->addRoute('GET', '/', 'test::index');
    

    Both ways are valid callables, so this not working is weird.

    opened by G4MR 14
  • Uncaught Exceptions when route group has a JsonStrategy set

    Uncaught Exceptions when route group has a JsonStrategy set

    I have a route group prefixed with /api/v1 and some routes defined inside. I also have the strategy set for the route group to the bundled JsonStrategy.

    Lets say the routes defined inside the /api/v1 route group are a GET route on / and a GET route on /welcome. The routes work fine, but if I try to call a route such as /api/v1/test, it will throw a NotFoundException, which is expected as the route is undefined, however the exception is not caught when the route is dispatched. I was under the impression that by setting a JsonStrategy on a route (or route group), exceptions would be caught and a json response would be returned.

    I thought it might have been where those routes were undefined, so I tried it by setting the strategy on an individual route, and then throwing a NotFoundException from within the controller function, and it will fail with an uncaught exception. Here is some example code to illustrate my problem: -- file: index.php

    <?php
    
    use Psr\Http\Message\ResponseInterface;
    use Psr\Http\Message\ServerRequestInterface;
    
    require '../vendor/autoload.php';
    
    $container = new League\Container\Container;
    
    $container->share('response', Zend\Diactoros\Response::class);
    $container->share('request', function () {
        return Zend\Diactoros\ServerRequestFactory::fromGlobals(
            $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES
        );
    });
    
    $container->share('emitter', Zend\Diactoros\Response\SapiEmitter::class);
    
    $route = new League\Route\RouteCollection($container);
    
    $route->map('GET', '/', function (ServerRequestInterface $request, ResponseInterface $response) {
        $response->getBody()->write(json_encode(['message' => 'hey']));
    
        throw new \League\Route\Http\Exception\NotFoundException();
    
        return $response;
    })->setStrategy(new \League\Route\Strategy\JsonStrategy());
    
    $response = $route->dispatch($container->get('request'), $container->get('response'));
    $container->get('emitter')->emit($response);
    

    I have also tried setting a route group and setting the strategy for the group: -- file: index.php

    <?php
    
    use Psr\Http\Message\ResponseInterface;
    use Psr\Http\Message\ServerRequestInterface;
    
    require '../vendor/autoload.php';
    
    $container = new League\Container\Container;
    
    $container->share('response', Zend\Diactoros\Response::class);
    $container->share('request', function () {
        return Zend\Diactoros\ServerRequestFactory::fromGlobals(
            $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES
        );
    });
    
    $container->share('emitter', Zend\Diactoros\Response\SapiEmitter::class);
    
    $route = new League\Route\RouteCollection($container);
    
    $route->group('/api/v1', function($route) {
        $route->map('GET', '/', function (ServerRequestInterface $request, ResponseInterface $response) {
            $response->getBody()->write(json_encode(['message' => 'hey']));
    
            return $response;
        });
    })->setStrategy(new \League\Route\Strategy\JsonStrategy());
    
    $response = $route->dispatch($container->get('request'), $container->get('response'));
    $container->get('emitter')->emit($response);
    

    It seems after looking in the dispatch function for the RouteCollection, it catches the exception, but I added some debugging to the exception handling and $this->getStrategy() is returning an instance of ApplicationStrategy would would just rethrow the exception. Perhaps I am missing something with setting up the strategies for the routes.

    Any insight would be greatly appreciated.

    opened by brandon14 13
  • Root exception class (and possibly, its children) not compatible with PHP7+

    Root exception class (and possibly, its children) not compatible with PHP7+

    https://github.com/thephpleague/route/blob/b2d82a8b212787f10244e6fa8f94c939560d23bd/src/Http/Exception.php#L30

    This breaks on PHP 7+ when a non-\Exception throwable is thrown (e.g. TypeError; see also the type hierarchy).

    For best compatibility, the type declaration should be removed. If needs be, ?\Exception / ?\Throwable could be defined via PHPDoc.

    Since it's removing a restriction, I don't think this should be considered as a BC break.


    On a side note, not sure why it needs to keep a copy of the message: https://github.com/thephpleague/route/blob/b2d82a8b212787f10244e6fa8f94c939560d23bd/src/Http/Exception.php#L20 and https://github.com/thephpleague/route/blob/b2d82a8b212787f10244e6fa8f94c939560d23bd/src/Http/Exception.php#L35


    An effective stopgap solution for my use-case:

    class InternalServerErrorException extends \League\Route\Http\Exception
    {
        protected $status = 500;
        protected $message = 'Internal Server Error';
    
        /**
         * @throws \ReflectionException
         * @noinspection MagicMethodsValidityInspection
         * @noinspection PhpMissingParentConstructorInspection
         */
        public function __construct(Throwable $previous = null)
        {
            $reflector = new \ReflectionMethod(\Exception::class, '__construct');
            $reflector->invoke($this, $this->message, 0, $previous);
        }
    }
    
    opened by uuf6429 0
  • Feature request: Treat Route `$handler` that implements RequestHandlerInterface as callable

    Feature request: Treat Route `$handler` that implements RequestHandlerInterface as callable

    We have an implementation of RequestHandlerInterface for every route in our app. We currently have to register them on the router like this (simplified for example):

    $helloRequestHandler = new HelloRequestHandler(); // implements RequestHandlerInterface
    
    $router = new Router();
    $router->get('/hello', [$helloRequestHandler, 'handle']);
    

    Since RequestHandlerInterface is an interface from PSR-15, and this package supports PSR-15 (middlewares), it would be cool if the router could automatically detect the 'handle' method on the request handlers, so we could just register them like:

    $helloRequestHandler = new HelloRequestHandler(); // implements RequestHandlerInterface
    
    $router = new Router();
    $router->get('/hello', $helloRequestHandler);
    

    (Or when injecting a dependency container into the router, as a FQN / service name without the ::handle)

    Is this something that you would consider approving if I created a PR for this?

    opened by bertramakers 0
  • psr/simple-cache version constraints

    psr/simple-cache version constraints

    Hi,

    Im trying to migrate to league/route:^5.0, however it requires "psr/simple-cache": ^1.0 where i depend on ^3.0. is it possible to widen the constraints to cover all simple-cache versions e.g.:

    {
        "psr/simple-cache": "^1.0|^2.0|^3.0"
    }
    
    5.x 
    opened by ArabCoders 2
  • Why isn't the middleware stack executed for unmatched routes?

    Why isn't the middleware stack executed for unmatched routes?

    Correct me if I'm wrong, but the middleware stack is only executed when a route is matched. Is there a reason for this?

    Given that the middleware stack runs before a matched route's callable, it would seem to make more sense that the stack is executed regardless of whether a route is matched. Perhaps I'm missing something.

    My use case is a middleware that will always check for HTTP auth - regardless of whether a route is matched or not.

    Thanks

    opened by switchplane-tom 2
Releases(5.1.2)
  • 5.1.2(Jul 30, 2021)

  • 5.1.1(Jul 26, 2021)

  • 5.1.0(Jul 9, 2021)

  • 5.0.1(Mar 26, 2021)

  • 5.0.0(Jan 25, 2021)

    [5.0.0] 2021-01

    Added

    • A cached router, a way to have a fully built router cached and resolved from cache on subsequent requests.
    • Response decorators, a way to manipulate a response object returned from a matched route.
    • Automatic generation of OPTIONS routes if they have not been defined.

    Changed

    • Minimum PHP requirement bumped to 7.2.
    • Router no longer extends FastRoute RouteCollecter.
      • Router constructor no longer accepts optional FastRoute RouteParser and DataGenerator.
      • Router constructor now accepts an optional FastRoute RouteCollector.
        • Routes already registered with FastRoute RouteCollector are respected and matched.
    • Separated route preparation from dispatch process so that the router can dispatch multiple times.
    • General code improvements.

    Removed

    • Setting of default response headers on strategies. (Replaced by response decorators, see Added).
    • Exception handlers from strategies. (Already deprecated in favour of throwable handlers).
    Source code(tar.gz)
    Source code(zip)
  • 4.5.0(Jun 25, 2020)

  • 4.4.0(May 18, 2020)

    [4.4.0] 2020-05

    Added

    • Ability to pass JSON flags to JsonStrategy. (@pine3ree)
    • Router is now a RequestHandlerInterface so can be used as a middleware itself. (@delboy1978uk)
    • Route params now added as Request attributes. (@delboy1978uk)

    Fixed

    • Exception moved to more appropriate place when shifting no middleware. (@delboy1978uk)
    • Ensure group prefix is always added when adding a parent group. (@delboy1978uk)
    Source code(tar.gz)
    Source code(zip)
  • 4.3.1(Jul 1, 2019)

  • 4.3.0(Jun 30, 2019)

    [4.3.0] 2019-06

    Added

    • Ability to add middleware to the stack as a class name so it is only instantiated when used.

    Changed

    • Switch to use zendframework/zend-httphandlerrunner as removed from diactoros (@JohnstonCode)

    Fixed

    • When adding a prefix to a group after adding routes, it is now applied to those routes. (@delboy1978uk)
    • Fix to how shifting middleware is handled to prevent error triggering. (@delboy1978uk)
    • Fix to ensure that when invoking FastRoute methods on League\Route all callables are converted to League\Route objects (@pgk)
    • Various documentation fixes.
    Source code(tar.gz)
    Source code(zip)
  • 4.2.0(Oct 16, 2018)

    [4.2.0] 2018-10

    Added

    • Allow adding default response headers to strategies.
    • Expand error handling to include Throwable.

    (Thanks @shadowhand)

    Source code(tar.gz)
    Source code(zip)
  • 4.1.1(Oct 9, 2018)

  • 4.1.0(Sep 21, 2018)

    [4.1.0] 2018-09

    Changed

    • JSON strategy no allows array and object returns and builds JSON response. (Thanks @willemwollebrants)

    Fixed

    • Fixed issue where setting strategy on specific route had no effect. (Thanks @aag)
    Source code(tar.gz)
    Source code(zip)
  • 4.0.1(Aug 13, 2018)

  • 4.0.0(Aug 10, 2018)

    [4.0.0] 2018-08

    Changed

    • Increased minimum PHP version to 7.1.0
    • Now implements PSR-15 middleware and request handlers.
    • No longer enforces use of container, one can be used optionally.
    • Strategies now return PSR-15 middleare as handlers.
    • Increased types of proxy callables that can be used as controllers.
    • General housekeeping and refactoring for continued improvement.

    Fixed

    • Group level strategies now handle exceptions if a route is not matched but the request falls within the group.
    Source code(tar.gz)
    Source code(zip)
  • 3.1.0(Jul 23, 2018)

    [3.1.0] 2018-07

    Fixed

    • Ensure JsonStrategy handles all exceptions by default.
    • Handle multiline exception messages.

    Added

    • Add port condition to routes.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.4(Mar 22, 2017)

  • 3.0.0(Mar 21, 2017)

    [3.0.0] 2017-03

    Added

    • Middleware functionality for PSR-7 compatible callables, globally to route collection or individually per route/group.
    • Allow setting of strategy for a route group.
    • Add UUID as default pattern matcher.

    Changed

    • Now depend directly on PSR-11 implementation.
    • Simplified default strategies to just Application and Json.
    • Have strategies return a middleware to add to the stack.
    • Have strategies handle decoration of exceptions.
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Nov 14, 2016)

    2.0.0 - 2016-02

    Added

    • All routing and dispatching now built around PSR-7.
    • Can now group routes with prefix and match conditions.
    • Routes now stored against a specific Route object that describes the route.
    • New dispatch method on RouteCollection that is a compliant PSR-7 middleware.
    • Additional route matching conditions for scheme and host.

    Changed

    • API rewrite to simplify.
    • API naming improvements.
    • Strategies now less opinionated about return from controller.
    Source code(tar.gz)
    Source code(zip)
Owner
The League of Extraordinary Packages
A group of developers who have banded together to build solid, well tested PHP packages using modern coding standards.
The League of Extraordinary Packages
Routing - The Routing component maps an HTTP request to a set of configuration variables.

Routing Component The Routing component maps an HTTP request to a set of configuration variables. Getting Started $ composer require symfony/routing

Symfony 7.3k Jan 6, 2023
PHP routing class. Lightweight yet flexible. Supports REST, dynamic and reversed routing.

AltoRouter AltoRouter is a small but powerful routing class, heavily inspired by klein.php. $router = new AltoRouter(); // map homepage $router->map(

Danny van Kooten 1.1k Jan 3, 2023
:tada: Release 2.0 is released! Very fast HTTP router for PHP 7.1+ (incl. PHP8 with attributes) based on PSR-7 and PSR-15 with support for annotations and OpenApi (Swagger)

HTTP router for PHP 7.1+ (incl. PHP 8 with attributes) based on PSR-7 and PSR-15 with support for annotations and OpenApi (Swagger) Installation compo

Sunrise // PHP 151 Jan 5, 2023
PHPRouter is an easy-to-use, fast, and flexible PHP router package with express-style routing.

PHP-Router is a modern, fast, and adaptable composer package that provides express-style routing in PHP without a framework.

Ayodeji O. 4 Oct 20, 2022
Flight routing is a simple, fast PHP router that is easy to get integrated with other routers.

The PHP HTTP Flight Router divineniiquaye/flight-routing is a HTTP router for PHP 7.1+ based on PSR-7 and PSR-15 with support for annotations, created

Divine Niiquaye Ibok 16 Nov 1, 2022
Convention based routing for PHP

Croute Convention based routing for PHP based on Symfony components. Croute is great because: You don't need to maintain a routing table Promotes cons

Michael O'Connell 12 Nov 9, 2021
🔍 This is a collection of utilities for routing and loading components.

Router Utilities - PHP Introduction A day will come when I will write documentation for this library. Until then, you can use this library to create r

Utilities for PHP 5 Sep 20, 2022
Generate a PHP script for faster routing :rocket:

SwitchRoute Generating a PHP script for faster routing. The traditional way of routing uses regular expressions. This method was improved by FastRoute

Arnold Daniels 75 Nov 20, 2022
PHP routing (like laravel) (not complete yet)

PHP Router (under construction) This repository contains routing classes that enables you to define your routes similar to laravel 8 routes. Features

Kareem M. Fouad 6 Jan 16, 2022
Ertuo: quick routing for PHP

Ertuo: quick routing for PHP Ertuo (anagram of "Route"), is a small PHP library that does routing better and faster than conventional regular expressi

Ertuo 29 Jul 19, 2022
Simple, fast and yet powerful PHP router that is easy to get integrated and in any project.

Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the way Laravel handles routing, with both simplicity and expand-ability in mind.

Simon Sessingø 472 Jan 4, 2023
Pux is a fast PHP Router and includes out-of-box controller tools

Pux Pux is a faster PHP router, it also includes out-of-box controller helpers. 2.0.x Branch Build Status (This branch is under development) Benchmark

Yo-An Lin 1.3k Dec 21, 2022
PhpRouter is a powerful, lightweight, and very fast HTTP URL router for PHP projects.

PhpRouter PhpRouter is a powerful, lightweight, and very fast HTTP URL router for PHP projects. Some of the provided features: Route parameters Predef

Milad Rahimi 152 Dec 28, 2022
A lightweight and fast router for PHP

Piko Router A lightweight and blazing fast router (see benchmarks) using a radix trie to store dynamic routes. This router maps routes to user defined

Piko framework 62 Dec 27, 2022
Fast request router for PHP

FastRoute - Fast request router for PHP This library provides a fast implementation of a regular expression based router. Blog post explaining how the

Nikita Popov 4.7k Dec 23, 2022
A fast & flexible router

Klein.php klein.php is a fast & flexible router for PHP 5.3+ Flexible regular expression routing (inspired by Sinatra) A set of boilerplate methods fo

null 2.6k Dec 28, 2022
klein.php is a fast & flexible router for PHP 5.3+

Klein.php klein.php is a fast & flexible router for PHP 5.3+ Flexible regular expression routing (inspired by Sinatra) A set of boilerplate methods fo

null 2.6k Jan 7, 2023
A Laravel package that introduces a clean object based alternative to Laravel route files.

Laravel Route Registrars This package introduces a clean object based way to define your routes in a Laravel application. A tutorial on the basic prem

Ollie Codes 22 Nov 25, 2022
Toro is a PHP router for developing RESTful web applications and APIs.

Toro Toro is a PHP router for developing RESTful web applications and APIs. It is designed for minimalists who want to get work done. Quick Links Offi

Kunal Anand 1.2k Dec 27, 2022