{"id":22092100,"url":"https://github.com/krakphp/auto-args","last_synced_at":"2026-05-03T19:34:59.755Z","repository":{"id":57009021,"uuid":"78999300","full_name":"krakphp/auto-args","owner":"krakphp","description":"Auto Argument Resolver","archived":false,"fork":false,"pushed_at":"2017-03-25T02:35:29.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-28T08:35:36.852Z","etag":null,"topics":["argument-resolver","auto-wire","composer"],"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/krakphp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-01-15T05:08:00.000Z","updated_at":"2017-03-12T03:03:42.000Z","dependencies_parsed_at":"2022-08-21T13:10:12.699Z","dependency_job_id":null,"html_url":"https://github.com/krakphp/auto-args","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/krakphp/auto-args","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fauto-args","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fauto-args/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fauto-args/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fauto-args/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krakphp","download_url":"https://codeload.github.com/krakphp/auto-args/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fauto-args/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32582840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: 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":["argument-resolver","auto-wire","composer"],"created_at":"2024-12-01T03:08:19.814Z","updated_at":"2026-05-03T19:34:59.736Z","avatar_url":"https://github.com/krakphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto Args\n\nAuto Args provides a system for automatically resolving arguments for any callable. This can also be referred to as Auto wiring.\n\n## Installation\n\nInstall with composer at `krak/auto-args`.\n\n## Usage\n\n```php\n\u003c?php\n\nuse Krak\\AutoArgs;\n\n$args = new AutoArgs();\n\n$context = [\n    'vars' =\u003e ['a' =\u003e 1],\n    'objects' =\u003e [new SplStack()],\n];\n\n$func = function($a, SplDoublyLinkedList $stack, $b = 1) {\n    assert($a == 1 \u0026\u0026 $b === 1);\n};\n\n$args-\u003einvoke($func, $context);\n```\n\n### Container Integration\n\n```php\n\u003c?php\n\nuse Krak\\AutoArgs,\n    Krak\\Cargo,\n    Interop\\Container\\ContainerInterface;\n\n$args = new AutoArgs();\n$c = Cargo\\container();\n$c[SplStack::class] = function() {\n    return new SplStack();\n};\n\n$context = [\n    'container' =\u003e $c-\u003etoInterop()\n];\n\n$func = function(ContainerInterface $container, SplStack $stack) {\n\n};\n\n$args-\u003einvoke($func, $context);\n```\n\n## API\n\n### Class AutoArgs\n\n#### \\_\\_construct($resolve_arg = null)\n\nAccepts an argument resolver which will accept Argument metadata and context and return the proper argument for it. If none is supplied, the default stack is created and composed instead.\n\n#### mixed invoke(callable $callable, array $context)\n\nInvokes a callable and resolves the arguments from the argument resolver and given context.\n\n#### mixed construct($class_name, array $context)\n\nConstructs a an object from the class name and resolves the arguments for the constructor\n\n#### array resolveArguments(callable $callable, array $context)\n\nReturns the array of resolved arguments for the given callable. An exception will be thrown if no argument was able to be resolved.\n\n#### Krak\\\\Mw\\\\MwStack ::createStack()\n\nReturns a configured instance of an mw stack.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fauto-args","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrakphp%2Fauto-args","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fauto-args/lists"}