2017 © Pedro PelĂĄez
 

library bbcodeparser

Parse your BBCode easy with this library.

image

codebrisk/bbcodeparser

Parse your BBCode easy with this library.

  • Friday, February 23, 2018
  • by codebrisk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 18 % Grown

The README.md

Build Status, (*1)

BBCodeParser

BBCodeParser is a standalone library that parses all(?) the common bbcode tags. The easiest way to install is via composer and is equally as easy to integrate into Laravel 4, (*2)

The available tags are:, (*3)

  • [b][/b] Bold
  • [i][/i] Italic
  • [u][/u] Underline
  • [s][/s] Line through
  • [size=4][/size] Font size
  • [color=#eee][/color] Font color
  • [center][/center] Center
  • [quote][/quote] Quote
  • [quote=John Doe][/] Named quote
  • [url][/url] Link
  • [url=http://example.com]example.com[/url] Named link
  • [img]http://example.com]example.com/logo.png[/img] Image
  • [list=1][/list] Ordered list (numerical)
  • [list=a][/list] Ordered list (alphabetically)
  • [list][/list] Unordered list
  • [*] List item
  • [code][/code] Code
  • [youtube][/youtube] Youtube

Installation

The easiest way to install the BBCodeParser library is via composer. If you don´t now what composer is or how you use it you can find more information about that at their website., (*4)

Composer

You can find the BBCodeParser class via Packagist. Require the package in your composer.json file., (*5)

"golonka/bbcodeparser": "1.3"

Then you run install or update to download your new requirement, (*6)

php composer.phar install

or, (*7)

php composer.phar update

Now you are able to require the vendor/autoload.php file to PSR-0 autoload the library., (*8)

Example

// include composer autoload
require 'vendor/autoload.php';

// import the BBCodeParser Class
use Golonka\BBCode\BBCodeParser;

// Lets parse!
$bbcode = new BBCodeParser;
$bbcode->parse('[b]Bold[/b]'); // <b>Bold</b>

If you´re a fan of Laravel 4 then the integration is made in a blink of an eye. We will go through how that is done below., (*9)

Laravel 4 integration

The BBCodeParser Class has optional Laravel 4 support and comes with a Service Provider and Facades for easy integration. After you have done the installation correctly, just follow the instructions., (*10)

Open your Laravel config file config/app.php and add the following lines., (*11)

In the $providers array add the service providers for this package., (*12)

'Golonka\BBCode\BBCodeParserServiceProvider'

Add the facade of this package to the $aliases array., (*13)

'BBCode' => 'Golonka\BBCode\Facades\BBCodeParser'

Now the BBCodeParser Class will be auto-loaded by Laravel., (*14)

Example

By default all tags will be parsed, (*15)

BBCode::parse('[b]bold[/b][i]italic[/i]');

If you would like to use only some tags when you parse you can do that by doing like this, (*16)

// In this case the [i][/i] tag will not be parsed
BBCode::only('bold')->parse('[b]bold[/b][i]italic[/i]');

or, (*17)

// In this case all tags except [b][/b] will be parsed
BBCode::except('bold')->parse('[b]bold[/b][i]italic[/i]');

Custom Parsers

You can add new custom parsers or overwrite existing parsers., (*18)

// name, pattern, replace
BBCode::setParser('mailurl', '/\[mailurl\](.*)\[\/mailurl\]/', '<a href="mailto:$1">$1</a>');

The Versions

23/02 2018

dev-master

9999999-dev http://github.com/codebrisk/bbcodeparser

Parse your BBCode easy with this library.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by CB

laravel parser bbcode psr-4 psr-2 psr-1

17/12 2014

dev-develop

dev-develop http://github.com/golonka/bbcodeparser

Parse your BBCode easy with this library.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel parser bbcode psr-4 psr-2 psr-1

30/06 2014

v1.3

1.3.0.0 http://github.com/golonka/bbcodeparser

Parse your BBCode easy with this library.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel parser bbcode

19/05 2014

v1.2.7

1.2.7.0 http://github.com/golonka/bbcodeparser

Parse your BBCode easy with this library.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel parser bbcode

17/05 2014

v1.2.6

1.2.6.0 http://github.com/golonka/bbcodeparser

Parse your BBCode easy with this library.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel parser bbcode

15/05 2014

v1.2.5

1.2.5.0 http://github.com/golonka/bbcodeparser

Parse your BBCode easy with this library.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel parser bbcode

25/03 2014

v1.2.0

1.2.0.0 http://github.com/golonka/bbcodeparser

Parse your BBCode easy with this library.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel parser bbcode

27/01 2014

v1.1.0

1.1.0.0 http://github.com/golonka/bbcodeparser

Parse your BBCode easy with this library.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel parser bbcode

07/11 2013

v1.0.0

1.0.0.0 http://github.com/golonka/bbcodeparser

Parse your BBCode easy with this library.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel parser bbcode