{"id":33991562,"url":"https://github.com/alexlcdee/colorcli","last_synced_at":"2026-05-30T17:32:13.740Z","repository":{"id":56944700,"uuid":"89401204","full_name":"alexlcdee/colorcli","owner":"alexlcdee","description":"Console Logger with color highlighted level tags","archived":false,"fork":false,"pushed_at":"2017-04-26T11:30:40.000Z","size":67,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-14T18:54:59.797Z","etag":null,"topics":["colors","log","logger","php","php-cli","psr-3"],"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/alexlcdee.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":"2017-04-25T19:59:19.000Z","updated_at":"2018-04-03T13:17:05.000Z","dependencies_parsed_at":"2022-08-21T07:51:00.174Z","dependency_job_id":null,"html_url":"https://github.com/alexlcdee/colorcli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexlcdee/colorcli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexlcdee%2Fcolorcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexlcdee%2Fcolorcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexlcdee%2Fcolorcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexlcdee%2Fcolorcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexlcdee","download_url":"https://codeload.github.com/alexlcdee/colorcli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexlcdee%2Fcolorcli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33703065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["colors","log","logger","php","php-cli","psr-3"],"created_at":"2025-12-13T06:52:09.801Z","updated_at":"2026-05-30T17:32:13.735Z","avatar_url":"https://github.com/alexlcdee.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Color CLI\n\nPHP library for rendering colored CLI messages. \n\n## Usage\n\n#### Installation\n```\ncomposer require alexlcdee/colorcli\n```\n\n### Logger\nLogger class is a PSR-3 compatible logger. Provides colored log level tags.\n\nColors can be customised with \n```php \nsetBGColor($level, BackgroundColors $bgcolor = null)\n``` \nand \n```php\nsetFGColor($level, ForegroundColors $fgcolor = null)\n```\nBy default, Logger passes error-like messages to STDERR and info-like messages to STDOUT.\nThis behavior can be also customised with\n```php\nsetOutputStream($level, resource $stream)\n```\n\nLogger has support of context param and placeholders in message.\n```php\n$logger-\u003edebug('Debug output from {fileName}:{line}', [\n    'fileName' =\u003e __FILE__, \n    'line' =\u003e __LINE__\n]);\n```\nContext key 'exception' accepts instance of Exception and renders exception name with\nmessage, filename, line and stacktrace right after logged message.\n```php\n// catch an exception and pass it to log as context param\ntry {\n    // your code here\n} catch (Exception $e) {\n    $logger-\u003ealert(\"I've caught an exception\", ['exception' =\u003e $e]);\n}\n```\n\nMessages with newlines will be padded with empty string with length of level tag.\n\n#### Usage\n```php\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$logger = new \\ColorCLI\\Logger();\n\n$logger-\u003eemergency('System is unusable.');\n$logger-\u003ealert('Action must be taken immediately.');\n$logger-\u003ecritical('Critical conditions.');\n$logger-\u003eerror('Runtime errors that do not require immediate action but should typically');\n$logger-\u003ewarning('Exceptional occurrences that are not errors.');\n$logger-\u003enotice('Normal but significant events.');\n$logger-\u003einfo('Interesting events.');\n$logger-\u003edebug('Detailed debug information.');\n\n$logger-\u003edebug('Contextual debug output from {fileName}:{line}', [\n    'fileName' =\u003e __FILE__,\n    'line' =\u003e __LINE__\n]);\n\n$logger-\u003einfo(\"Processing\nmultiline message\");\n\ntry {\n    (new Throwing())-\u003ethrowException();\n} catch (Exception $e) {\n    $logger-\u003ealert('Caught an exception!', ['exception' =\u003e $e]);\n}\n```\nThe example above provides the following output:\n![Output example](./docs/sample-output1.png)\n\n\n### ColorHelper\nProvides static method to color input string\n\n#### Usage\n```php\n// Print string with red font on yellow background\necho ColorHelper::colorString('I am a RED string on YELLOW background', ForegroundColors::RED(), BackgroundColors::YELLOW());\necho PHP_EOL;\n```\nThe example above provides the following output: \n![Output example](./docs/sample-output2.png)\n\n### BackgroundColors and ForegroundColors\nThese classes are simply MyCLabs\\Enum\\Enum classes and provides supported colors lists. \n[Read more](https://github.com/myclabs/php-enum/blob/master/README.md) about MyCLabs\\Enum\n\n# Credits\nColorHelper idea was taken from article \n[PHP CLI Colors – PHP Class Command Line Colors (bash)](https://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexlcdee%2Fcolorcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexlcdee%2Fcolorcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexlcdee%2Fcolorcli/lists"}