{"id":16749638,"url":"https://github.com/chriskonnertz/bbcode","last_synced_at":"2025-05-06T23:45:29.784Z","repository":{"id":16433591,"uuid":"19185067","full_name":"chriskonnertz/bbcode","owner":"chriskonnertz","description":"A BBCode parser and converter written in PHP.","archived":false,"fork":false,"pushed_at":"2023-01-09T18:58:23.000Z","size":88,"stargazers_count":40,"open_issues_count":15,"forks_count":26,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-04T03:36:07.189Z","etag":null,"topics":["bbcode","converter","html","parser","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/chriskonnertz.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-04-26T18:28:45.000Z","updated_at":"2025-03-26T16:24:41.000Z","dependencies_parsed_at":"2023-01-13T18:50:32.791Z","dependency_job_id":null,"html_url":"https://github.com/chriskonnertz/bbcode","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriskonnertz%2Fbbcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriskonnertz%2Fbbcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriskonnertz%2Fbbcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriskonnertz%2Fbbcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chriskonnertz","download_url":"https://codeload.github.com/chriskonnertz/bbcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252788404,"owners_count":21804280,"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":["bbcode","converter","html","parser","php"],"created_at":"2024-10-13T02:25:28.329Z","updated_at":"2025-05-06T23:45:29.752Z","avatar_url":"https://github.com/chriskonnertz.png","language":"PHP","readme":"# BBCode\n\n[![Build Status](https://img.shields.io/travis/chriskonnertz/bbcode.svg)](https://travis-ci.org/chriskonnertz/bbcode)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/chriskonnertz/bbcode/master/LICENSE)\n[![Version](https://img.shields.io/packagist/v/chriskonnertz/bbcode.svg)](https://packagist.org/packages/chriskonnertz/bbcode)\n\nA library that parses BBCode and converts it to HTML code. Written in PHP.\n\n## Installation\n\nThrough Composer:\n\n```\ncomposer require chriskonnertz/bbcode\n```\n\nFrom then on you may run `composer update` to get the latest version of this library.\n\nIt is possible to use this library without using Composer but then it is necessary to register an \n[autoloader function](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md#example-implementation).\n\n\u003e This library requires PHP 5.5 or higher.\n\n## Usage example\n\nHere is a minimalistic example of PHP code that uses this library. It assumes that there is an autoloader.\n\n```php\n$bbcode = new ChrisKonnertz\\BBCode\\BBCode();\n\n$rendered = $bbcode-\u003erender('[b]Hello world![/b]');\n\necho $rendered;\n```\n\n## Available tags\n\n* `[b]`: Font style bold - `[b]Hello world[/b]`\n* `[i]`: Font style italic - `[i]Hello world[/i]`\n* `[s]`: Font style struck through - `[s]Hello world[/s]`\n* `[u]`: Font style underlined - `[u]Hello world[/u]`\n* `[code]`: Code - `[code]Hello world[/code]`\n* `[email]`: Email (clickable) - `[email]test@example.com[/email]`\n* `[url]`: URL (clickable) - `[url=http://example.com]Example.com[/url]`\n* `[img]`: Image (not clickable) - `[img]http://example.com/example.png[/img]`\n* `[quote]`: Quote - `[quote]Hello world[/quote]`\n* `[youtube]`: Embedded YouTube video - `[youtube]a-video-id-123456[/youtube]`\n* `[font]`: Font (name) - `[font=Arial]Hello world![/font]`\n* `[size]`: Font size - `[size=12]Hello world![/size]`\n* `[color]`: Font color - `[color=red]Hello world![/color]`\n* `[left]`: Text-align: left - `[left]Hello world[/left]`\n* `[center]`: Text-align: center - `[center]Hello world[/center]`\n* `[right]`: Text-align: right - `[right]Hello world[/right]`\n* `[spoiler]`: Spoiler (pure HTML code that needs JavaScript code to add behaviour) - `[spoiler]Hello world[/spoiler]`\n* List:\n  *  `[list]`: List - `[list]...list items...[/list]`\n  * `[*]`: List item within a list - `[*]Hello world!\\r\\n[*]Hello moon!`\n  * `[li]`: List item within a list (alias) - `[li]Hello world!\\r\\n[/li][li]Hello moon!/[li]`\n  * Full example: `[list][*]Hello world![li]Hello moon![/li][/list]`\n\nYou can add custom tags with the `addTag($name, Closure $closure)` method.\n\n## Helpful methods\n\n* `renderRaw($text = null)`: Renders only the text without any tags\n* `addTag($name, Closure $closure)`: Adds a custom tag (with name and a Closure)\n* `forgetTag($name)`: Remove the tag with the given name\n* `ignoreTag($name)`: Add a tag to the array of ignored tags\n* `permitTag($name)`: Remove a tag from the array of ignored tags\n\nThe `BBCode` class also implements the `__toString()` method, which internally calls the `render()` method.\n\n## Custom tag example\n\nThis code will add a `[h1]` BBCode tag that creates a `\u003ch1\u003e` HTML tag:\n\n```php\n$bbcode-\u003eaddTag('h1', function($tag, \u0026$html, $openingTag) {\n    if ($tag-\u003eopening) {\n        return '\u003ch1\u003e';\n    } else {\n        return '\u003c/h1\u003e';\n    }\n});\n```\n\n## Multibyte characters\n\nThis library supports the use of multibyte characters.\n\n## Fork\n\nThis repository originally has been forked from [kaimallea/php-bbcode](https://github.com/kaimallea/php-bbcode). However, it has been completely rewritten since then.\n\n## Status\n\nStatus of this repository: **Maintained**. Create an issue and you will get a response, usually within 48 hours.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriskonnertz%2Fbbcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchriskonnertz%2Fbbcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriskonnertz%2Fbbcode/lists"}