{"id":33991365,"url":"https://github.com/maximaster/atoa","last_synced_at":"2026-05-29T08:01:49.885Z","repository":{"id":255441922,"uuid":"851680921","full_name":"maximaster/atoa","owner":"maximaster","description":"Convert a value to another value using your own callables.","archived":false,"fork":false,"pushed_at":"2024-09-03T14:31:34.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-14T18:53:23.921Z","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/maximaster.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-03T14:31:15.000Z","updated_at":"2024-09-03T14:31:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"9cfbc468-b0f7-4ab5-a6a6-9ee9b9e4d15b","html_url":"https://github.com/maximaster/atoa","commit_stats":null,"previous_names":["maximaster/atoa"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/maximaster/atoa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximaster%2Fatoa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximaster%2Fatoa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximaster%2Fatoa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximaster%2Fatoa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maximaster","download_url":"https://codeload.github.com/maximaster/atoa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximaster%2Fatoa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33642318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"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":"2025-12-13T06:46:08.787Z","updated_at":"2026-05-29T08:01:49.880Z","avatar_url":"https://github.com/maximaster.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# maximaster/atoa\n\nConvert a value to another value using your own callables.\n\n```bash\ncomposer require maximaster/atoa\n```\n\n## Example\n\n```php\nnamespace Maximaster\\Atoa;\n\nuse Maximaster\\Atoa\\Contract\\Atoa;\nuse Maximaster\\Atoa\\Converter;\n\nclass A { public function __construct(public string $value) {} }\nclass B { public function __construct(public string $value) {} }\n\n// Implement converters for all needed cases.\n// Make sure that callable has both input and return types described.\n$converter = new Converter([\n    static fn (A $a): B =\u003e new B($a-\u003evalue),\n    static fn (B $b): A =\u003e new A($b-\u003evalue),\n    static fn (string $c): int =\u003e intval($c),\n]);\n\n// Use Atoa interface instead of implementation in your services.\n(static function (Atoa $atoa): void {\n    // Ask converter to get desired type and pass any other type.\n    // If the converter does know how to convert this object to desired type, it\n    // would do it.\n    $a = $converter-\u003econvertTo(A::class, new B('hello')); // A('hello')\n    $b = $converter-\u003econvertTo(B::class, new A('hello')); // B('hello')\n    $c = $converter-\u003econvertTo('int', '42'); // 42\n})($converter);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximaster%2Fatoa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaximaster%2Fatoa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximaster%2Fatoa/lists"}