{"id":22764598,"url":"https://github.com/kuria/php-highlighter","last_synced_at":"2025-04-14T23:13:30.499Z","repository":{"id":57009936,"uuid":"117349951","full_name":"kuria/php-highlighter","owner":"kuria","description":"PHP code highlighter","archived":false,"fork":false,"pushed_at":"2025-01-05T12:16:56.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T23:13:08.631Z","etag":null,"topics":["highlighter","php"],"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/kuria.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2018-01-13T14:28:44.000Z","updated_at":"2025-01-05T12:16:51.000Z","dependencies_parsed_at":"2024-04-06T12:27:15.671Z","dependency_job_id":"e4d12097-0c02-4a9e-903a-ebd674e7ca3e","html_url":"https://github.com/kuria/php-highlighter","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"00ca28304cd1a8d7a286f3ed7b99e54ee6ab3af9"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuria%2Fphp-highlighter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuria%2Fphp-highlighter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuria%2Fphp-highlighter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuria%2Fphp-highlighter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuria","download_url":"https://codeload.github.com/kuria/php-highlighter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975328,"owners_count":21192210,"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":["highlighter","php"],"created_at":"2024-12-11T12:09:27.947Z","updated_at":"2025-04-14T23:13:30.472Z","avatar_url":"https://github.com/kuria.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHP highlighter\n###############\n\nPHP code highlighter.\n\n.. image:: https://travis-ci.com/kuria/php-highlighter.svg?branch=master\n   :target: https://travis-ci.com/kuria/php-highlighter\n\n.. contents::\n\n\nFeatures\n********\n\n- highlighting files or strings\n- highlighting specific line ranges\n- marking an active line\n- produces an ordered list (``\u003col\u003e``) with corresponding line numbers\n\n\nRequirements\n************\n\n- PHP 7.1+\n\n\nUsage\n*****\n\nHighlighting code\n=================\n\n- ``PhpHighlighter::file()`` - highlight a PHP file\n- ``PhpHighlighter::code()`` - highlight a string of PHP code\n\n.. code:: php\n\n   \u003c?php\n\n   use Kuria\\PhpHighlighter\\PhpHighlighter;\n\n   $php = \u003c\u003c\u003c'PHP'\n   \u003c?php\n\n   echo \"Hello world!\";\n\n   PHP;\n\n   echo PhpHighlighter::code($php);\n\nOutput:\n\n.. code:: html\n\n   \u003col\u003e\n   \u003cli\u003e\u003cspan style=\"color: #0000BB\"\u003e\u0026lt;?php\u003c/span\u003e\u003c/li\u003e\n   \u003cli\u003e\u003c/li\u003e\n   \u003cli\u003e\u003cspan style=\"color: #007700\"\u003eecho\u0026nbsp;\u003c/span\u003e\u003cspan style=\"color: #DD0000\"\u003e\"Hello\u0026nbsp;world!\"\u003c/span\u003e\u003cspan style=\"color: #007700\"\u003e;\u003c/span\u003e\u003c/li\u003e\n   \u003cli\u003e\u003c/li\u003e\n   \u003c/ol\u003e\n\n\n.. NOTE::\n\n  In PHP 8.3, output of the ``highlight_file()`` and ``highlight_string()`` functions\n  (which are used internally) has `changed \u003chttps://php.watch/versions/8.3/highlight_file-highlight_string-html-changes\u003e`_.\n\n  If you're using PHP 8.3 or newer, the output will contain regular spaces instead of ``\u0026nbsp;`` entities. You can use\n  ``white-space: pre;`` in your CSS to fix this.\n\n\nMarking an active line\n======================\n\nAn active line can be specified using the second argument.\n\nThe active line will have a ``class=\"active\"`` attribute.\n\n.. code:: php\n\n   \u003c?php\n\n   echo PhpHighlighter::code($php, 3);\n\n\nSpecifying line range\n=====================\n\nA line range can be specified using the third argument.\n\nExample line ranges:\n\n- ``NULL`` - highlight all lines\n- ``[20, 30]`` - highlight lines from 20 to 30 (absolute)\n- ``[-5, 5]`` - highlight 5 lines around the active line (requires active line)\n- ``[0, 0]`` - highlight the active line only (requires active line)\n\n.. code:: php\n\n   \u003c?php\n\n   echo PhpHighlighter::code($php, 3, [-1, 1]);\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuria%2Fphp-highlighter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuria%2Fphp-highlighter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuria%2Fphp-highlighter/lists"}