{"id":15692833,"url":"https://github.com/sof3/static-overloads","last_synced_at":"2025-03-20T09:50:44.778Z","repository":{"id":57054810,"uuid":"115813706","full_name":"SOF3/static-overloads","owner":"SOF3","description":"Use parameter-varying method overloads in PHP","archived":false,"fork":false,"pushed_at":"2017-12-31T12:47:39.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T10:41:17.385Z","etag":null,"topics":["method-overloading","overload"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/sof3/static-overloads","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SOF3.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":"2017-12-30T18:02:05.000Z","updated_at":"2019-08-21T12:13:48.000Z","dependencies_parsed_at":"2022-08-24T06:00:58.072Z","dependency_job_id":null,"html_url":"https://github.com/SOF3/static-overloads","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOF3%2Fstatic-overloads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOF3%2Fstatic-overloads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOF3%2Fstatic-overloads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOF3%2Fstatic-overloads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SOF3","download_url":"https://codeload.github.com/SOF3/static-overloads/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244591502,"owners_count":20477708,"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":["method-overloading","overload"],"created_at":"2024-10-03T18:40:26.486Z","updated_at":"2025-03-20T09:50:44.745Z","avatar_url":"https://github.com/SOF3.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# static-overloads\nUse parameter-varying method overloads in PHP\n\nPass an array of functions with different signatures into the `Overload` constructor. Invoke the `Overload` object directly with an array of the parameters you got, and the library will determine the correct implementation to use based on the parameter types.\n\nExample:\n\n```php\nfunction my_func(...$args){\n    // We are storing the Overload object as a static-scope variable.\n    // This caches the analyzed implementation signatures to improve runtime performance\n    // if the function is called frequently within the same runtime.\n    static $overload = null; // due to PHP language limitations, $overload cannot be initialized inline.\n    $overload = $overload ?? new Overload([\n        function(string $a){\n            implementation1($a);\n        },\n        function(int $a){\n            implementation2($a);\n        }\n    ]);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsof3%2Fstatic-overloads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsof3%2Fstatic-overloads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsof3%2Fstatic-overloads/lists"}