PHPackages                             dispatch/dispatch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. dispatch/dispatch

Abandoned → [badphp/dispatch](/?search=badphp%2Fdispatch)Library

dispatch/dispatch
=================

a micro-routing library for PHP

11.0.1(2y ago)53715.0k↓100%100[1 issues](https://github.com/noodlehaus/dispatch/issues)MITPHPPHP &gt;= 8.0.0

Since Jun 3Pushed 9mo ago46 watchersCompare

[ Source](https://github.com/noodlehaus/dispatch)[ Packagist](https://packagist.org/packages/dispatch/dispatch)[ Docs](http://github.com/noodlehaus/dispatch)[ RSS](/packages/dispatch-dispatch/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (107)Used By (0)

dispatch
--------

[](#dispatch)

- a tiny library for quick and easy PHP apps
- requires at least PHP 8.x

functions
---------

[](#functions)

Below is the list of functions provided by `dispatch`.

```
function dispatch(...$args): void;
function route(string $method, string $path, callable ...$handlers): void;
function _404(callable $handler = null): callable;
function apply(...$args): void;
function bind(string $name, callable $transform): void;
function action(string $method, string $path, callable ...$handlers): array;
function response(string $body, int $code = 200, array $headers = []): callable;
function redirect(string $location, int $code = 302): callable;
function serve(array $routes, string $reqmethod, string $reqpath, ...$args): callable;
function phtml(string $path, array $vars = []): string;
function stash(string $key, mixed $value = null): mixed;
```

Here's a sample of how you'd usually use them in an app.

```
