Download the PHP package brouwers/shortcodes without Composer
On this page you can find all versions of the php package brouwers/shortcodes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download brouwers/shortcodes
More information about brouwers/shortcodes
Files in brouwers/shortcodes
Package shortcodes
Short Description Wordpress like shortcodes for Laravel 4.2
License BSD-3-Clause
Informations about the package shortcodes
Laravel-Shortcodes
Wordpress like shortcodes for Laravel 4.2.
If you are looking for BBcodes, see: https://github.com/patrickbrouwers/Laravel-BBcodes
Installation
Require this package in your composer.json
and update composer.
After updating composer, add the ServiceProvider to the providers array in app/config/app.php
You can use the facade for shorter code. Add this to your aliases:
The class is bound to the ioC as shortcode
Usage
View compiling
By default shortcode compiling is set to false inside the config.
withShortcodes()
To enable the view compiling features:
This will enable shortcode rendering for that view only.
Config
Enabeling the shortcodes through config shortcodes::enabled
will enable shortcoding rendering for all views.
Enable through class
Disable through class
Disabeling some views from shortcode compiling
With the config set to true, you can disable the compiling per view.
Default compiling
To use default compiling:
Registering new shortcodes
Inside a file or service provider you can register the shortcodes. (E.g. app/start/shortcodes.php
or App/Services/ShortcodeServiceProvider.php
)
Callback
Shortcodes can be registered like Laravel macro's with a callback:
Default class
Class with custom method
Register helpers
If you only want to show the html attribute when the attribute is provided in the shortcode, you can use $shortcode->get($attributeKey, $fallbackValue = null)