Download the PHP package genert/bbcode without Composer
On this page you can find all versions of the php package genert/bbcode. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download genert/bbcode
More information about genert/bbcode
Files in genert/bbcode
Informations about the package bbcode
BBCode
BBCode parser from or to HTML.
Installation
PHP 7.1+ is required.
To get the latest version of BBCode, simply require the project using Composer:
Usage
convertFromHtml(string $text)
Convert BBCode to HTML and returns parsed text as string.
Example:
convertToHtml(string $text, [$caseSensitive])
Convert HTML to BBCode and returns parsed text as string.
Example:
This function also supports case sensitive BBCode parsing by optional parameter.
To enable this, simply pass BBCode::CASE_SENSITIVE
as second argument:
stripBBCodeTags(string $text)
Strips BBCode tags from text and returns output as string.
Example:
only(array list or ...args)
Sets parser to only convert set BBCode tags.
Example:
except(array list or ...args)
Sets parser to only convert all BBCode tags except listed.
Example:
addParser(string $name, string $pattern, string $replace, string $content)
Add regex based BBCode parser to translate found pattern to desired one.
Example:
addHtmlParser(string $name, string $pattern, string $replace, string $content)
Add HTML parser to translate pattern to desired one.
See addParser
for example code.
addLinebreakParser()
Adds linebreak parser to BBCode parsers list to convert newlines to <br />
in HTML.
Laravel installation
Once BBCode is installed, you need to register the service provider. Open up config/app.php
and add the following to the providers
key.
\Genert\BBCode\BBCodeServiceProvider::class,
You can register facades in the aliases
key of your config/app.php
file if you like.
'BBCode' => \Genert\BBCode\Facades\BBCode::class,
With registered facade, you can use library's functionality as following:
Testing
To run tests, simply run following command in terminal:
Contributions & Issues
Contributions are welcome. Please clearly explain the purpose of the PR and follow the current style.
Issues can be resolved quickest if they are descriptive and include both a reduced test case and a set of steps to reproduce.
Licence
The genert/bbcode
library is copyright © Genert Org and licensed for use under the MIT License (MIT).
Please see MIT License for more information.