{"id":36977142,"url":"https://github.com/danielsdeboer/runnable","last_synced_at":"2026-01-13T22:46:05.961Z","repository":{"id":62489894,"uuid":"114781847","full_name":"danielsdeboer/runnable","owner":"danielsdeboer","description":"Static constructor and handler trait with interface","archived":true,"fork":false,"pushed_at":"2017-12-19T16:01:20.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-06T05:42:54.386Z","etag":null,"topics":["handler","php","php7","static-constructor","utility"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"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/danielsdeboer.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-19T15:33:01.000Z","updated_at":"2024-04-02T12:24:10.000Z","dependencies_parsed_at":"2022-11-02T11:03:10.913Z","dependency_job_id":null,"html_url":"https://github.com/danielsdeboer/runnable","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/danielsdeboer/runnable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsdeboer%2Frunnable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsdeboer%2Frunnable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsdeboer%2Frunnable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsdeboer%2Frunnable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielsdeboer","download_url":"https://codeload.github.com/danielsdeboer/runnable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsdeboer%2Frunnable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"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":["handler","php","php7","static-constructor","utility"],"created_at":"2026-01-13T22:46:05.901Z","updated_at":"2026-01-13T22:46:05.953Z","avatar_url":"https://github.com/danielsdeboer.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/danielsdeboer/runnable.svg?branch=master)](https://travis-ci.org/danielsdeboer/runnable)\n[![Latest Stable Version](https://poser.pugx.org/aviator/runnable/v/stable)](https://packagist.org/packages/aviator/runnable).[![License](https://poser.pugx.org/aviator/runnable/license)](https://packagist.org/packages/aviator/runnable)\n\n## Overview\n\nThis package provides a static constructor and handler interface, and a trait that implements the interface.\n\n### Installation\n\nVia Composer:\n\n```\ncomposer require aviator/runnable\n```\n\n### Testing\n\nVia Composer:\n\n```\ncomposer test\n```\n\n### Usage\n\nUse the trait:\n\n```php\nclass Something\n{\n    use RunnableTrait;\n}\n```\n\nThen the class can be instantiated and handled using `Class::run()()`. The static `run` method returns a closure which accepts any arguments the method (by default `get()`) requires:\n\n```php\n$closure = Something::run($arg1);\n$result = $closure($arg2); \n\n// Or just:\n\n$result = Something::run($arg1)($arg2);\n```\n\nThe trait also pulls in `Aviator\\Makeable`, so you get the static constructor `make()` out of the box.\n\nThe interface is optional, though it can be useful in composite interfaces to specify that a static constructor should be present:\n\n```php\ninterface SomeInterface extends Runnable, SomeOtherInterface\n{\n    /* etc */\n}\n```\n\nBy default the trait will call `get()`, but this can be overridden:\n\n```php\nclass Something\n{\n    use RunnableTrait;\n    \n    protected static $method = 'handle';\n    \n    public function handle ($arg)\n    {\n        /* etc */\n    }\n}\n\n$result = Something::run()('arg');\n\n// Calls the handle() method.\n```\n\nThe magic of late static binding means you can override the default method on classes extending abstract classes and classes extending classes, etc.\n\n## Other\n\n### License\n\nThis package is licensed with the [MIT License (MIT)](LICENSE).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsdeboer%2Frunnable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielsdeboer%2Frunnable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsdeboer%2Frunnable/lists"}