: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)

Overview

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)

Build Status Code Coverage Scrutinizer Code Quality Total Downloads Latest Stable Version License


Installation

composer require 'sunrise/http-router:^2.6'

QuickStart

The example uses other sunrise packages, but you can use, for example, zend/diactoros or any other.

composer require sunrise/http-message sunrise/http-server-request
use Sunrise\Http\Message\ResponseFactory;
use Sunrise\Http\Router\RequestHandler\CallableRequestHandler;
use Sunrise\Http\Router\RouteCollector;
use Sunrise\Http\Router\Router;
use Sunrise\Http\ServerRequest\ServerRequestFactory;

use function Sunrise\Http\Router\emit;

$collector = new RouteCollector();

$collector->get('home', '/', new CallableRequestHandler(function ($request) {
    return (new ResponseFactory)->createJsonResponse(200, [
        'status' => 'ok',
    ]);
}));

$router = new Router();
$router->addRoute(...$collector->getCollection()->all());

$request = ServerRequestFactory::fromGlobals();
$response = $router->handle($request);

emit($response);

Examples of using

Study sunrise/awesome-skeleton to understand how this can be used.

Strategy loading routes from configs

use Sunrise\Http\Router\Loader\CollectableFileLoader;
use Sunrise\Http\Router\Router;

$loader = new CollectableFileLoader();
$loader->attach('routes/api.php');
$loader->attach('routes/admin.php');
$loader->attach('routes/public.php');

// or attach a directory...
// [!] available from version 2.2
$loader->attach('routes');

// or attach an array...
// [!] available from version 2.4
$loader->attachArray([
    'routes/api.php',
    'routes/admin.php',
    'routes/public.php',
]);

$router = new Router();
$router->load($loader);

// if the router is used as a request handler
$response = $router->handle($request);

// if the router is used as middleware
$response = $router->process($request, $handler);

Strategy loading routes from descriptors (annotations or attributes)

use Doctrine\Common\Annotations\AnnotationRegistry;
use Sunrise\Http\Router\Loader\DescriptorDirectoryLoader;
use Sunrise\Http\Router\Router;

// necessary if you will use annotations (annotations isn't attributes)...
AnnotationRegistry::registerLoader('class_exists');

$loader = new DescriptorDirectoryLoader();
$loader->attach('src/Controller');

// or attach an array
// [!] available from version 2.4
$loader->attachArray([
    'src/Controller',
    'src/Bundle/BundleName/Controller',
]);

$router = new Router();
$router->load($loader);

// if the router is used as a request handler
$response = $router->handle($request);

// if the router is used as middleware
$response = $router->process($request, $handler);

Without loading strategy

use App\Controller\HomeController;
use Sunrise\Http\Router\RouteCollector;
use Sunrise\Http\Router\Router;

$collector = new RouteCollector();
$collector->get('home', '/', new HomeController());

$router = new Router();
$router->addRoute(...$collector->getCollection()->all());

// if the router is used as a request handler
$response = $router->handle($request);

// if the router is used as middleware
$response = $router->process($request, $handler);

Route Annotation Example

Minimal annotation view
/**
 * @Route(
 *   name="api_v1_entry_update",
 *   path="/api/v1/entry/{id<@uuid>}(/{optionalAttribute})",
 *   methods={"PATCH"},
 * )
 */
final class EntryUpdateRequestHandler implements RequestHandlerInterface
Full annotation
/**
 * @Route(
 *   name="api_v1_entry_update",
 *   host="api.host",
 *   path="/api/v1/entry/{id<@uuid>}(/{optionalAttribute})",
 *   methods={"PATCH"},
 *   middlewares={
 *     "App\Middleware\CorsMiddleware",
 *     "App\Middleware\ApiAuthMiddleware",
 *   },
 *   attributes={
 *     "optionalAttribute": "defaultValue",
 *   },
 *   summary="Updates an entry by UUID",
 *   description="Here you can describe the method in more detail...",
 *   tags={"api", "entry"},
 *   priority=0,
 * )
 */
final class EntryUpdateRequestHandler implements RequestHandlerInterface

Route Attribute Example

Minimal attribute view
use Sunrise\Http\Router\Attribute\Route;

#[Route(
    name: 'api_v1_entry_update',
    path: '/api/v1/entry/{id<@uuid>}(/{optionalAttribute})',
    methods: ['PATCH'],
)]
final class EntryUpdateRequestHandler implements RequestHandlerInterface
Full attribute
use Sunrise\Http\Router\Attribute\Route;

