{"id":22656872,"url":"https://github.com/libreworks/caridea-dispatch","last_synced_at":"2025-07-08T06:06:53.428Z","repository":{"id":62499623,"uuid":"121072587","full_name":"libreworks/caridea-dispatch","owner":"libreworks","description":":fried_shrimp: Caridea is a miniscule PHP application library. This is a shrimpy middleware dispatcher library.","archived":false,"fork":false,"pushed_at":"2018-02-11T17:56:27.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T08:11:21.494Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libreworks.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":"2018-02-11T01:49:40.000Z","updated_at":"2022-04-18T18:48:10.000Z","dependencies_parsed_at":"2022-11-02T09:46:02.383Z","dependency_job_id":null,"html_url":"https://github.com/libreworks/caridea-dispatch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/libreworks/caridea-dispatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-dispatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-dispatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-dispatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-dispatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libreworks","download_url":"https://codeload.github.com/libreworks/caridea-dispatch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fcaridea-dispatch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264207121,"owners_count":23572734,"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-09T10:16:46.004Z","updated_at":"2025-07-08T06:06:53.408Z","avatar_url":"https://github.com/libreworks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# caridea-dispatch\nCaridea is a miniscule PHP application library. This shrimpy fellow is what you'd use when you just want some helping hands and not a full-blown framework.\n\n![](http://libreworks.com/caridea-100.png)\n\nThis is its [PSR-7](http://www.php-fig.org/psr/psr-7/) and [PSR-15](http://www.php-fig.org/psr/psr-15/) compliant request handler, with a few middleware implementations.\n\n[![Packagist](https://img.shields.io/packagist/v/caridea/dispatch.svg)](https://packagist.org/packages/caridea/dispatch)\n[![Build Status](https://travis-ci.org/libreworks/caridea-dispatch.svg)](https://travis-ci.org/libreworks/caridea-dispatch)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/libreworks/caridea-dispatch/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/libreworks/caridea-dispatch/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/libreworks/caridea-dispatch/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/libreworks/caridea-dispatch/?branch=master)\n[![Documentation Status](http://readthedocs.org/projects/caridea-dispatch/badge/?version=latest)](http://caridea-dispatch.readthedocs.io/en/latest/?badge=latest)\n\n## Installation\n\nYou can install this library using Composer:\n\n```console\n$ composer require caridea/dispatch\n```\n\n* The master branch (version 3.x) of this project requires PHP 7.1 and depends on `psr/http-message`, `psr/http-server-handler`, and `psr/http-server-middleware`.\n\n## Compliance\n\nReleases of this library will conform to [Semantic Versioning](http://semver.org).\n\nOur code is intended to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), and [PSR-4](http://www.php-fig.org/psr/psr-4/). If you find any issues related to standards compliance, please send a pull request!\n\n## Documentation\n\n* Head over to [Read the Docs](http://caridea-dispatch.readthedocs.io/en/latest/)\n\n## Examples\n\nJust a few quick examples.\n\n### Runner\n\nYou can use the `Runner` to give it some middleware and let it handle your request.\n\n```php\n$request = new \\Zend\\Diactoros\\ServerRequest();\n// I generally use zend-diactoros, but feel free to use whatever PSR-7 library you use\n\n$middleware = [\n    // your custom \\Psr\\Http\\Server\\MiddlewareInterface objects\n];\n$runner = new \\Caridea\\Dispatch\\Runner($middleware);\n$response = $runner-\u003ehandle($request);\n```\n\nYour final middleware should create and return a PSR-7 `ResponseInterface`. You can also provide one to the `Runner` constructor and it handles it automatically.\n\n```php\n$response = new \\Zend\\Diactoros\\Response();\n$runner = new \\Caridea\\Dispatch\\Runner($middleware, $response);\n$response = $runner-\u003ehandle($request);\n```\n\nA `Runner` is immutable. You can use it more than once.\n\n```php\n$runner = new \\Caridea\\Dispatch\\Runner($middleware);\n$response1 = $runner-\u003ehandle($request);\n$response2 = $runner-\u003ehandle($request);\n```\n\n### Priority Runner\n\nWe included an extension of the `MiddlewareInterface`: `Caridea\\Dispatch\\Middleware\\Prioritized`. Using the `Caridea\\Dispatch\\PriorityRunner`, you can provide middleware out of order, and they get invoked in order of priority.\n\n```php\n$middleware = [\n    // your custom \\Psr\\Http\\Server\\MiddlewareInterface objects.\n    // Any that implement Prioritized will get run in priority order,\n    // Any others get run last, in insert order.\n];\n$runner = new \\Caridea\\Dispatch\\PriorityRunner($middleware);\n```\n\nYou can also use the `Caridea\\Dispatch\\Middleware\\PriorityDelegate` class to assign priority to an existing middleware implementation.\n\n```php\n$middleware = new \\Caridea\\Dispatch\\Middleware\\PriorityDelegate($middleware, 123456);\n```\n\n### Middleware\n\nMiddleware implementations we include.\n\n#### Reporter\n\nUse the `Caridea\\Dispatch\\Middleware\\Reporter` to capture `Throwable`s, log them, and re-throw the exception. PSR-3 required.\n\n#### Prototype\n\nA simple middleware that returns a `ResponseInterface` you provide.\n\n## See Also\n\n* [This blog post](https://mwop.net/blog/2018-01-23-psr-15.html) from Matthew Weier O'Phinney about why PSR-15 ditched the old pattern of \"double pass\" middleware with anonymous functions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibreworks%2Fcaridea-dispatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibreworks%2Fcaridea-dispatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibreworks%2Fcaridea-dispatch/lists"}