{"id":36318371,"url":"https://github.com/esase/tiny-service-manager","last_synced_at":"2026-01-14T00:34:47.658Z","repository":{"id":56979128,"uuid":"285483066","full_name":"esase/tiny-service-manager","owner":"esase","description":"The Service Manager is a service/object locator, tasked with retrieving other objects.","archived":false,"fork":false,"pushed_at":"2020-11-07T09:11:52.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-11T14:55:57.675Z","etag":null,"topics":["container","di","esase","framework","lightweight","microservices","psr","servicelocator","servicemanager","tinyframework"],"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/esase.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":"2020-08-06T05:35:12.000Z","updated_at":"2022-02-17T21:40:06.000Z","dependencies_parsed_at":"2022-08-21T08:10:58.016Z","dependency_job_id":null,"html_url":"https://github.com/esase/tiny-service-manager","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/esase/tiny-service-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esase%2Ftiny-service-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esase%2Ftiny-service-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esase%2Ftiny-service-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esase%2Ftiny-service-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esase","download_url":"https://codeload.github.com/esase/tiny-service-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esase%2Ftiny-service-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["container","di","esase","framework","lightweight","microservices","psr","servicelocator","servicemanager","tinyframework"],"created_at":"2026-01-11T11:07:51.184Z","updated_at":"2026-01-14T00:34:47.642Z","avatar_url":"https://github.com/esase.png","language":"PHP","readme":"# tiny-service-manager\n\n[![Build Status](https://travis-ci.com/esase/tiny-service-manager.svg?branch=master)](https://travis-ci.com/github/esase/tiny-service-manager/builds)\n[![Coverage Status](https://coveralls.io/repos/github/esase/tiny-service-manager/badge.svg?branch=master)](https://coveralls.io/github/esase/tiny-service-manager?branch=master)\n\n**Tiny/Service Manager** - it's a very simple realization of [DI](https://en.wikipedia.org/wiki/Dependency_injection) (dependency injection) \ncontainer with a clean and understandable Api. \n(There are no any extra dependencies and it's very small).\n\n`DI containers` are essential part of any modern `framework` or `CMS`. \nDifferently speaking it's the one of the most important part in web applications,\nwhich stores and produces any kind of services for you (`controllers`, `services`, `utilities`, etc).\n\nFurthermore it follows to  a one of the [SOLID](https://en.wikipedia.org/wiki/SOLID). principle (dependency injection or dependency inversion).\nWhich stands for - you should not create objects directly in other objects, because of some \ndifficulties in unit testing and maintaining  of embedded classes. \nLets check a look a couple of examples:\n\n**a wrong way:**\n\n```php\n\n\u003c?php\n\nclass A {\n    private B $embedded;\n\n    public function __construct() {\n        // Issues:\n        // 1. we cannot test it because we cannot mimic it\n        // 2. If we decide to use another implementation we will have to find and replace all its references\n        $this-\u003eembedded = new B();\n    }\n}\n\n```\n\n**the best way** -  is to inject any dependencies in `constructor` or `setters` (if dependencies are optional).\n\n```php\n\n\u003c?php\n\nclass A {\n    private B $embedded;\n\n    public function __construct(B $embedded) {\n        $this-\u003eembedded = $embedded;\n    }\n}\n\n```\n\n**service manager** in action\n\n```php\n    use Tiny\\ServiceManager\\ServiceManager;\n\n    // The Service Manager is a service/object locator, tasked with retrieving other objects.\n    $serviceManager = new ServiceManager([\n        B::class =\u003e function(ServiceManager $serviceManager) {\n            return new B();\n        },\n        A::class =\u003e function(ServiceManager $serviceManager) {\n            return new A($serviceManager-\u003eget(B::class));\n        }\n    ]);\n\n    // now whenever we get an instance of \"A\" class we get it with injected instance of \"B\" class\n    $serviceA = $serviceManager-\u003eget(A::class);\n\n```\n\nnow we can easily test the `A` class injecting a mocked version of the `B`\n\n```php\n$serviceA = new A(new MockedB());\n```\n\nFor more details please check a look the documentation link below.\n\n\n## Installation\n\nRun the following to install this library:\n\n```bash\n$ composer require esase/tiny-service-manager\n```\n\n## Documentation\n\nhttps://tiny-docs.readthedocs.io/en/latest/tiny-service-manager/docs/index.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesase%2Ftiny-service-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesase%2Ftiny-service-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesase%2Ftiny-service-manager/lists"}