{"id":19779197,"url":"https://github.com/isaeken/spinner","last_synced_at":"2025-04-30T21:31:26.014Z","repository":{"id":56993614,"uuid":"378698201","full_name":"isaeken/spinner","owner":"isaeken","description":"Elegant spinner for interactive CLI apps","archived":false,"fork":false,"pushed_at":"2021-09-08T08:06:25.000Z","size":172,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T04:51:09.390Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isaeken.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-20T17:02:55.000Z","updated_at":"2025-03-21T17:02:11.000Z","dependencies_parsed_at":"2022-08-21T13:20:30.530Z","dependency_job_id":null,"html_url":"https://github.com/isaeken/spinner","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaeken%2Fspinner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaeken%2Fspinner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaeken%2Fspinner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaeken%2Fspinner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isaeken","download_url":"https://codeload.github.com/isaeken/spinner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251785420,"owners_count":21643478,"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":[],"created_at":"2024-11-12T05:33:47.453Z","updated_at":"2025-04-30T21:31:25.745Z","avatar_url":"https://github.com/isaeken.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Spinner\n\n\u003e Elegant spinner for interactive CLI apps.\n\u003e \n\u003e PHP alternative for https://github.com/sindresorhus/elegant-spinner\n\n![Spinner](./example/example.gif)\n\n---\n\n````php\nuse IsaEken\\Spinner\\Spinner;$result = Spinner::run(function () {\n    Spinner::setTitle('Calculating...');\n    $a = 1;\n    $b = 2;\n    $c = $a + $b;\n    Spinner::setTitle('Waiting...');\n    sleep($c);\n    return $c;\n});\n\necho \"The result is: $result!\";\n````\n\n---\n\n## Requirements\n\n- PHP ^8.0\n- Windows or Unix (Tested on Windows 10)\n- PCNTL extension suggested on unix systems.\n\n\u003e Icons work properly in Windows Terminal application.\n\u003e You can create theme to remove or change icons.\n\n---\n\n## Installation\n\nYou can install using composer.\n\n````shell\ncomposer require isaeken/spinner\n````\n\n---\n\n## Examples\n\n````php\nuse IsaEken\\Spinner\\Enums\\Status;\nuse IsaEken\\Spinner\\Spinner;\nuse IsaEken\\Spinner\\Themes\\ClassicTheme;\n\n// create spinner (you do not needed this because the 'run' command are automatically creates an instance.)\n$spinner = new Spinner();\n// or\n$spinner = Spinner::getInstance();\n\n// create a spinner process\n// with theme\n$execution_result = Spinner::run(fn () =\u003e 'Hello World!', ClassicTheme::class);\n// without theme\n$execution_result = Spinner::run(function () {\n    // get the spinner instance.\n    $spinner = Spinner::getInstance();\n    \n    // set the process title.\n    Spinner::setTitle('Hello World!');\n    // alternative\n    $spinner-\u003esetTitle('Hello World!');\n    \n    // set the process status.\n    Spinner::setStatus(Status::Success);\n    Spinner::setStatus(Status::Warning);\n    Spinner::setStatus(Status::Failed);\n    \n    // the end of process\n    return 'Hello World!';\n});\n\necho $execution_result; // Hello World!\n````\n\n---\n\n## Example Theme\n\n````php\nuse Illuminate\\Support\\Collection;\nuse IsaEken\\Spinner\\Enums\\Status;\nuse IsaEken\\Spinner\\Interfaces\\ThemeInterface;\nuse IsaEken\\Spinner\\Themes\\DefaultTheme;\n\nclass ExampleTheme extends DefaultTheme implements ThemeInterface\n{\n    /**\n     * @inheritDoc\n     */\n    public static function frames(): Collection\n    {\n        return collect([\n            '⠋',\n            '⠙',\n            '⠹',\n            '⠸',\n            '⠼',\n            '⠴',\n            '⠦',\n            '⠧',\n            '⠇',\n            '⠏',\n        ]);\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public static function icons(): Collection\n    {\n        return collect([\n            Status::Success =\u003e '✔️',\n            Status::Warning =\u003e '⚠️',\n            Status::Failed  =\u003e '❌',\n        ]);\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public static function messages(): Collection\n    {\n        return collect([\n            Status::Success =\u003e 'Process successfully completed.',\n            Status::Warning =\u003e 'Process completed but the warnings alerted.',\n            Status::Failed  =\u003e 'Process cannot be completed successfully.',\n        ]);\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public static function colors(): Collection\n    {\n        return collect([\n            Status::Success =\u003e \"\\e[32m\",\n            Status::Warning =\u003e \"\\e[33m\",\n            Status::Failed  =\u003e \"\\e[31m\",\n        ]);\n    }\n}\n````\n\n---\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaeken%2Fspinner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisaeken%2Fspinner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaeken%2Fspinner/lists"}