{"id":22379417,"url":"https://github.com/neighborhoods/dependencyinjectioncontainerbuildercomponent","last_synced_at":"2025-10-20T01:43:15.951Z","repository":{"id":48973564,"uuid":"285888522","full_name":"neighborhoods/DependencyInjectionContainerBuilderComponent","owner":"neighborhoods","description":"A dependency injection container builder based on Symfony.","archived":false,"fork":false,"pushed_at":"2021-07-02T19:43:10.000Z","size":54,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-17T09:34:15.724Z","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/neighborhoods.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":"CODEOWNERS","security":null,"support":null}},"created_at":"2020-08-07T17:46:06.000Z","updated_at":"2021-07-02T19:42:36.000Z","dependencies_parsed_at":"2022-08-30T08:10:23.763Z","dependency_job_id":null,"html_url":"https://github.com/neighborhoods/DependencyInjectionContainerBuilderComponent","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neighborhoods%2FDependencyInjectionContainerBuilderComponent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neighborhoods%2FDependencyInjectionContainerBuilderComponent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neighborhoods%2FDependencyInjectionContainerBuilderComponent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neighborhoods%2FDependencyInjectionContainerBuilderComponent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neighborhoods","download_url":"https://codeload.github.com/neighborhoods/DependencyInjectionContainerBuilderComponent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245718778,"owners_count":20661161,"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-12-04T23:09:52.426Z","updated_at":"2025-10-20T01:43:10.916Z","avatar_url":"https://github.com/neighborhoods.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neighborhoods Container Builder\n\n## Basic example of usage\n\n```php\n$container = (new \\Neighborhoods\\DependencyInjectionContainerBuilderComponent\\TinyContainerBuilder())\n    -\u003esetContainerBuilder(new \\Symfony\\Component\\DependencyInjection\\ContainerBuilder())\n    -\u003esetRootPath(dirname(__DIR__))\n    -\u003eaddSourcePath('src/ComponentName')\n    -\u003eaddSourcePath('src/Prefab5')\n    -\u003eaddSourcePath('fab/ComponentName')\n    -\u003emakePublic(SomeRepository::class)\n    -\u003eaddCompilerPass(new \\Symfony\\Component\\DependencyInjection\\Compiler\\AnalyzeServiceReferencesPass())\n    -\u003eaddCompilerPass(new \\Symfony\\Component\\DependencyInjection\\Compiler\\InlineServiceDefinitionsPass())\n    -\u003ebuild();\n```\n\n* `setContainerBuilder`: the setter takes instance of `\\Symfony\\Component\\DependencyInjection\\ContainerBuilder`.\n    It's possible to supply non-empty container.\n* `setRootPath`: takes the path to the project root (where `src` and `fab` folders are located)\n* `addSourcePath`: takes the path to a folder containing definitions for Container Builder\n* `makePublic`: takes the service URI (usually class name) and makes it public\n* `makeAllPublic`: makes all services public\n* `addCompilerPass`: takes instance of `\\Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface` and\n    supplies it to the `addCompilerPass` method of ContainerBuilder.\n* `build`: creates and returns an instance of `\\Psr\\Container\\ContainerInterface`\n\n## With Cache\n\nIf container needs to be cached, a `\\Neighborhoods\\DependencyInjectionContainerBuilderComponent\\CacheHandlerInterface`\ncan be supplied through `setCacheHandler`.\n\n```php\n$cacheHandler = (new \\Neighborhoods\\DependencyInjectionContainerBuilderComponent\\SymfonyConfigCacheHandler\\Builder())\n    -\u003esetName('ContainerName')\n    -\u003esetCacheDirPath(dirname(__DIR__) . '/data/cache')\n    -\u003esetDebug(true)\n    -\u003ebuild();\n$container = (new \\Neighborhoods\\DependencyInjectionContainerBuilderComponent\\TinyContainerBuilder())\n    // ... \n    -\u003esetCacheHandler($cacheHandler)\n    -\u003ebuild();\n```\n\n* `setName`: takes the name of the cached Container class\n* `setCacheDirPath`: takes the path to directory where container file is going to be stored (absolute)\n* `setDebug`: takes a boolean flag whether \"debug mode\" should be on or off. When debug mode is on, cache is going\n    to \"listen\" for the changes in source configuration files. If any change is introduced, cache would be considered\n    invalid, and a new one will be generated and stored. It's advised to use `true` only for development.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneighborhoods%2Fdependencyinjectioncontainerbuildercomponent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneighborhoods%2Fdependencyinjectioncontainerbuildercomponent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneighborhoods%2Fdependencyinjectioncontainerbuildercomponent/lists"}