#[Route(
    name: 'api_v1_entry_update',
    host: 'api.host',
    path: '/api/v1/entry/{id<@uuid>}(/{optionalAttribute})',
    methods: ['PATCH'],
    middlewares: [
        \App\Middleware\CorsMiddleware::class,
        \App\Middleware\ApiAuthMiddleware::class,
    ],
    attributes: [
        'optionalAttribute' => 'defaultValue',
    ],
    summary: 'Updates an entry by UUID',
    description: 'Here you can describe the method in more detail...',
    tags: ['api', 'entry'],
    priority: 0,
)]
final class EntryUpdateRequestHandler implements RequestHandlerInterface

Useful to know

OpenApi (Swagger)

composer require 'sunrise/http-router-openapi:^1.1'

Generation documentation for Swagger (OAS)

use Sunrise\Http\Router\OpenApi\Object\Info;
use Sunrise\Http\Router\OpenApi\OpenApi;

$openApi = new OpenApi(new Info('0.0.1', 'API'));

$openApi->addRoute(...$router->getRoutes());

$openApi->toArray();

Validation a request body via Swagger documentation

use Sunrise\Http\Router\OpenApi\Middleware\RequestBodyValidationMiddleware;

$route->addMiddleware(new RequestBodyValidationMiddleware());

or using annotations:

/**
 * @Route(
 *   name="foo",
 *   path="/foo",
 *   methods={"post"},
 *   middlewares={
 *     "Sunrise\Http\Router\OpenApi\Middleware\RequestBodyValidationMiddleware",
 *   },
 * )
 */

Generation a route URI

$uri = $router->generateUri('route.name', [
    'attribute' => 'value',
], true);

Run a route

$response = $router->getRoute('route.name')->handle($request);

Route grouping

$collector->group(function ($collector) {
    $collector->group(function ($collector) {
        $collector->group(function ($collector) {
            $collector->get('api.entry.read', '/{id<\d+>}', ...)
                ->addMiddleware(...); // add the middleware(s) to the route...
        })
        ->addPrefix('/entry') // add the prefix to the group...
        ->unshiftMiddleware(...); // add the middleware(s) to the group...
    })
    ->addPrefix('/v1') // add the prefix to the group...
    ->unshiftMiddleware(...); // add the middleware(s) to the group...
})
->addPrefix('/api') // add the prefix to the group...
->unshiftMiddleware(...); // add the middleware(s) to the group...

Route patterns

$collector->get('api.entry.read', '/api/v1/entry/{id<\d+>}(/{optional<\w+>})');

Hosts (available from version 2.6.0)

Note: if you don't assign a host for a route, it will be available on any hosts!

// move the hosts table into the settings...
$router->addHost('public.host', 'www.example.com');
$router->addHost('admin.host', 'secret.example.com');
$router->addHost('api.host', 'api.example.com');

// the route will available only on the `secret.example.com` host...
$route->setHost('admin.host');

// routes in the group will available on the `secret.example.com` host...
$collector->group(function ($collector) {
    // some code...
})
->setHost('admin.host');

Test run

composer test

Useful links

