{"id":24016303,"url":"https://github.com/decodelabs/clip","last_synced_at":"2025-04-15T14:07:27.004Z","repository":{"id":63616371,"uuid":"569226454","full_name":"decodelabs/clip","owner":"decodelabs","description":"CLI kernel integration for DecodeLabs Genesis","archived":false,"fork":false,"pushed_at":"2025-04-14T08:44:09.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-04-15T14:07:03.651Z","etag":null,"topics":["cli","kernel","php"],"latest_commit_sha":null,"homepage":"","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/decodelabs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-22T11:08:03.000Z","updated_at":"2025-04-14T08:44:12.000Z","dependencies_parsed_at":"2023-01-31T19:45:46.417Z","dependency_job_id":"424c3c89-01a9-4c2d-bd7a-38fada5e8a17","html_url":"https://github.com/decodelabs/clip","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"bf88de8b56d32c7ab7359dc2de4a1e0738189a1f"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decodelabs%2Fclip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decodelabs%2Fclip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decodelabs%2Fclip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decodelabs%2Fclip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/decodelabs","download_url":"https://codeload.github.com/decodelabs/clip/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249085437,"owners_count":21210267,"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":["cli","kernel","php"],"created_at":"2025-01-08T08:48:53.767Z","updated_at":"2025-04-15T14:07:26.998Z","avatar_url":"https://github.com/decodelabs.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clip\n\n[![PHP from Packagist](https://img.shields.io/packagist/php-v/decodelabs/clip?style=flat)](https://packagist.org/packages/decodelabs/clip)\n[![Latest Version](https://img.shields.io/packagist/v/decodelabs/clip.svg?style=flat)](https://packagist.org/packages/decodelabs/clip)\n[![Total Downloads](https://img.shields.io/packagist/dt/decodelabs/clip.svg?style=flat)](https://packagist.org/packages/decodelabs/clip)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/decodelabs/clip/integrate.yml?branch=develop)](https://github.com/decodelabs/clip/actions/workflows/integrate.yml)\n[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-44CC11.svg?longCache=true\u0026style=flat)](https://github.com/phpstan/phpstan)\n[![License](https://img.shields.io/packagist/l/decodelabs/clip?style=flat)](https://packagist.org/packages/decodelabs/clip)\n\n### CLI kernel integration for DecodeLabs Genesis\n\nClip provides a framework for building comprehensive CLI based applications on top of [Genesis](https://github.com/decodelabs/genesis).\n\n---\n\n## Installation\n\nInstall via Composer:\n\n```bash\ncomposer require decodelabs/clip\n```\n\n## Usage\n\nClip is a middleware library that provides an out-of-the-box setup for implementing a Genesis based CLI task runner. This means you don't really interact with it much directly, except when setting up the core of your task running infrastructure.\n\n### Create your Hub\n\nDefine your Genesis Hub by extending Clip's abstract implementation:\n\n```php\nnamespace MyThing;\n\nuse DecodeLabs\\Archetype;\nuse DecodeLabs\\Clip\\Controller as ControllerInterface;\nuse DecodeLabs\\Clip\\Hub as ClipHub;\nuse DecodeLabs\\Clip\\Task as TaskInterface;\nuse DecodeLabs\\Monarch;\nuse DecodeLabs\\Pandora\\Container;\nuse DecodeLabs\\Veneer;\nuse MyThing;\nuse MyThing\\Controller;\nuse MyThing\\Task;\n\nclass Hub extends ClipHub\n{\n    public function initializePlatform(): void\n    {\n        parent::initializePlatform();\n\n        // Load tasks from local namespace\n        Archetype::map(TaskInterface::class, Task::class);\n\n        // Create and load your controller (or use Generic)\n        if(Monarch::$container instanceof Container) {\n            $controller = new Controller();\n\n            Monarch::$container-\u003ebindShared(ControllerInterface::class, $controller);\n            Monarch::$container-\u003ebindShared(Controller::class, $controller);\n        }\n\n        // Bind your controller with Veneer\n        Veneer::register(Controller::class, MyThing::class);\n    }\n}\n```\n\nWith this hub in place, you can run tasks defined in your nominated namespace from the terminal via a bin defined in composer:\n\n```php\nnamespace MyThing;\n\nuse DecodeLabs\\Genesis\\Bootstrap\\Bin as BinBootstrap;\nuse MyThing\\Hub;\n\nrequire_once $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';\nnew BinBootstrap(Hub::class)-\u003erun();\n```\n\n```json\n{\n    \"bin\": [\n        \"bin/thing\"\n    ]\n}\n```\n\n\nDefine your task:\n\n```php\nnamespace MyThing\\Task;\n\nuse DecodeLabs\\Clip\\Task;\n\nclass MyTask implements Task\n{\n    public function execute(): bool\n    {\n        // Do the thing\n        return true;\n    }\n}\n```\n\n```bash\ncomposer exec thing my-task\n\n# or with effigy\neffigy thing my-task\n```\n\n### Extending\n\nUse the `MyThing` Controller Veneer frontage to run sub-tasks, and build on it to create your library's ecosystem with an easily accessed root.\n\nSee [Effigy](https://github.com/decodelabs/genesis) and [Zest](https://github.com/decodelabs/zest) for examples.\n\n\n## Licensing\n\nClip is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecodelabs%2Fclip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdecodelabs%2Fclip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecodelabs%2Fclip/lists"}