{"id":22092117,"url":"https://github.com/krakphp/mw","last_synced_at":"2025-08-20T11:10:07.730Z","repository":{"id":57009030,"uuid":"61004214","full_name":"krakphp/mw","owner":"krakphp","description":"Framework Agnostic Middleware Library","archived":false,"fork":false,"pushed_at":"2017-04-30T19:49:03.000Z","size":302,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-19T09:13:55.658Z","etag":null,"topics":["decorators","middleware","pipeline"],"latest_commit_sha":null,"homepage":null,"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/krakphp.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":null,"support":null}},"created_at":"2016-06-13T03:25:53.000Z","updated_at":"2024-08-16T06:22:35.000Z","dependencies_parsed_at":"2022-08-21T13:10:13.517Z","dependency_job_id":null,"html_url":"https://github.com/krakphp/mw","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fmw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fmw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fmw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fmw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krakphp","download_url":"https://codeload.github.com/krakphp/mw/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227476144,"owners_count":17779417,"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":["decorators","middleware","pipeline"],"created_at":"2024-12-01T03:08:22.309Z","updated_at":"2024-12-01T03:08:23.212Z","avatar_url":"https://github.com/krakphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mw (Middleware)\n\n[![Author](http://img.shields.io/badge/author-@ragboyjr-blue.svg?style=flat-square)](https://twitter.com/ragboyjr)\n[![Source Code](http://img.shields.io/badge/source-krak/mw-blue.svg?style=flat-square)](https://github.com/krakphp/mw)\n[![Latest Version](https://img.shields.io/github/release/krakphp/mw.svg?style=flat-square)](https://github.com/krakphp/mw/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n[![Documentation Status](https://readthedocs.org/projects/mw/badge/?version=latest)](http://mw.readthedocs.io/en/latest/?badge=latest)\n[![Total Downloads](https://img.shields.io/packagist/dt/krak/mw.svg?style=flat-square)](https://packagist.org/packages/krak/mw)\n\nThe Mw library is a very flexible framework for converting middleware into handlers. Middleware offer a clean syntax for implementing the [Decorator Pattern](https://en.wikipedia.org/wiki/Decorator_pattern)\n\n```php\n\u003c?php\n\nuse Krak\\Mw;\n\n$handler = mw\\compose([\n    function($s, $next) {\n        return strtoupper($s);\n    },\n    function($s, $next) {\n        return 'x' . $next($s . 'x');\n    }\n]);\n\n$res = $handler('abc');\nassert($res == 'xABCX');\n```\n\n![](doc/_static/middleware.png)\n\n## Installation\n\nYou can install this as a composer package at `krak/mw`\n\n## Documentation\n\nView them at [http://mw.readthedocs.io/en/latest/](http://mw.readthedocs.io/en/latest/)\n\nOr build them:\n\n```bash\nmake doc\n```\n\n## Tests and Examples\n\nRun tests via:\n\n```bash\nmake test\n```\n\nThe Mw library uses [Peridot](http://peridot-php.github.io). These [tests](test/mw.spec.php) also provide good examples of how to use the library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fmw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrakphp%2Fmw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fmw/lists"}