{"id":33987725,"url":"https://github.com/utopia-php/console","last_synced_at":"2026-03-11T13:38:44.935Z","repository":{"id":320254129,"uuid":"1079878915","full_name":"utopia-php/console","owner":"utopia-php","description":"Lightweight \u0026 fast PHP console framework.","archived":false,"fork":false,"pushed_at":"2025-10-20T15:11:06.000Z","size":135,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-14T17:52:31.722Z","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/utopia-php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-20T14:23:39.000Z","updated_at":"2025-10-20T19:19:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"e5411596-5c6d-45f6-91fb-eaddc0c457eb","html_url":"https://github.com/utopia-php/console","commit_stats":null,"previous_names":["utopia-php/console"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/utopia-php/console","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utopia-php%2Fconsole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utopia-php%2Fconsole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utopia-php%2Fconsole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utopia-php%2Fconsole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/utopia-php","download_url":"https://codeload.github.com/utopia-php/console/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utopia-php%2Fconsole/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30382673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T12:49:11.341Z","status":"ssl_error","status_checked_at":"2026-03-11T12:46:41.342Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2025-12-13T05:36:34.430Z","updated_at":"2026-03-11T13:38:44.922Z","avatar_url":"https://github.com/utopia-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Utopia Console\n\nSmall collection of helpers for working with PHP command line applications. The Console class focuses on everyday needs such as logging, prompting users for input, executing external commands, and building long-running daemons.\n\n## Installation\n\nInstall using Composer:\n\n```bash\ncomposer require utopia-php/console\n```\n\n## Usage\n\n```php\n\u003c?php\nrequire_once __DIR__.'/vendor/autoload.php';\n\nuse Utopia\\Console;\n\nConsole::success('Ready to work!');\n\n$answer = Console::confirm('Continue? [y/N]');\n\nif ($answer !== 'y') {\n    Console::warning('Aborting...');\n    Console::exit(1);\n}\n\n$output = '';\n$exitCode = Console::execute('php -r \"echo \\\"Hello\\\";\"', '', $output, 3);\n\nConsole::log(\"Command returned {$exitCode} with: {$output}\");\n```\n\n### Log Messages\n\n```php\nConsole::log('Plain log');        // stdout\nConsole::success('Green log');    // stdout\nConsole::info('Blue log');        // stdout\nConsole::warning('Yellow log');   // stderr\nConsole::error('Red log');        // stderr\n```\n\n### Execute Commands\n\n`Console::execute()` returns the exit code and writes the combined stdout/stderr output into the third argument. Pass a timeout (in seconds) to stop long-running processes and an optional progress callback to stream intermediate output.\n\n```php\n$output = '';\n$input = '';\n$exitCode = Console::execute('\u003e\u00261 echo \"success\"', $input, $output, 3);\n\necho $exitCode;  // 0\necho $output;    // \"success\\n\"\n```\n\n### Create a Daemon\n\nUse `Console::loop()` to build daemons without tight loops. The helper sleeps between iterations and periodically triggers garbage collection.\n\n```php\n\u003c?php\n\nuse Utopia\\Console;\n\nConsole::loop(function () {\n    echo \"Hello World\\n\";\n}, 1); // 1 second\n```\n\n## System Requirements\n\nUtopia Console requires PHP 7.4 or later. We recommend using the latest PHP version whenever possible.\n\n## License\n\nThe MIT License (MIT) [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futopia-php%2Fconsole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Futopia-php%2Fconsole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futopia-php%2Fconsole/lists"}