{"id":18594459,"url":"https://github.com/bauhausphp/service-resolver","last_synced_at":"2025-08-12T00:08:00.339Z","repository":{"id":41052265,"uuid":"342366576","full_name":"bauhausphp/service-resolver","owner":"bauhausphp","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-22T22:40:39.000Z","size":69,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-16T11:37:55.750Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"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/bauhausphp.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":"2021-02-25T20:11:00.000Z","updated_at":"2022-09-10T16:08:04.000Z","dependencies_parsed_at":"2023-02-12T18:35:13.122Z","dependency_job_id":null,"html_url":"https://github.com/bauhausphp/service-resolver","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bauhausphp/service-resolver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauhausphp%2Fservice-resolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauhausphp%2Fservice-resolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauhausphp%2Fservice-resolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauhausphp%2Fservice-resolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bauhausphp","download_url":"https://codeload.github.com/bauhausphp/service-resolver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bauhausphp%2Fservice-resolver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269976794,"owners_count":24506467,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-07T01:15:38.755Z","updated_at":"2025-08-12T00:08:00.298Z","avatar_url":"https://github.com/bauhausphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status]](https://github.com/bauhausphp/service-resolver/actions)\n[![Coverage]](https://coveralls.io/github/bauhausphp/service-resolver?branch=main)\n\n[![Stable Version]](https://packagist.org/packages/bauhaus/service-resolver)\n[![Downloads]](https://packagist.org/packages/bauhaus/service-resolver)\n[![PHP Version]](composer.json)\n[![License]](LICENSE)\n\n[Build Status]: https://img.shields.io/github/workflow/status/bauhausphp/service-resolver/CI?style=flat-square\n[Coverage]: https://img.shields.io/coveralls/github/bauhausphp/service-resolver?style=flat-square\n[Stable Version]: https://img.shields.io/packagist/v/bauhaus/service-resolver?style=flat-square\n[Downloads]: https://img.shields.io/packagist/dt/bauhaus/service-resolver?style=flat-square\n[PHP Version]: https://img.shields.io/packagist/php-v/bauhaus/service-resolver?style=flat-square\n[License]: https://img.shields.io/github/license/bauhausphp/service-resolver?style=flat-square\n\n\u003e **Warning!** This package won't worry about backward compatibily for `v0.*`.\n\n# Service Locator\n\nYet another service resolver (aka service container) implementation following\n[PSR-11 Container interface](https://www.php-fig.org/psr/psr-11/).\n\n## Installation\n\n```sh\n$ composer require bauhaus/service-resolver\n```\n\n## Using it\n\n```php\n\u003c?php\n\nuse Bauhaus\\ServiceResolverSettings;\n\n$psrContainer = ServiceResolverSettings::new()\n    -\u003ewithDefintionFiles(\n        'path/file-1.php',\n        'path/file-2.php',\n    )\n    -\u003ewithServices([\n        'service-id-1' =\u003e fn () =\u003e YourService(), // lazy loaded\n        'service-id-2' =\u003e new YourService(),\n    ])\n    -\u003ewithDiscoverableNamespaces(\n        'App\\\\Namespace1',\n        'App\\\\Namespace2',\n    )\n    -\u003ebuild();\n\n$psrContainer-\u003ehas($serviceId);\n$psrContainer-\u003eget($serviceId);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbauhausphp%2Fservice-resolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbauhausphp%2Fservice-resolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbauhausphp%2Fservice-resolver/lists"}