Download the PHP package kfoobar/laravel-shortcode without Composer
On this page you can find all versions of the php package kfoobar/laravel-shortcode. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kfoobar/laravel-shortcode
More information about kfoobar/laravel-shortcode
Files in kfoobar/laravel-shortcode
Package laravel-shortcode
Short Description A versatile and easy-to-use shortcode manager for Laravel applications, offering a simple way to integrate and manage shortcodes within a Laravel project.
License MIT
Informations about the package laravel-shortcode
Shortcodes for Laravel
Efficient and versatile shortcode manager tailored for Laravel versions 8, 9, and 10.
Installation
Install the package using Composer:
Settings
Publish the configuration file to customize settings:
Usage
Adding Custom Shortcodes
Easily define custom shortcodes like this:
Configuring Default Shortcodes
Use the shortcodes array in the config file to set default shortcodes:
Shortcode Formatting
Shortcode keys are automatically transformed: they are converted to uppercase and wrapped with a character defined in the wrapper
setting of your config file. The default wrapper character is %
.
Rendering Shortcodes
btain parsed content with various options:
Within Blade templates, use the @shortcode
directive:
Note: The Blade directive employs the render() method.
Integrating with Models
Utilize the HasShortcode
trait for automatic shortcode parsing:
Automatic shortcode parsing is turned off by default to avoid conflicts with writing operations. This precaution ensures that routine create, update and delete actions proceed without unintentional interference from the shortcode processing mechanism.
Enable With Code
Enable With Model Setting
Enable auto-parsing by default:
Enable With Middleware
Enable auto-parsing for specific routes:
The middleware automatically excludes non-read requests, AJAX requests, and Laravel Nova requests.
Predefined Shortcodes
These are the predefined shortcodes:
Shortcode | Value |
---|---|
%YEAR% | 2024 |
%MONTH% | January |
%WEEK% | 3 |
%DAY% | Monday |
%DATE% | 2024-01-01 |
%TIME% | 12:00 |
%DOMAIN% | project.test |
%APP-NAME% | Laravel |
%APP-URL% | http://project.test |
Contributing
Your contributions are highly appreciated.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-shortcode with dependencies
ext-json Version *
illuminate/config Version ^8.0||^9.0||^10.0
illuminate/database Version ^8.0||^9.0||^10.0
illuminate/support Version ^8.0||^9.0||^10.0
illuminate/view Version ^8.0||^9.0||^10.0