Issues
  • Router: fixes and questions

    Router: fixes and questions

    1. https://github.com/sunrise-php/http-router/blob/85837a0ce1fb82fa937ca90560b511a4b2192665/src/RouteCollection.php#L148 $methods = (new \ReflectionClass(RequestMethodInterface::class))->getConstants();
    2. Why route_regex excluded from Route?
    3. Route::buildRegex() not chached compiled pattern - it's freeze executing
    4. Route::group() cant defines attributes in prefix + cant set methods by default for group routes.
    5. https://github.com/sunrise-php/http-router/blob/85837a0ce1fb82fa937ca90560b511a4b2192665/src/Route.php#L213 Why route cloned? This attributes not contains in RouteCollection. Class doesnt have other methods to set attributes + cant define attributes by default
    6. https://github.com/sunrise-php/http-router/blob/85837a0ce1fb82fa937ca90560b511a4b2192665/functions/route_regex.php#L28 '/{(\w+)}/' - \w contains locale symbols, pure - '/{([a-z0-9_]+)}/'
    7. '$#ui' URI attributes may be case sensitive, i vote to '$#uD'
    8. Path prefix/suffix not contains separately - setPath() rewrite all path
    9. https://github.com/sunrise-php/http-router/blob/85837a0ce1fb82fa937ca90560b511a4b2192665/functions/route_regex.php#L24 add slashes in setters (addSuffix, addPrefix, setPath)
    10. https://github.com/sunrise-php/http-router/blob/85837a0ce1fb82fa937ca90560b511a4b2192665/src/RouteCollection.php#L37 id property dont used as key part - cant overwrite route dublicates, may be set $routes as SplObjectStorage? route - key, id - value;
    11. https://github.com/sunrise-php/http-router/blob/85837a0ce1fb82fa937ca90560b511a4b2192665/src/Router.php#L103 in_array($request->getMethod(), $route->getMethods()) faster then preg_match($regex, $request->getUri()->getPath(), $matches). move up in_array
    12. Why RequestHandler::handle() call only one middleware? why $middlewareQueue is SplQueue? It`s prevents using them again for inner(server side) requests
    13. Cant find Route::getUri(array $attributes = []) : string or something like this - generate URI by route with attributes
    opened by WinterSilence 83
  • Route name support

    Route name support

    I am interested to add your router to my framework: https://github.com/chubbyphp/chubbyphp-framework

    This would need route name support and https://github.com/sunrise-php/http-router/issues/27 and the following would be cool to: https://github.com/sunrise-php/http-router/issues/23

    question feature 
    opened by dominikzogg 36
  • Generate a route path with id and (if needed) arguments

    Generate a route path with id and (if needed) arguments

    Is there any way to do that ? This could be a great feature to avoid harcoded path.

    feature 
    opened by DevFelixDorn 17
  • Hard dependence on ResponseFactory

    Hard dependence on ResponseFactory

    RequestHandler uses Sunrise\Http\Message\ResponseFactory. How about adding Psr\Http\Message\RequestFactoryInterface dependencies to the constructor of RequestHandler and Router classes?

    question 
    opened by PhantomArt 11
  • Update path_build.php

    Update path_build.php

    Cache result +first step to Exception::__construct(string $message, array $placeholders = [], int $code = 0, Throwable $prev)

    opened by WinterSilence 7
  • path_build: InvalidArgumentException

    path_build: InvalidArgumentException

    Would be great if you could create custom exceptions for that, or at least add diffrent codes for not matching and missing attributes (v2)

    feature 
    opened by dominikzogg 6
  • Flexible request handler definition for route

    Flexible request handler definition for route

    I tried to use this router without annotations/attributes. All route definition methods require request handler to implement RequestHandlerInterface:

    public function get(
        string $name,
        string $path,
        RequestHandlerInterface $requestHandler, // question about this parameter
        array $middlewares = [],
        array $attributes = []
    ) : RouteInterface {
      ...
    }
    

    But this is hard to use with invokable actions or controllers. Documentation shows simple example:

    $collector = new RouteCollector();
    $collector->get('home', '/', new HomeController());
    

    Actions and controller constructors can hold dependencies and usage with initiating new action object is not comfortable. It can be solved with DI like so:

    $collector->get('test', '/test', $container->get(\App\Action\TestAction::class));
    

    but it is not cool too.

    I suggest to extend route request handler type to accept callables, path to classes:

    $collector->get('test', '/test', \App\Action\Article\UpdateAction::class);
    $collector->get('test', '/test', [\App\Controller\ArticleController::class, 'update]);
    
    opened by webman 5
  • Per-route

    Per-route "after" middleware not working

    When I define an "after" middleware to a single route (i.e. it works with the chain's response object), and I have a router-wide middleware in place that returns a response, the per-route middleware is never invoked from the looks of it (or then I'm doing something stupid).

    If I switch around the middleware stack injection order to RequestHandler in Router::handle() (so the per-route middleware is injected first, then Router-based middleware) things work as I would expect (https://github.com/sunrise-php/http-router/blob/master/src/Router.php#L137-L145).

    Small example that fails on my end. Packages required are this router package, and zend/diactoros, along with the PSR interfaces.

    <?php
    
    use Psr\Http\Message\ResponseInterface as RI;
    use Psr\Http\Message\ServerRequestInterface as SRI;
    use Psr\Http\Server\MiddlewareInterface;
    use Psr\Http\Server\RequestHandlerInterface as RHI;
    use Sunrise\Http\Router\RouteCollection;
    use Sunrise\Http\Router\Router;
    use Zend\Diactoros\Response\HtmlResponse;
    use Zend\Diactoros\ServerRequestFactory;
    
    include dirname(__DIR__) . '/vendor/autoload.php';
    
    function callback_action(SRI $req) : RI
    {
        return new HtmlResponse('foo bar');
    }
    
    class MyRouteMiddleware implements MiddlewareInterface
    {
        // this method is never called
        // you can even call `die` inside it and nothing happens
        public function process(SRI $req, RHI $handler) : RI
        {
            $response = $handler->handle($req);
    
            return $response->withHeader('X-Foo', 'bar');
        }
    }
    
    class MyAppMiddleware implements MiddlewareInterface
    {
        public function process(SRI $req, RHI $handler) : RI
        {
            // this just takes the route "handler" and calls it to return
            // a response see callback_action($req)
            $action_callable = $req->getAttribute('@route');
    
            return $action_callable($req);
        }
    }
    
    // first create a router, and add an "app-wide" middleware to it
    $router = new Router();
    $router->addMiddleware(new MyAppMiddleware());
    
    // then create individual route, and add a per-route middleware to it
    $routes = new RouteCollection();
    $routes->get('\\callback_action', '/')
        ->addMiddleware(new MyRouteMiddleware());
    
    $router->addRoutes($routes);
    
    $request = ServerRequestFactory::fromGlobals();
    
    // dispatch via the router
    $response = $router->handle($request);
    
    assert(trim($response->getBody()) === 'foo bar'); // this does not fail
    assert($response->hasHeader('X-Foo')); // this fails
    

    Please do say if I'm doing something wrong here, maybe I'm just blind form debugging this and am missing a stupid mistake somewhere.

    question 
    opened by rask 4
  • PHP 8 support

    PHP 8 support

    I am prepare a PHP 8 compatible release for https://github.com/chubbyphp/chubbyphp-framework-router-sunrise would be cool if you would allow to use your package with php 8.

    feature 
    opened by dominikzogg 2
  • Suggestion: lazy-load middleware using PSR-11

    Suggestion: lazy-load middleware using PSR-11

    It would be good to lazy-load middleware.

    $routes->addMiddleware(new Middleware1());  // Creates the middleware now.
    $routes->addMiddleware(Middleware2::class); // Creates the middleware if/when it is needed.
    

    The dispatcher can then use a PSR-11 container to create the middleware.

    e.g.

    if (is_string($middleware)) {
       $middleware = $this->psr11_container->get($middleware);
    }
    
    opened by fisharebest 2
  • Update dependency symfony/console to v5

    Update dependency symfony/console to v5

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | symfony/console (source) | require-dev | major | ^4.4 -> 5.3.7 |


    Release Notes

    symfony/console

    v5.3.7

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.3.6...v5.3.7)

    • bug #​42685 Fix ProgressBar to correctly clear multi-line formats (rtek)
    • bug #​42381 Don't pass null to preg_replace() (derrabus)
    • bug #​42260 Fix return types for PHP 8.1 (derrabus)

    v5.3.6

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.3.5...v5.3.6)

    • no significant changes

    v5.3.4

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.3.3...v5.3.4)

    • bug #​42207 fix table setHeaderTitle without headers (a1812)
    • bug #​42091 Run commands when implements SignalableCommandInterface without pcntl and they have'nt signals (PaolaRuby)
    • bug #​42174 Indicate compatibility with psr/log 2 and 3 (derrabus)
    • bug #​42009 Fix save correct name in setDefaultCommand() for PHP8 (a1812)
    • bug #​41966 Revert "bug #​41952 fix handling positional arguments" (chalasr, nicolas-grekas)
    • bug #​41952 fix handling positional arguments (nicolas-grekas)

    v5.3.2

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.3.1...v5.3.2)

    • bug #​41686 Fix using #[AsCommand] without DI (nicolas-grekas)
    • bug #​41680 fix managing signals when commands are lazy loaded (nicolas-grekas)
    • bug #​41535 Fix negated options not accessible (jderusse)
    • bug #​41386 Escape synopsis output (jschaedl)

    v5.3.0

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.3.0-RC1...v5.3.0)

    • no significant changes

    v5.2.14

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.13...v5.2.14)

    • no significant changes

    v5.2.12

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.11...v5.2.12)

    • bug #​42207 fix table setHeaderTitle without headers (a1812)
    • bug #​42091 Run commands when implements SignalableCommandInterface without pcntl and they have'nt signals (PaolaRuby)
    • bug #​42174 Indicate compatibility with psr/log 2 and 3 (derrabus)
    • bug #​41966 Revert "bug #​41952 fix handling positional arguments" (chalasr, nicolas-grekas)
    • bug #​41952 fix handling positional arguments (nicolas-grekas)

    v5.2.11

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.10...v5.2.11)

    • bug #​41386 Escape synopsis output (jschaedl)

    v5.2.10

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.9...v5.2.10)

    • no significant changes

    v5.2.8

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.7...v5.2.8)

    • bug #​41174 Fix Windows code page support (orkan)
    • bug #​41113 Fix Windows code page support (orkan)

    v5.2.7

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.6...v5.2.7)

    • bug #​40698 Add Helper::width() and Helper::length() (Nyholm, grasmash)

    v5.2.6

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.5...v5.2.6)

    • bug #​40593 Uses the correct assignment action for console options depending if they are short or long (topikito)
    • bug #​40524 fix emojis messing up the line width (MarionLeHerisson)
    • bug #​40348 Fix line wrapping for decorated text in block output (grasmash)
    • bug #​40460 Correctly clear lines for multi-line progress bar messages (grasmash)
    • bug #​40450 ProgressBar clears too many lines on update (danepowell)

    v5.2.5

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.4...v5.2.5)

    • no significant changes

    v5.2.4

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.3...v5.2.4)

    • bug #​40192 fix QuestionHelper::getHiddenResponse() not working with space in project directory name (Yendric)
    • bug #​40187 Fix PHP 8.1 null error for preg_match flag (kylekatarnls)

    v5.2.3

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.2...v5.2.3)

    • no changes

    v5.2.2

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.1...v5.2.2)

    • bug #​39932 Fix Closure code binding when it is a static anonymous function (fancyweb)

    v5.2.1

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.2.0...v5.2.1)

    • bug #​39361 acces public-deprecated services via the private container to remove false-positive deprecations (nicolas-grekas)
    • bug #​39223 Re-enable hyperlinks in Konsole/Yakuake (OndraM)

    v5.2.0

    Compare Source

    • Added SingleCommandApplication::setAutoExit() to allow testing via CommandTester
    • added support for multiline responses to questions through Question::setMultiline() and Question::isMultiline()
    • Added SignalRegistry class to stack signals handlers
    • Added support for signals:
      • Added Application::getSignalRegistry() and Application::setSignalsToDispatchEvent() methods
      • Added SignalableCommandInterface interface
    • Added TableCellStyle class to customize table cell
    • Removed php prefix invocation from help messages.

    v5.1.11

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.10...v5.1.11)

    • bug #​39932 Fix Closure code binding when it is a static anonymous function (fancyweb)

    v5.1.10

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.9...v5.1.10)

    • bug #​39361 acces public-deprecated services via the private container to remove false-positive deprecations (nicolas-grekas)
    • bug #​39223 Re-enable hyperlinks in Konsole/Yakuake (OndraM)

    v5.1.9

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.8...v5.1.9)

    • bug #​39160 Use a partial buffer in SymfonyStyle (jderusse)
    • bug #​39168 Fix console closing tag (jderusse)
    • bug #​38991 Fix ANSI when stdErr is not a tty (jderusse)

    v5.1.8

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.7...v5.1.8)

    • no changes

    v5.1.7

    Compare Source

    v5.1.6

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.5...v5.1.6)

    • bug #​38166 work around disabled putenv() (SenTisso)
    • bug #​38116 Silence warnings on sapi_windows_cp_set() call (chalasr)
    • bug #​38114 guard $argv + $token against null, preventing unnecessary exceptions (bilogic)
    • bug #​38080 Make sure $maxAttempts is an int or null (derrabus)

    v5.1.5

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.4...v5.1.5)

    • bug #​38024 Fix undefined index for inconsistent command name definition (chalasr)

    v5.1.4

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.3...v5.1.4)

    • bug #​37731 Table: support cells with newlines after a cell with colspan >= 2 (GMTA)
    • bug #​37774 Make sure we pass a numeric array of arguments to call_user_func_array() (derrabus)

    v5.1.3

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.2...v5.1.3)

    • bug #​37469 always use stty when possible to ask hidden questions (nicolas-grekas)
    • bug #​37385 Fixes question input encoding on Windows (YaFou)

    v5.1.2

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.1...v5.1.2)

    • bug #​37286 Reset question validator attempts only for actual stdin (bis) (nicolas-grekas)
    • bug #​37160 Reset question validator attempts only for actual stdin (ostrolucky)

    v5.1.1

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.1.0...v5.1.1)

    • bug #​37130 allow cursor to be used even when STDIN is not defined (xabbuh)

    v5.1.0

    Compare Source

    • Command::setHidden() is final since Symfony 5.1
    • Add SingleCommandApplication
    • Add Cursor class

    v5.0.11

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.0.10...v5.0.11)

    • bug #​37469 always use stty when possible to ask hidden questions (nicolas-grekas)
    • bug #​37385 Fixes question input encoding on Windows (YaFou)
    • bug #​37286 Reset question validator attempts only for actual stdin (bis) (nicolas-grekas)
    • bug #​37160 Reset question validator attempts only for actual stdin (ostrolucky)

    v5.0.10

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.0.9...v5.0.10)

    • no changes

    v5.0.9

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.0.8...v5.0.9)

    • bug #​37007 Fix QuestionHelper::disableStty() (chalasr)
    • bug #​37000 Add meaningful message when using ProcessHelper and Process is not installed (l-vo)
    • bug #​36696 don't check tty on stdin, it breaks with "data lost during stream conversion" (nicolas-grekas)
    • bug #​36590 Default hidden question to 1 attempt for non-tty session (ostrolucky)

    v5.0.8

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.0.7...v5.0.8)

    • no changes

    v5.0.7

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.0.6...v5.0.7)

    • bug #​36222 Fix OutputStream for PHP 7.4 (guillbdx)

    v5.0.6

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.0.5...v5.0.6)

    • bug #​36031 Fallback to default answers when unable to read input (ostrolucky)

    v5.0.5

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.0.4...v5.0.5)

    • bug #​35676 Handle zero row count in appendRow() for Table (Adam Prickett)
    • bug #​35696 Don't load same-namespace alternatives on exact match (chalasr)
    • bug #​33897 Consider STDIN interactive (ostrolucky)
    • bug #​34114 SymonfyStyle - Check value isset to avoid PHP notice (leevigraham)

    v5.0.4

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.0.3...v5.0.4)

    • no changes

    v5.0.3

    Compare Source

    Changelog (https://github.com/symfony/console/compare/v5.0.2...v5.0.3)

    • bug #​35094 Fix filtering out identical alternatives when there is a command loader (fancyweb)

    v5.0.2

    Compare Source

    v5.0.1

    Compare Source

    v5.0.0

    Compare Source

    • removed support for finding hidden commands using an abbreviation, use the full name instead
    • removed TableStyle::setCrossingChar() method in favor of TableStyle::setDefaultCrossingChar()
    • removed TableStyle::setHorizontalBorderChar() method in favor of TableStyle::setDefaultCrossingChars()
    • removed TableStyle::getHorizontalBorderChar() method in favor of TableStyle::getBorderChars()
    • removed TableStyle::setVerticalBorderChar() method in favor of TableStyle::setVerticalBorderChars()
    • removed TableStyle::getVerticalBorderChar() method in favor of TableStyle::getBorderChars()
    • removed support for returning null from Command::execute(), return 0 instead
    • ProcessHelper::run() accepts only array|Symfony\Component\Process\Process for its command argument
    • Application::setDispatcher accepts only Symfony\Contracts\EventDispatcher\EventDispatcherInterface for its dispatcher argument
    • renamed Application::renderException() and Application::doRenderException() to renderThrowable() and doRenderThrowable() respectively.

    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update dependency sunrise/http-factory to v1.1.1

    Update dependency sunrise/http-factory to v1.1.1

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | sunrise/http-factory | require-dev | patch | 1.1.0 -> 1.1.1 |


    Release Notes

    sunrise-php/http-factory

    v1.1.1

    Compare Source

    • Minor changes.

    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Dependency Dashboard

    Dependency Dashboard

    This issue provides visibility into Renovate updates and their statuses. Learn more

    Open

    These updates have all been created already. Click a checkbox below to force a retry/rebase of any.


    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
  • Pin dependency symfony/console to v4.4.30

    Pin dependency symfony/console to v4.4.30

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | symfony/console (source) | require-dev | pin | ^4.4 -> 4.4.30 |

    📌 Important: Renovate will wait until you have merged this Pin PR before creating any upgrade PRs for the affected packages. Add the preset :preserveSemverRanges to your config if you instead don't wish to pin dependencies.


    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Pin dependency doctrine/annotations to 1.13.2

    Pin dependency doctrine/annotations to 1.13.2

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | doctrine/annotations (source) | require-dev | pin | ^1.6 -> 1.13.2 |

    📌 Important: Renovate will wait until you have merged this Pin PR before creating any upgrade PRs for the affected packages. Add the preset :preserveSemverRanges to your config if you instead don't wish to pin dependencies.


    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update circleci/php Docker tag to v8

    Update circleci/php Docker tag to v8

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | circleci/php | docker | major | 7.4-cli-node-browsers -> 8.0-cli-node-browsers | | circleci/php | docker | major | 7.3-cli-node-browsers -> 8.0-cli-node-browsers | | circleci/php | docker | major | 7.2-cli-node-browsers -> 8.0-cli-node-browsers | | circleci/php | docker | major | 7.1-cli-node-browsers -> 8.0-cli-node-browsers |


    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about these updates again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update circleci/php Docker tag to v7.4

    Update circleci/php Docker tag to v7.4

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | circleci/php | docker | minor | 7.3-cli-node-browsers -> 7.4-cli-node-browsers | | circleci/php | docker | minor | 7.2-cli-node-browsers -> 7.4-cli-node-browsers | | circleci/php | docker | minor | 7.1-cli-node-browsers -> 7.4-cli-node-browsers |


    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about these updates again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update dependency psr/container to v2

    Update dependency psr/container to v2

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | psr/container | require | major | ^1.0 -> ^2.0 |


    Release Notes

    php-fig/container

    v2.0.1

    Compare Source

    v2.0.0

    Compare Source

    Changed
    • This release adds the bool return typehint to Psr\Container\ContainerInterface::has(), in accordance with the PSR-11 type additions errata.

    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Add license scan report and status

    Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

    opened by fossabot 1
Releases(v2.11.1)
Owner
Sunrise // PHP
Sunrise // PHP
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ø 370 Oct 10, 2021
A lightweight and simple object oriented PHP Router

bramus/router A lightweight and simple object oriented PHP Router. Built by Bram(us) Van Damme (https://www.bram.us) and Contributors Features Support

Bramus! 723 Oct 13, 2021
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 15 Oct 9, 2021
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 13 Oct 20, 2020
A PHP rewrite of HackRouter by Facebook

Hack-Routing Fast, type-safe request routing, parameter retrieval, and link generation. It's a port of hack-router By Facebook, Inc. Components HTTP E

Saif Eddin Gmati 25 Aug 2, 2021
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 66 Jun 22, 2021
A web router implementation for PHP.

Aura.Router Powerful, flexible web routing for PSR-7 requests. Installation and Autoloading This package is installable and PSR-4 autoloadable via Com

Aura for PHP 448 Sep 7, 2021
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.5k Oct 16, 2021
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 Sep 30, 2021
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 Oct 16, 2021
:bird: Simple PHP router

Macaw Macaw is a simple, open source PHP router. It's super small (~150 LOC), fast, and has some great annotated source code. This class allows you to

Noah Buscher 890 Oct 7, 2021
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 Oct 14, 2021
Auto Route Generating (Auto-Discovery) Package for Laravel.

Laravel Auto Routes _ _____ _ /\ | | | __ \ | |

İzni Burak Demirtaş 142 Oct 6, 2021
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 5 Jun 9, 2021
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 Oct 9, 2021
Fast PSR-7 based routing and dispatch component including PSR-15 middleware, built on top of FastRoute.

Route 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

The League of Extraordinary Packages 576 Oct 20, 2021
Checks if a laravel route is vlaid

Laravel Route Checker Checks if your Laravel routes has valid controllers Installation The package should be installed as a dev dependency, as there i

Worksome 4 Oct 19, 2021
route:menu gives you a beautiful route list which is friendly on smaller terminals and brings a few new features in.

Laravel Route Menu Your route:list, sir. route:menu gives you a beautiful route list which is friendly on smaller terminals and brings a few new featu

Craig Morris 60 May 24, 2021