{"id":16272497,"url":"https://github.com/bayfrontmedia/route-it","last_synced_at":"2025-03-19T23:31:05.337Z","repository":{"id":56392653,"uuid":"289418241","full_name":"bayfrontmedia/route-it","owner":"bayfrontmedia","description":"A fast, flexible router which can be used to quickly build RESTful web apps.","archived":false,"fork":false,"pushed_at":"2024-12-23T20:42:39.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T12:21:30.208Z","etag":null,"topics":["api","dispatch","http","php","rest","router"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bayfrontmedia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-22T04:22:45.000Z","updated_at":"2024-12-24T03:05:11.000Z","dependencies_parsed_at":"2024-03-12T14:41:10.619Z","dependency_job_id":"ba118162-fad0-454a-8938-f078d8221dfd","html_url":"https://github.com/bayfrontmedia/route-it","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"24e6d9dfbea6219ac2011455af1fabb5450bd336"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayfrontmedia%2Froute-it","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayfrontmedia%2Froute-it/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayfrontmedia%2Froute-it/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayfrontmedia%2Froute-it/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bayfrontmedia","download_url":"https://codeload.github.com/bayfrontmedia/route-it/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244524817,"owners_count":20466506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","dispatch","http","php","rest","router"],"created_at":"2024-10-10T18:18:00.028Z","updated_at":"2025-03-19T23:31:05.332Z","avatar_url":"https://github.com/bayfrontmedia.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Route It\n\nA fast, flexible router which can be used to quickly build RESTful web apps.\n\n- [License](#license)\n- [Author](#author)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n\n## License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n## Author\n\n\u003cimg src=\"https://cdn1.onbayfront.com/bfm/brand/bfm-logo.svg\" alt=\"Bayfront Media\" width=\"250\" /\u003e\n\n- [Bayfront Media homepage](https://www.bayfrontmedia.com?utm_source=github\u0026amp;utm_medium=direct)\n- [Bayfront Media GitHub](https://github.com/bayfrontmedia)\n\n## Requirements\n\n* PHP `^8.0` (Tested up to `8.4`)\n* ctype PHP extension\n\n## Installation\n\n```\ncomposer require bayfrontmedia/route-it\n```\n\n## Usage\n\n### Start using Route It\n\nDefault options:\n\n```\nuse Bayfront\\RouteIt\\Router;\n\n$options = [\n    'automapping_enabled' =\u003e false,\n    'automapping_namespace' =\u003e '',\n    'automapping_route_prefix' =\u003e '',\n    'class_namespace' =\u003e '',\n    'files_root_path' =\u003e '',\n    'force_lowercase_url' =\u003e false\n];\n\n$router = new Router($options);\n```\n\n### Force lowercase\n\nWhen `force_lowercase_url` is enabled in the `$options` array, all incoming requests which contain uppercase characters will be redirected via a 301 redirect to their lowercase counterpart.\nQuery parameters will not be affected.\n\n### Automapping\n\nWhen automapping is enabled, Route It will automatically attempt to dispatch the incoming request in the form of `class/method/optional-parameter` without having to define each individual route.\n\nThe incoming request must match the automapping route prefix, and classes must exist in the automapping namespace as defined in the `$options` array.\n\nFor example:\n\n ```\n use Bayfront\\RouteIt\\Router;\n \n $options = [\n     'automapping_enabled' =\u003e true,\n     'automapping_namespace' =\u003e 'App\\\\Pages',\n     'automapping_route_prefix' =\u003e '/app'\n ];\n \n $router = new Router($options);\n ```\n\nUsing the above example, incoming requests would be automapped like so:\n\n| Endpoint                | Class               | Method | Parameter     |\n|-------------------------|---------------------|--------|---------------|\n| `/app`                  | App\\Pages\\Home      | index  |               |\n| `/app/customers`        | App\\Pages\\Customers | index  |               |\n| `/app/customers/edit`   | App\\Pages\\Customers | edit   |               |\n| `/app/customers/edit/5` | App\\Pages\\Customers | edit   | `['id' =\u003e 5]` |\n\nUnderstandably, automapping does not provide a solution for every scenario, in which case, routes can be added.\n\n### Named routes\n\nNamed routes are helpful when using hyperlinks in controllers, views or templates.\nBy referencing a named route instead of a specific URL, the hyperlink will stay up-to-date with your defined routes.\n\nWhen dispatching a request using the [dispatch](#dispatch) , [dispatchTo](#dispatchto), or [dispatchToFallback](#dispatchtofallback) methods,\nRoute It will automatically insert an array of all named routes to the destination as a parameter with the key of `routes`,\nunless otherwise specified.\n\nSee documentation for these methods for more information.\n\n### Wildcards\n\nWildcards can be used when defining a route in order to dynamically define a path, and send its value to the destination as a parameter. The syntax is `{type:name}`, where `type` is the wildcard type, and `name` is the name of the parameter which is to be passed to the destination.\n\nWildcards include:\n\n- `*`: Any non-whitespace character in this segment of the request\n- `alpha`: Any alphabetic characters in this segment of the request (see [ctype_alpha](https://www.php.net/manual/en/function.ctype-alpha.php))\n- `num`: Any numeric characters in this segment of the request (see [ctype_digit](https://www.php.net/manual/en/function.ctype-digit.php))\n- `alphanum`: Any alphanumeric characters in this segment of the request (see [ctype_alnum](https://www.php.net/manual/en/function.ctype-alnum.php))\n- `**`: Everything else that may exist on the request path (catch-all)\n- `?`: Optionally existing in this segment of the request (can only be used at the last segment)\n\nFor examples, see [addRoute](#addroute).\n\n### Public methods\n\n- [setHost](#sethost)\n- [getHost](#gethost)\n- [setRoutePrefix](#setrouteprefix)\n- [getRoutePrefix](#getrouteprefix)\n- [addFallback](#addfallback)\n- [getFallbacks](#getfallbacks)\n- [addRedirect](#addredirect)\n- [getRedirects](#getredirects)\n- [addRoute](#addroute)\n- [any](#any)\n- [connect](#connect)\n- [delete](#delete)\n- [get](#get)\n- [head](#head)\n- [options](#options)\n- [patch](#patch)\n- [post](#post)\n- [put](#put)\n- [trace](#trace)\n- [getRoutes](#getroutes)\n- [addNamedRoute](#addnamedroute)\n- [getNamedRoutes](#getnamedroutes)\n- [getNamedRoute](#getnamedroute)\n- [resolve](#resolve)\n- [dispatch](#dispatch)\n- [dispatchTo](#dispatchto)\n- [dispatchToFallback](#dispatchtofallback)\n- [redirect](#redirect)\n- [getResolvedParameters](#getresolvedparameters)\n\n\u003chr /\u003e\n\n### setHost\n\n**Description:**\n\nSets the hostname for defined routes.\n\n**Parameters:**\n\n- `$host` (string)\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003esetHost('example.com');\n\n$router-\u003eaddRoute('GET', '/login', function () {\n \n    // Destination for example.com/login\n\n});\n\n$router-\u003esetHost('subdomain.example.com');\n\n$router-\u003eaddRoute('GET', '/login', function () {\n \n    // Destination for subdomain.example.com/login\n\n});\n```\n\n\u003chr /\u003e\n\n### getHost\n\n**Description:**\n\nRetrieves the hostname for defined routes.\n\n**Parameters:**\n\n- None\n\n**Returns:**\n\n- (string)\n\n\u003chr /\u003e\n\n### setRoutePrefix\n\n**Description:**\n\nSets the route prefix for defined routes.\n\n**Parameters:**\n\n- `$prefix` (string)\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003esetHost('example.com')-\u003esetRoutePrefix('app');\n\n$router-\u003eaddRoute('GET', '/login', function () {\n \n    // Destination for example.com/app/login\n\n});\n```\n\n\u003chr /\u003e\n\n### getRoutePrefix\n\n**Description:**\n\nRetrieves the route prefix for defined routes.\n\n**Parameters:**\n\n- None\n\n**Returns:**\n\n- (string)\n\n\u003chr /\u003e\n\n### addFallback\n\n**Description:**\n\nAdds a fallback destination for given request method(s) when no route can be found.\nThe response will be sent with a `404` HTTP status code.\n\n**Parameters:**\n\n- `$methods` (string|array): Request method(s) for which this fallback is valid, or \"ANY\"\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003eaddFallback('ANY', function () {\n    echo '404 page not found';\n});\n```\n\nFor more destination examples, see [addRoute](#addroute).\n\n\u003chr /\u003e\n\n### getFallbacks\n\n**Description:**\n\nReturns array of defined fallbacks.\n\n**Parameters:**\n\n- None\n\n**Returns:**\n\n- (array)\n\n\u003chr /\u003e\n\n### addRedirect\n\n**Description:**\n\nAdds a redirect. Wildcards can be used in the path.\n\n**Parameters:**\n\n- `$methods` (string|array): Request method(s) for which this redirect is valid, or \"ANY\"\n- `$path` (string): Request path\n- `$destination` (string): Can be an internal path or fully qualified URL\n- `$status = 302` (int): HTTP status code used with the redirect\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n// Internal temporary redirect (will not redirect to self)\n\n$router-\u003eaddRedirect('ANY', '{**:path}', '/under-construction', 302);\n\n// Fully qualified URL\n\n$router-\u003eaddRedirect('GET', '/documentation', 'https://www.example.com/new-documentation');\n```\n\nFor more path definition examples, see [addRoute](#addroute).\n\n\u003chr /\u003e\n\n### getRedirects\n\n**Description:**\n\nReturns array of defined redirects.\n\n**Parameters:**\n\n- None\n\n**Returns:**\n\n- (array)\n\n\u003chr /\u003e\n\n### addRoute\n\n**Description:**\n\nAdds a defined route. Wildcards can be used in the path.\n\nDestinations can be a callable function, a named route,  a file, or a `$class-\u003emethod()`. \nEach route can have its own predefined parameter(s), and parameters can also be defined dynamically by a \"wildcard\".\n\n**Parameters:**\n\n- `$methods` (string|array): Request method(s) for which this route is valid, or \"ANY\"\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** \nNames should not be assigned to routes which include wildcards in the path.\nNamed routes are only intended to define specific URL's.\nNamed route names must be unique, as names which already exist are overwritten.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router\n\n    // Callable\n\n    -\u003eaddRoute('GET', '/customers', function () {\n\n        echo 'Customers';\n\n    })\n\n    // Callable with a wildcard parameter\n\n    -\u003eaddRoute('GET', '/customers/{num:id}', function ($params) {\n\n        echo 'Customer id: ' . $params['id'];\n\n    })\n\n    // Callable with optional wildcard (if existing in the request path, it will overwrite the defined parameter)\n\n    -\u003eaddRoute('GET', '/optional/{?:name}', function ($params) {\n\n        echo 'Hello, ' . $params['name'] . '! This is a callable with an optional parameter.';\n\n    }, [\n        'name' =\u003e 'John'\n    ])\n\n    // Callable, saving as a named route\n\n    -\u003eaddRoute('GET', '/login', function($params) {\n\n        // Login\n\n    }, [], 'login')\n\n    // To a named route\n\n    -\u003eaddRoute('GET', '/oldlogin', 'login')\n\n    // To a file from the files_root_path as defined in the options array\n\n    -\u003eaddRoute('GET', '/file', '@filename.html')\n\n    // To a class:method from the class_namespace as defined in the options array\n\n    -\u003eaddRoute('GET', '/class', 'TestClass:index', ['greeting' =\u003e 'Hello!']);\n```\n\n\u003chr /\u003e\n\n### any\n\n**Description:**\n\nAdds route for ANY request method.\n\nEquivalent of calling `addRoute('ANY'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003eany('/customers', 'Controller:anyMethod');\n```\n\n\u003chr /\u003e\n\n### connect\n\n**Description:**\n\nAdds route for CONNECT request method.\n\nEquivalent of calling `addRoute('CONNECT'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003econnect('/customers', 'Controller:connectMethod');\n```\n\n\u003chr /\u003e\n\n### delete\n\n**Description:**\n\nAdds route for DELETE request method.\n\nEquivalent of calling `addRoute('DELETE'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003edelete('/customers', 'Controller:deleteMethod');\n```\n\n\u003chr /\u003e\n\n### get\n\n**Description:**\n\nAdds route for GET request method.\n\nEquivalent of calling `addRoute('GET'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003eget('/customers', 'Controller:getMethod');\n```\n\n\u003chr /\u003e\n\n### head\n\n**Description:**\n\nAdds route for HEAD request method.\n\nEquivalent of calling `addRoute('HEAD'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003ehead('/customers', 'Controller:headMethod');\n```\n\n\u003chr /\u003e\n\n### options\n\n**Description:**\n\nAdds route for OPTIONS request method.\n\nEquivalent of calling `addRoute('OPTIONS'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003eoptions('/customers', 'Controller:optionsMethod');\n```\n\n\u003chr /\u003e\n\n### patch\n\n**Description:**\n\nAdds route for PATCH request method.\n\nEquivalent of calling `addRoute('PATCH'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003epatch('/customers', 'Controller:patchMethod');\n```\n\n\u003chr /\u003e\n\n### post\n\n**Description:**\n\nAdds route for POST request method.\n\nEquivalent of calling `addRoute('POST'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003epost('/customers', 'Controller:postMethod');\n```\n\n\u003chr /\u003e\n\n### put\n\n**Description:**\n\nAdds route for PUT request method.\n\nEquivalent of calling `addRoute('PUT'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003eput('/customers', 'Controller:putMethod');\n```\n\n\u003chr /\u003e\n\n### trace\n\n**Description:**\n\nAdds route for TRACE request method.\n\nEquivalent of calling `addRoute('TRACE'...)`\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n- `$name = NULL` (string|null): An optional name to assign to this route\n\n**NOTE:** Names should not be assigned to routes which include wildcards in the path. Named routes are only intended to define specific URL's.\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003etrace('/customers', 'Controller:traceMethod');\n```\n\n\u003chr /\u003e\n\n### getRoutes\n\n**Description:**\n\nReturns array of defined routes.\n\n**Parameters:**\n\n- None\n\n**Returns:**\n\n- (array)\n\n\u003chr /\u003e\n\n### addNamedRoute\n\n**Description:**\n\nAdds a specific path as a named route.\n\nThis is helpful when wanting to reference a URL that is not defined as a route.\n\n**Parameters:**\n\n- `$path` (string): Request path\n- `$name` (string): Name to assign to this route\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```\n$router-\u003esetHost('example.com')-\u003esetPrefix('app');\n\n$router-\u003eaddNamedRoute('/assets/css', 'css');\n\n// Returns: https://example.com/app/assets/css\necho $router-\u003egetNamedRoute('login'); \n```\n\n\u003chr /\u003e\n\n### getNamedRoutes\n\n**Description:**\n\nReturns array of named routes.\n\nAutomatically replaces wildcards with resolved parameters.\n\n**Parameters:**\n\n- `$params = []` (array): Additional parameters used to replace wildcards in the named route\n\n**Returns:**\n\n- (array)\n\n\u003chr /\u003e\n\n### getNamedRoute\n\n**Description:**\n\nReturns URL of a named route.\n\nAutomatically replaces wildcards with resolved parameters.\n\n**Parameters:**\n\n- `$name` (string)\n- `$default = ''` (string): Default value to return if named route does not exist\n- `$params = []` (array): Additional parameters used to replace wildcards in the named route\n\n**Returns:**\n\n- (string)\n\n\u003chr /\u003e\n\n### resolve\n\n**Description:**\n\nResolves the incoming HTTP request by searching for a matching redirect, route, automapped location, or fallback.\nDestination-specific parameters will overwrite global parameters of the same key.\n\nThe returned array consists of the following keys:\n\n- `type`\n- `destination`\n- `status` (HTTP status code)\n- `params` (Array)\n\nThe destination will vary based on the type:\n\n| type       | destination      |\n|------------|------------------|\n| `redirect` | URL              |\n| `route`    | Defined route    |\n| `automap`  | `Class:method`   |\n| `fallback` | Defined callback |\n\nA `DispatchException` will be thrown if the request is unable to be resolved.\n\n**Parameters:**\n\n- `$params = []` (array): Global parameters to pass to all destinations\n\n**Returns:**\n\n- (array)\n\n\u003chr /\u003e\n\n### dispatch\n\n**Description:**\n\nResolves and dispatches the incoming HTTP request.\n\nDestination-specific parameters will overwrite global parameters of the same key.\n\n**Parameters:**\n\n- `$params = []` (array): Global parameters to pass to all destinations \n\n**Returns:**\n\n- (mixed)\n\n**Throws:**\n\n- `Bayfront\\RouteIt\\DispatchException`\n\n**Example:**\n\n```\nuse Bayfront\\RouteIt\\DispatchException;\nuse Bayfront\\RouteIt\\Router;\n\n$options = [\n    'automapping_enabled' =\u003e false,\n    'automapping_namespace' =\u003e '',\n    'automapping_route_prefix' =\u003e '',\n    'class_namespace' =\u003e '',\n    'files_root_path' =\u003e '',\n    'force_lowercase_url' =\u003e false\n];\n\n$router = new Router($options);\n\n// Add routes here\n\ntry {\n\n    $router-\u003edispatch();\n\n} catch (DispatchException $e) {\n    die($e-\u003egetMessage());\n}\n```\n\n### dispatchTo\n\n**Description:**\n\nDispatches to a specific destination.\n\nDestinations can be a callable function, a named route, a file, or a `$class-\u003emethod()`.\n\n**Parameters:**\n\n- `$destination` (mixed)\n- `$params = []` (array): Parameters to pass to the destination\n\n**Returns:**\n\n- (mixed)\n\n**Throws:**\n\n- `Bayfront\\RouteIt\\DispatchException`\n\n**Example:**\n\n```\ntry {\n\n    $router-\u003edispatchTo('TestClass:index');\n\n} catch (DispatchException $e) {\n    die($e-\u003egetMessage());\n}\n```\n\n### dispatchToFallback\n\n**Description:**\n\nDispatches to fallback for current request method, or throws exception.\n\nFallback-specific parameters defined using the `addFallback` method will overwrite these parameters of the same key.\n\n**Parameters:**\n\n- `$params = []` (array): Parameters to pass to the destination\n\n**Returns:**\n\n- (mixed)\n\n**Throws:**\n\n- `Bayfront\\RouteIt\\DispatchException`\n\n**Example:**\n\n```\ntry {\n\n    $router-\u003edispatchToFallback();\n\n} catch (DispatchException $e) {\n    die($e-\u003egetMessage());\n}\n```\n\n### redirect\n\n**Description:**\n\nRedirects to a given URL using a given status code.\n\n**Parameters:**\n\n- `$url` (string): Fully qualified URL\n- `$status = 302`: HTTP status code to return\n\n**Returns:**\n\n- (void)\n\n**Throws:**\n\n- `Bayfront\\RouteIt\\DispatchException`\n\n**Example:**\n\n```\ntry {\n\n    $router-\u003eredirect('https://www.example.com);\n\n} catch (DispatchException $e) {\n    die($e-\u003egetMessage());\n}\n```\n\n\u003chr /\u003e\n\n### getResolvedParameters\n\n**Description:**\n\nGet array of all parameters present for the current route once resolved/dispatched.\n\n**Parameters:**\n\n- None\n\n**Returns:**\n\n- (array)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayfrontmedia%2Froute-it","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbayfrontmedia%2Froute-it","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayfrontmedia%2Froute-it/lists"}