{"id":18929742,"url":"https://github.com/thecodingmachine/factory-to-definition","last_synced_at":"2025-07-09T14:05:23.448Z","repository":{"id":66284949,"uuid":"55508442","full_name":"thecodingmachine/factory-to-definition","owner":"thecodingmachine","description":"[EXPERIMENTAL] This package tries to convert (if possible) factories of service providers into definition-interop compatible definitions.","archived":false,"fork":false,"pushed_at":"2016-04-05T15:24:54.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"1.0","last_synced_at":"2025-06-30T03:09:37.284Z","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":null,"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":null,"code_of_conduct":null,"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":"2016-04-05T13:05:16.000Z","updated_at":"2016-04-05T13:06:18.000Z","dependencies_parsed_at":"2023-07-12T17:17:11.583Z","dependency_job_id":null,"html_url":"https://github.com/thecodingmachine/factory-to-definition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thecodingmachine/factory-to-definition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Ffactory-to-definition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Ffactory-to-definition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Ffactory-to-definition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Ffactory-to-definition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodingmachine","download_url":"https://codeload.github.com/thecodingmachine/factory-to-definition/tar.gz/refs/heads/1.0","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Ffactory-to-definition/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264473862,"owners_count":23613958,"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:34:50.930Z","updated_at":"2025-07-09T14:05:23.406Z","avatar_url":"https://github.com/thecodingmachine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Warning, experimental project!\n------------------------------\n\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thecodingmachine/factory-to-definition/badges/quality-score.png?b=1.0)](https://scrutinizer-ci.com/g/thecodingmachine/factory-to-definition/?branch=1.0)\n[![Build Status](https://travis-ci.org/thecodingmachine/factory-to-definition.svg?branch=1.0)](https://travis-ci.org/thecodingmachine/factory-to-definition)\n[![Coverage Status](https://coveralls.io/repos/thecodingmachine/factory-to-definition/badge.svg?branch=1.0\u0026service=github)](https://coveralls.io/github/thecodingmachine/factory-to-definition?branch=1.0)\n\n\nWhat is it?\n===========\n\nThis project is a crazy attempt to create a bridge between [container-interop's service providers](http://github.com/container-interop/service-provider)\nand [container-interop's definition interfaces](http://github.com/container-interop/definition-interop/).\n\nBut why?\n========\n\nIt should be pretty easy to take container definitions and compile them into a service provider class (this is a \nstandard compilation pass). What I'm trying to do here is the opposite. Take a service provider (i.e. a set of \nfactory methods in pure PHP code), and cast those into service definitions.\n\nLet's be clear, this is not obviously not always possible. Still, I'm trying to do it for very simple use cases.\n\nWhy?\n\n- Because it's fun\n- Because it might bring very slight improvements to performances for compiled container (they can optimize container definition, but they cannot optimize factory methods).\n\nWhat can it do so far?\n======================\n\nNot much, really!\n\nIt can:\n\n- detect aliases and transform those into `Interop\\Container\\Definition\\ReferenceDefinitionInterface` :\n\n  ```php\n  public static function alias(ContainerInterface $container)\n  {\n      return $container-\u003eget('foo');\n  }\n  ```\n  \n  will map to a `ReferenceDefinition` object pointing to the `foo` container entry.\n- detect static values / parameters and transform those into `Interop\\Container\\Definition\\ParameterDefinitionInterface` :\n\n  ```php\n  public static function scalar()\n  {\n      return 'my_value';\n  }\n  ```\n  \n  will map to a `ParameterDefinition` object containing `my_value` as a value. Note: as per the definition-interop unit test suite, a `ParameterDefinition` can be anything from a static string / number to an array of scalar values. Arrays also accept references.\n  \nAnd that's it for now!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Ffactory-to-definition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodingmachine%2Ffactory-to-definition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Ffactory-to-definition/lists"}