{"id":22004262,"url":"https://github.com/huasofoundries/slimphpconsole","last_synced_at":"2025-05-05T17:23:25.284Z","repository":{"id":34544714,"uuid":"38489190","full_name":"HuasoFoundries/SlimPHPConsole","owner":"HuasoFoundries","description":"PHP-Console log writer for Slim Framework","archived":false,"fork":false,"pushed_at":"2021-04-29T20:35:30.000Z","size":15,"stargazers_count":12,"open_issues_count":1,"forks_count":5,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-14T00:53:42.659Z","etag":null,"topics":["log-writer","php-console","slim-framework"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"DerelictOrg/DerelictUtil","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HuasoFoundries.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}},"created_at":"2015-07-03T11:21:28.000Z","updated_at":"2020-12-21T02:29:29.000Z","dependencies_parsed_at":"2022-09-08T12:01:30.689Z","dependency_job_id":null,"html_url":"https://github.com/HuasoFoundries/SlimPHPConsole","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuasoFoundries%2FSlimPHPConsole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuasoFoundries%2FSlimPHPConsole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuasoFoundries%2FSlimPHPConsole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuasoFoundries%2FSlimPHPConsole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HuasoFoundries","download_url":"https://codeload.github.com/HuasoFoundries/SlimPHPConsole/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227239621,"owners_count":17752498,"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":["log-writer","php-console","slim-framework"],"created_at":"2024-11-30T00:13:42.971Z","updated_at":"2024-11-30T00:13:43.427Z","avatar_url":"https://github.com/HuasoFoundries.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SlimPHPConsole\n\nPHP-Console log writer for Slim Framework\n\n[![Packagist](https://img.shields.io/packagist/dm/amenadiel/slim-phpconsole.svg)](https://packagist.org/packages/amenadiel/slim-phpconsole)\n\nUse this custom log writer to output [Slim Framework](http://www.slimframework.com/)'s log messages\nto your browser's console using [PHP-Console](https://github.com/barbushin/php-console).\n\n### Installation\n\nJust add `amenadiel/slim-phpconsole` to your `composer.json` file in the require or require-dev sections:\n\n    {\n        \"require\": {\n            \"amenadiel/slim-phpconsole\":\"~0.0.4\"\n        }\n    }\n \n### Usage\n \nInstantiate the log writer. If you don't want to have the handler autostarted, pass `false` as a parameter, `true` is implied otherwise.\n\nWhen the handler is started it will set itself as error and exception handler too, unless you set it otherwise.\n \n```php\n    $logwriter = new \\Amenadiel\\SlimPHPConsole\\PHPConsoleWriter(true);\n\n    $app = new \\Slim\\Slim(array(\n        'log.enabled' =\u003e true,\n        'log.level' =\u003e \\Slim\\Log::DEBUG,\n        'log.writer' =\u003e $logwriter\n    ));\n```\n\nStarting from version `0.0.6` this adapter extends Slim\\Middleware. Therefore, you can also use the `add` method of your app\n\n```php\n    $app = new \\Slim\\Slim(array(\n        'log.enabled' =\u003e true,\n        'log.level' =\u003e \\Slim\\Log::DEBUG\n    ));\n\n    $app-\u003eadd(new \\Amenadiel\\SlimPHPConsole\\PHPConsoleWriter);\n```\n\nBoth ways of setting PHP-Console as your logger are pretty much the same. Afterwards, you can send messages to your browser's console using `$app-\u003elog`'s methods.\n\n \n```php\n    $app-\u003elog-\u003edebug('Debug called!');\n    $app-\u003elog-\u003einfo('This is just info');\n    $app-\u003elog-\u003ewarning('Heads Up! This is a warning');\n```\n \nYou can pass custom tags to PHPConsole by using this adapter's `debug` method which forwards its parameters to PHPConsole's `debug` method.\n\n```php \n    $app-\u003elog-\u003egetWriter()-\u003edebug('This has a custom tag', 'custom.tag');\n```\n\nIf you are using PHPConsole directly somewhere else in your app, remember not to start it twice, for it will throw an exception. Use its `isStarted` method to check if it's already started.\n\n```php\n    $myHandler = \\PhpConsole\\Handler::getInstance();\n    \n    if (!$myHandler-\u003eisStarted()) {\n        $myHandler-\u003estart(); // Only start it if it hasn't been started yet\n    }\n```\n \n### Optional Settings\n \nYou can use PHP-Console's configuration methods by getting a reference to the Handler instance or the Connector instance. For example:\n \n ```php\n    $logwriter = new \\Amenadiel\\SlimPHPConsole\\PHPConsoleWriter(false);\n    $handler = $logwriter-\u003egetHandler();\n    $handler-\u003esetHandleErrors(false);  // disable errors handling, must be done before 'start' method\n    $handler-\u003estart();\n \n    $connector = $logwriter-\u003egetConnector();\n    $connector-\u003esetPassword('macoy123'); //sets a very insecure passwd\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuasofoundries%2Fslimphpconsole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuasofoundries%2Fslimphpconsole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuasofoundries%2Fslimphpconsole/lists"}