{"id":23292820,"url":"https://github.com/lemmon/router","last_synced_at":"2025-08-01T04:39:47.055Z","repository":{"id":62516776,"uuid":"51690569","full_name":"lemmon/router","owner":"lemmon","description":"Lightweight standalone routing library for PHP","archived":false,"fork":false,"pushed_at":"2016-04-26T18:42:02.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-13T00:44:10.686Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lemmon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-14T10:38:55.000Z","updated_at":"2017-09-14T13:33:05.000Z","dependencies_parsed_at":"2022-11-02T13:45:25.287Z","dependency_job_id":null,"html_url":"https://github.com/lemmon/router","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmon%2Frouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmon%2Frouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmon%2Frouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmon%2Frouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lemmon","download_url":"https://codeload.github.com/lemmon/router/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247535250,"owners_count":20954571,"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":[],"created_at":"2024-12-20T06:12:10.242Z","updated_at":"2025-04-06T18:45:48.773Z","avatar_url":"https://github.com/lemmon.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lemmon Router\n\n**Lemmon Router** is a lightweight standalone routing library for PHP 7.\n\n* Flexible regular expression routing\n* Simple and lightweight\n* RESTful routing\n* Fast (100k requests/second)\n* Mod_Rewrite is not required, although supported; extreme portability for rapid development\n\n## Getting started\n\n1. PHP 7.x is required\n2. Install Lemmon Router using [Composer](#composer-installation) (recommended) or manually\n\n## Composer Installation\n\n1. Get [Composer](http://getcomposer.org/)\n2. Require Lemmon Router with `php composer.phar require lemmon/router`\n3. Add the following to your application's main PHP file: `require 'vendor/autoload.php';`\n\n## Examples\n\n```php\n\u003c?php\n\nrequire_once __DIR__ . '/vendor/autoload.php';\n\n$r = new Lemmon\\Router\\Router;\n$r-\u003ematch('hello-world', function() {\n    echo 'Hello World!';\n});\n$r-\u003edispatch();\n```\n\n*Example 1* - Respond to all requests\n\n```php\n$r-\u003ematch(function() {\n    # matches everything\n});\n```\n\n*Example 2* - Match parameters\n\n```php\n$r-\u003ematch('{controller}/{action}', function($r) {\n\t# $r-\u003econtroller;\n\t# $r-\u003eaction;\n});\n```\n\n*Example 3* - RESTful routing\n\n```php\n$r-\u003ematch(['GET', 'PUT'], '{controller}(/(?\u003ctrail\u003e{action:read|write}/{id:num:1,3=1})!)', ['controller' =\u003e '\\w+'], function($r) {\n    # matches only GET and PUT requests\n    # matches either 'controller' or 'controller/action/id' when route conditions are met\n    # controller can be any word\n    # action is either read or write\n    # id must be numeric of length 1 to 3, default is 1\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemmon%2Frouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemmon%2Frouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemmon%2Frouter/lists"}