{"id":18929537,"url":"https://github.com/thecodingmachine/service-provider-bridge-bundle","last_synced_at":"2025-04-15T15:31:07.249Z","repository":{"id":57067902,"uuid":"51650638","full_name":"thecodingmachine/service-provider-bridge-bundle","owner":"thecodingmachine","description":"This Symfony Bundle enables Symfony applications to use service providers as defined in container-interop/service-provider","archived":false,"fork":false,"pushed_at":"2020-07-17T14:16:24.000Z","size":45,"stargazers_count":4,"open_issues_count":1,"forks_count":5,"subscribers_count":5,"default_branch":"1.0","last_synced_at":"2025-04-11T18:59:50.883Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodingmachine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-13T15:06:06.000Z","updated_at":"2020-04-14T07:33:36.000Z","dependencies_parsed_at":"2022-08-24T10:20:16.010Z","dependency_job_id":null,"html_url":"https://github.com/thecodingmachine/service-provider-bridge-bundle","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fservice-provider-bridge-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fservice-provider-bridge-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fservice-provider-bridge-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fservice-provider-bridge-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodingmachine","download_url":"https://codeload.github.com/thecodingmachine/service-provider-bridge-bundle/tar.gz/refs/heads/1.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249097871,"owners_count":21212364,"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-11-08T11:33:26.517Z","updated_at":"2025-04-15T15:31:06.949Z","avatar_url":"https://github.com/thecodingmachine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thecodingmachine/service-provider-bridge-bundle/badges/quality-score.png?b=1.0)](https://scrutinizer-ci.com/g/thecodingmachine/service-provider-bridge-bundle/?branch=1.0)\n[![Build Status](https://travis-ci.org/thecodingmachine/service-provider-bridge-bundle.svg?branch=1.0)](https://travis-ci.org/thecodingmachine/service-provider-bridge-bundle)\n[![Coverage Status](https://coveralls.io/repos/thecodingmachine/service-provider-bridge-bundle/badge.svg?branch=1.0\u0026service=github)](https://coveralls.io/github/thecodingmachine/service-provider-bridge-bundle?branch=1.0)\n\n\n# container-interop/service-provider bridge bundle\n\nImport `service-provider` as defined in `container-interop` into a Symfony application.\n\n## Usage\n\n### Installation\n\nAdd `TheCodingMachine\\Interop\\ServiceProviderBridgeBundle\\InteropServiceProviderBridgeBundle` in your kernel (the `app/AppKernel.php` file).\n\n**AppKernel.php**\n```php\n    public function registerBundles()\n    {\n        $bundles = [\n            ...\n            new \\TheCodingMachine\\Interop\\ServiceProviderBridgeBundle\\InteropServiceProviderBridgeBundle()\n        ];\n        ...\n    }\n```\n\n\n### Usage using thecodingmachine/discovery\n\nThe bridge bundle will use thecodingmachine/discvoery to automatically discover the service providers of your project. If the service provider you are loading publishes itself\non Discovery, then you are done. The services declared in the service provider are available in the Symfony container!\n\n### Usage using manual declaration\n \nIf the service provider you are using does not publishes itself using thecodingmachine/discovery, you will have to declare it manually in the constructor of the bundle.\n\n**AppKernel.php**\n```php\nclass AppKernel extends Kernel\n{\n    public function registerBundles()\n    {\n        $bundles = [\n            ...\n            new \\TheCodingMachine\\Interop\\ServiceProviderBridgeBundle\\InteropServiceProviderBridgeBundle([\n                new MyServiceProvide1(),\n                new MyServiceProvide2()\n            ])\n        ];\n        ...\n    }\n}\n```\n\nAlternatively, you can also pass the service provider class name. This is interesting because the service-locator bundle will not instantiate the service provider unless it is needed for a service.\nYou can therefore improve performances of your application.\n\n**AppKernel.php**\n```php\n    public function registerBundles()\n    {\n        $bundles = [\n            ...\n            new \\Puli\\SymfonyBundle\\PuliBundle(),\n            new \\TheCodingMachine\\Interop\\ServiceProviderBridgeBundle\\InteropServiceProviderBridgeBundle([\n                MyServiceProvide1::class,\n                MyServiceProvide2::class\n            ])\n        ];\n        ...\n    }\n```\n\nFinally, if you need to pass parameters to the constructors of the service providers, you can do this by passing an array:\n\n**AppKernel.php**\n```php\n    public function registerBundles()\n    {\n        $bundles = [\n            ...\n            new \\Puli\\SymfonyBundle\\PuliBundle(),\n            new \\TheCodingMachine\\Interop\\ServiceProviderBridgeBundle\\InteropServiceProviderBridgeBundle([\n                [ MyServiceProvide1::class, [ \"param1\", \"param2\" ] ],\n                [ MyServiceProvide2::class, [ 42 ] ],\n            ])\n        ];\n        ...\n    }\n```\n\n## Disabling thecodingmachine/discovery\n\nYou can disable Discovery by passing `false` as the second argument of the bundle:\n\n**AppKernel.php**\n```php\n    public function registerBundles()\n    {\n        $bundles = [\n            ...\n            // false is passed as second argument. Puli discovery will be disabled.\n            new \\TheCodingMachine\\Interop\\ServiceProviderBridgeBundle\\InteropServiceProviderBridgeBundle([\n                ...\n            ], false)\n        ];\n        ...\n    }\n```\n\n## Default aliases\n\nBy default, this package provides a `CommonAliasesServiceProvider` that will create the following aliases:\n\n- `logger` =\u003e `Psr\\Log\\LoggerInterface`\n- `cache.app` =\u003e `Psr\\Cache\\CacheItemPoolInterface`\n- `twig` =\u003e `Twig_Environment`\n\nThis is useful because most service providers expect entries to be available by class/interface name.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fservice-provider-bridge-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodingmachine%2Fservice-provider-bridge-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fservice-provider-bridge-bundle/lists"}