{"id":15028738,"url":"https://github.com/mkgor/highlighter","last_synced_at":"2026-03-14T18:22:02.368Z","repository":{"id":57018018,"uuid":"259029421","full_name":"mkgor/highlighter","owner":"mkgor","description":"Library, which allows you to highlight your PHP code in console (terminal)","archived":false,"fork":false,"pushed_at":"2020-04-30T19:02:24.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T21:48:27.397Z","etag":null,"topics":["ascii","code","composer-package","highlight","php","syntax","syntax-highlighting","terminal"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkgor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-26T12:50:55.000Z","updated_at":"2020-04-30T18:59:09.000Z","dependencies_parsed_at":"2022-08-22T11:31:18.483Z","dependency_job_id":null,"html_url":"https://github.com/mkgor/highlighter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkgor%2Fhighlighter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkgor%2Fhighlighter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkgor%2Fhighlighter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkgor%2Fhighlighter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkgor","download_url":"https://codeload.github.com/mkgor/highlighter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243338380,"owners_count":20275493,"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":["ascii","code","composer-package","highlight","php","syntax","syntax-highlighting","terminal"],"created_at":"2024-09-24T20:08:58.595Z","updated_at":"2025-12-24T18:16:47.869Z","avatar_url":"https://github.com/mkgor.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Highlighter\nLibrary, which allows you to highlight your PHP code in terminal\n\n## Installation\nInstallation via composer:\n\n````\ncomposer require mkgor/highlighter\n````\n\n## Printing whole file\n````php\n\u003c?php\n\nrequire_once \"vendor/autoload.php\";\n\n$highlighter = new \\Highlighter\\Highlighter();\n\necho $highlighter-\u003egetWholeFile(__FILE__);\n````\n\n#### Result\n![Result](https://i.imgur.com/TC1mP2u.png)\n\n## Printing code snippet (and highlighting specified line)\n````php\n\u003c?php\n\nrequire_once \"vendor/autoload.php\";\n\n$highlighter = new \\Highlighter\\Highlighter();\n\necho $highlighter-\u003egetSnippet(__FILE__, 3);\n````\n\n#### Result\n\n![Result](https://i.imgur.com/iqEfh0d.png)\n\n## Printing code snippet with specified lines\n````php\n\u003c?php\n\nrequire_once \"vendor/autoload.php\";\n\n$highlighter = new \\Highlighter\\Highlighter();\n\necho $highlighter-\u003egetSpecifiedSnippet(__FILE__, 3, 5);\n````\n\n#### Result\n\n![Result](https://i.imgur.com/uuajqgQ.png)\n\n## Printing single line\n````php\n\u003c?php\n\nrequire_once \"vendor/autoload.php\";\n\n$highlighter = new \\Highlighter\\Highlighter();\n\necho $highlighter-\u003egetLine(__FILE__, 3);\n````\n#### Result\n\n![Result](https://i.imgur.com/qfJWGrP.png)\n\n\n##\nYou can use same functions with suffix `WithoutNumbers` to highlight code without line numbers:\n\n```php\n\u003c?php\n\nrequire_once \"vendor/autoload.php\";\n\n$highlighter = new \\Highlighter\\Highlighter();\n\necho $highlighter-\u003egetWholeFileWithoutNumbers(__FILE__);\n```\n\n#### Result\n\n![Result](https://i.imgur.com/F7Mo4Rq.png)\n\n## Themes\n\nThis highlighter supports custom themes. It has built-in themes, but you can create your own by implementing ```Highlighter\\Theme\\ThemeInterface```\n\nSo, to set theme, just call ```setTheme``` method of Highlighter\n\n```php\n\u003c?php\n\nrequire_once \"vendor/autoload.php\";\n\n$highlighter = new \\Highlighter\\Highlighter();\n$highlighter-\u003esetTheme(new Highlighter\\Theme\\DefaultThemes\\Minimalistic());\n\necho $highlighter-\u003egetWholeFile(__FILE__);\n```\n\n#### Built-in themes:\n\n##### Minimalistic\n\n![Theme](https://i.imgur.com/0qGTZ1G.png)\n\n##### Light\n\n![Theme](https://i.imgur.com/zp4i1Di.png)\n\n##### Material\n\n![Theme](https://i.imgur.com/vENEwe1.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkgor%2Fhighlighter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkgor%2Fhighlighter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkgor%2Fhighlighter/lists"}