{"id":14983906,"url":"https://github.com/carthage-software/elissa-bundle","last_synced_at":"2025-04-10T19:43:12.745Z","repository":{"id":184011524,"uuid":"671125170","full_name":"carthage-software/elissa-bundle","owner":"carthage-software","description":"Elissa Bundle by Carthage brings out-of-the-box PSR-7 and PSR-15 support to your Symfony project.","archived":false,"fork":false,"pushed_at":"2023-07-26T19:20:32.000Z","size":30,"stargazers_count":22,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-24T17:21:23.940Z","etag":null,"topics":["psr-15","psr-7","symfony","symfony-bundle","zero-config"],"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/carthage-software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-26T15:38:29.000Z","updated_at":"2023-08-01T22:16:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2f4a60d-fa6c-4174-b1c9-3823ad79d465","html_url":"https://github.com/carthage-software/elissa-bundle","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"488e8273a56d6a8019590af73528978cd78c3a2f"},"previous_names":["carthage-software/elissa-bundle"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carthage-software%2Felissa-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carthage-software%2Felissa-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carthage-software%2Felissa-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carthage-software%2Felissa-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carthage-software","download_url":"https://codeload.github.com/carthage-software/elissa-bundle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281424,"owners_count":21077423,"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":["psr-15","psr-7","symfony","symfony-bundle","zero-config"],"created_at":"2024-09-24T14:08:09.384Z","updated_at":"2025-04-10T19:43:12.716Z","avatar_url":"https://github.com/carthage-software.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elissa Bundle - PSR-7 \u0026 PSR-15 Made Easy!\n\nElissa Bundle by Carthage brings out-of-the-box PSR-7 and PSR-15 support to your Symfony project.\n\nThe package allows developers to write PSR-15 handlers and middleware, which are auto-tagged and ready to use as controllers.\n\nIt also provides ready access to all PSR-7 factories, and enables seamless integration of middleware from third-party vendor packages.\n\n## Installation 🚀\n\nInstall the Elissa Bundle using Composer with the following command:\n\n```bash\ncomposer require carthage/elissa-bundle\n```\n\n## Enabling the Bundle 🎚\n\nTo enable the bundle in your Symfony project, add the following line in the `config/bundles.php` file:\n\n```php\nreturn [\n    //...\n    Carthage\\ElissaBundle\\ElissaBundle::class =\u003e ['all' =\u003e true],\n    //...\n];\n```\n\n## Usage 💼\n\n### PSR-7 Factories 🏭\n\nThe Elissa Bundle comes with autowired and pre-configured PSR-7 factories. You can conveniently create PSR-7 objects in your services without any extra configuration.\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Service;\n\nuse Psr\\Http\\Message\\StreamFactoryInterface;\nuse Psr\\Http\\Message\\ResponseFactoryInterface;\nuse Psr\\Http\\Message\\RequestFactoryInterface;\nuse Psr\\Http\\Message\\ServerRequestFactoryInterface;\nuse Psr\\Http\\Message\\UriFactoryInterface;\nuse Psr\\Http\\Message\\UploadedFileFactoryInterface;\n\nfinal class MyService\n{\n    public function __construct(\n        private StreamFactoryInterface $streamFactory,\n        private ResponseFactoryInterface $responseFactory,\n        private RequestFactoryInterface $requestFactory,\n        private ServerRequestFactoryInterface $serverRequestFactory,\n        private UriFactoryInterface $uriFactory,\n        private UploadedFileFactoryInterface $uploadedFileFactory,\n    ) {}\n}\n```\n\n### PSR-15 Handlers 🎛\n\nAfter installing and enabling the Elissa Bundle, writing PSR-15 handlers becomes a breeze. The handlers will automatically function as controllers in your Symfony project.\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Handler;\n\nuse Psr\\Http\\Message\\ResponseInterface;\nuse Psr\\Http\\Message\\ResponseFactoryInterface;\nuse Psr\\Http\\Message\\ServerRequestInterface;\nuse Psr\\Http\\Message\\StreamFactoryInterface;\nuse Psr\\Http\\Server\\RequestHandlerInterface;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n\nfinal class HomeHandler implements RequestHandlerInterface\n{\n    public function __construct(\n        private StreamFactoryInterface $streamFactory,\n        private ResponseFactoryInterface $responseFactory,\n    ) {}\n\n    #[Route('/', name: 'home')]\n    public function handle(ServerRequestInterface $request): ResponseInterface\n    {\n        $body = $this-\u003estreamFactory-\u003ecreateStream('Hello World!');\n\n        return $this-\u003eresponseFactory-\u003ecreateResponse(200)\n            -\u003ewithBody($body);\n    }\n}\n```\n\n### PSR-15 Middleware 🛠\n\nJust like handlers, you can write PSR-15 middleware, and they will automatically function.\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Middleware;\n\nuse Psr\\Http\\Message\\ResponseInterface;\nuse Psr\\Http\\Message\\ResponseFactoryInterface;\nuse Psr\\Http\\Message\\ServerRequestInterface;\nuse Psr\\Http\\Message\\StreamFactoryInterface;\nuse Psr\\Http\\Server\\MiddlewareInterface;\nuse Psr\\Http\\Server\\RequestHandlerInterface;\n\nfinal class MadeWithMiddleware implements MiddlewareInterface\n{\n    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface\n    {\n        $response = $handler-\u003ehandle($request);\n        \n        return $response-\u003ewithHeader('X-Made-With', 'Love');\n    }\n}\n```\n\n### Configurations ⚙\n\nThe Elissa Bundle is designed to minimize configuration, but if you need to register additional PSR-15 middlewares from third-party vendors, you can use the `elissa.middleware` service tag.\n\n```yaml\n# config/services.yaml\n\nservices:\n    Some\\External\\ServiceMiddleware:\n        tags:\n            - { name: elissa.middleware }\n```\n\n## Code Of Conduct 🤝\n\nOur community is guided by a Code of Conduct, and we expect all contributors to respect it. See the [`CODE_OF_CONDUCT`](./CODE_OF_CONDUCT.md) for more details.\n\n## Contributing 🎁\n\nThe Elissa Bundle thrives on contributions from the open-source community. We value every contribution, no matter how small.\n\n## License 📜\n\nThe Elissa Bundle is distributed under the MIT License. See [`LICENSE`](./LICENSE) for more information.\n\n---\n\nWe hope you enjoy using the Elissa Bundle! For any queries or suggestions, don't hesitate to open an issue or submit a pull request. Happy coding!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarthage-software%2Felissa-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarthage-software%2Felissa-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarthage-software%2Felissa-bundle/lists"}