{"id":13395603,"url":"https://github.com/madewithlove/glue","last_synced_at":"2025-04-10T10:41:33.019Z","repository":{"id":62521595,"uuid":"46606033","full_name":"madewithlove/glue","owner":"madewithlove","description":"Glue is a package to quickly bootstrap packages-based applications","archived":false,"fork":false,"pushed_at":"2017-12-05T08:56:32.000Z","size":968,"stargazers_count":8,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2024-07-31T18:15:20.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://madewithlove.github.io/glue","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/madewithlove.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-21T07:39:22.000Z","updated_at":"2021-07-26T14:45:43.000Z","dependencies_parsed_at":"2022-11-02T14:00:40.591Z","dependency_job_id":null,"html_url":"https://github.com/madewithlove/glue","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madewithlove%2Fglue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madewithlove%2Fglue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madewithlove%2Fglue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madewithlove%2Fglue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madewithlove","download_url":"https://codeload.github.com/madewithlove/glue/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199326,"owners_count":21063654,"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-07-30T18:00:25.680Z","updated_at":"2025-04-10T10:41:32.998Z","avatar_url":"https://github.com/madewithlove.png","language":"PHP","funding_links":[],"categories":["Middleware dispatcher"],"sub_categories":[],"readme":"# Glue\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n[![Coverage Status][ico-scrutinizer]][link-scrutinizer]\n[![Quality Score][ico-code-quality]][link-code-quality]\n[![Total Downloads][ico-downloads]][link-downloads]\n\n![](http://i.imgur.com/3oO0UWd.png)\n\n## What's Glue?\nGlue is an adhesive substance used for sticking objects or materials together ( ͡° ͜ʖ ͡°)\n\n**Glue** is also an helper package made to quickly bootstrap packages-based applications.\nAt its core it's just a container and a quick PSR7 setup, on top of which are glued together service providers and middlewares.\n\nThis is _not_ a microframework (in the sense that it doesn't frame your work). If this is what you're looking for I recommend instead using [Silex], [Slim] or whatever you want.\nOn the contrary, Glue is as its name indicates just a bit of glue to tie existing packages and middlewares together. It doesn't assume much, it won't get in your way, it's just a way to tie stuff together.\n\n### What does it look like\nTo be concise, Glue turns a common setup such as the following (container + router + PSR7):\n\n```php\n\u003c?php\n// Create container\n$container = new Container();\n$container-\u003eaddServiceProvider(SomeProvider::class);\n$container-\u003eaddServiceProvider(AnotherProvider::class);\n\n// Create router and routes\n$router = new RouteCollection($container);\n$router-\u003eget('/', 'SomeController::index');\n\n// Create PSR7 middleware handler\n$relay = (new RelayBuilder())-\u003enewInstance([\n    SomeMiddleware::class,\n    function($request, $response, $next) use ($router) {\n        $next($request, $router-\u003edispatch($request, $response));\n    },\n]);\n\n// Create PSR7 stack\n$request = ServerRequestFactory::fromGlobals();\n$response = $relay(new Request, new Response());\n\n(new SapiEmitter())-\u003eemit($response);\n```\n\nInto this:\n\n```php\n$app = (new Glue())\n    -\u003esetServiceProviders([\n        new SomeServiceProvider(),\n        new AnotherServiceProvider(),\n        new LeagueRouteServiceProvider(),\n    ])\n    -\u003esetMiddlewares([\n        SomeMiddleware::class,\n        LeagueRouteMiddleware::class,\n    ]);\n\n// Decorates a router of your choice\n$app-\u003eget('/', 'SomeController::index');\n\n$app-\u003erun();\n```\n\nIn order to be truly flexible, Glue accepts any PSR11 compatible container, and register its services through the [service-provider] standard.\n\nAs you can see Glue serves two purposes: eliminating recurring boilerplate in binding packages together, and providing service providers for common packages such as `league/route`.\nIt is configurable and flexible, it won't get in your way, it's just here to help you not type the same things over and over again.\n\n### What's in the box\nGlue provides several service providers out of the box:\n- **Routing**\n    - Base routing system with `league/route`\n    - PSR7 stack with `zendframework/zend-diactoros`\n    - View engine with `twig/twig`\n    - Facultative base controller\n\n- **Business**\n    - Database handling with `illuminate/database`\n    - Migrations with `robmorgan/phinx`\n    - Command bus with `league/tactician`\n\n- **Development**\n    - Dotenv files with `vlucas/phpdotenv`\n    - Logs handling with `monolog/monolog`\n    - Debugbar with `maximebf/debugbar`\n    - Small CLI with `symfony/console`\n    - Filesystem with `league/flysystem`\n    - REPL with `psy/psysh`\n\nAny of these can be overidden or removed; this package doesn't enforce any structure or the use of any dependency in particular.\n\nWhy? Because I do a lot of very small web applications, for myself or public ones, and I was tired of going through the same routine for the hundreth time.\nThen I thought others might have the same use case and here we are.\n\n## Install\n\n```bash\n$ composer require madewithlove/glue\n```\n\n## Usage\nSee the [documentation] for more informations.\n\n## Changelog\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n```bash\n$ composer test\n```\n\n## Contributing\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.\n\n## Security\nIf you discover any security related issues, please email heroes@madewithlove.be instead of using the issue tracker.\n\n## Credits\n- [Maxime Fabre][link-author]\n- [All Contributors][link-contributors]\n\n## License\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[service-provider]: https://github.com/container-interop/service-provider\n[documentation]: http://madewithlove.github.io/glue\n[silex]: http://silex.sensiolabs.org\n[slim]: http://www.slimframework.com\n[ico-version]: https://img.shields.io/packagist/v/madewithlove/glue.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/madewithlove/glue/master.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/madewithlove/glue.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/madewithlove/glue.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/madewithlove/glue.svg?style=flat-square\n[link-packagist]: https://packagist.org/packages/madewithlove/glue\n[link-travis]: https://travis-ci.org/madewithlove/glue\n[link-scrutinizer]: https://scrutinizer-ci.com/g/madewithlove/glue/code-structure\n[link-code-quality]: https://scrutinizer-ci.com/g/madewithlove/glue\n[link-downloads]: https://packagist.org/packages/madewithlove/glue\n[link-author]: https://github.com/Anahkiasen\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadewithlove%2Fglue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadewithlove%2Fglue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadewithlove%2Fglue/lists"}