Download the PHP package murdercode/laravel-shortcode-plus without Composer
On this page you can find all versions of the php package murdercode/laravel-shortcode-plus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download murdercode/laravel-shortcode-plus
More information about murdercode/laravel-shortcode-plus
Files in murdercode/laravel-shortcode-plus
Package laravel-shortcode-plus
Short Description A package that allows you to use custom shortcodes
License MIT
Homepage https://github.com/murdercode/laravel-shortcode-plus
Informations about the package laravel-shortcode-plus
Why Shortcode+?
This package allows you to use shortcodes in your application, like a Wordpress / BBS style websites.
In our days, shortcodes are a great way to preserve the integrity of the data within the content published on our site (such as a blog or forum) without risking having to rewrite the format each time.
With Laravel Shortcode+ we have the ability to turn a standard shortcode into a dynamic asset that can update over time (new HTML standards, cookie consent, AMP versions, and more)!
Warning: this is a very opinionated package and it's not intended to be multi-purpose.
How it Works
For example, you can use the following shortcode to embed a Youtube video:
This will be rendered as:
As you can see, we don't just generate an iframe but make it accessible, performant and in line with the best SEO practices around.
Installation
You can install the package via composer:
You can use shortcodes CSS publishing the assets:
You can publish and run the migrations with:
You can publish the config file with:
If you want to upgrade every time your assets, add in your composer.json:
Optionally, you can publish the views using
Usage
Laravel Shortcode Plus is shipped with a default CSS and JS for a better user experience. You can add on resources/css/app.css the CSS files:
and in resources/js/app.js the JS files:
Now you can parse your source as follows:
Use Iubenda Cookie
Add in your iubenda cookie script the following code: (/organisms/cookie-solution.blade.php)
Indexing feature
If you want to use the [index]
shortcode, you can add the withAutoHeadingIds()
method to your source before
parsing it. It will add an automatic ID to every headline (h2, h3, h4 etc...) in your source:
This will add an ID to every heading (h2, h3, h4 etc...) in your source.
Parsers
Here is the list of the available parsers:
Shortcode | Description | Parameters | Example |
---|---|---|---|
[twitter] |
Get a Twitter card | url |
[twitter url="https://twitter.com/elonmusk/status/1585841080431321088"] |
[youtube] |
Get a Youtube (light) player | url |
[youtube url="https://www.youtube.com/watch?v=9bZkp7q19f0"] |
[spotify] |
Get a Spotify player | url or uri |
[spotify url="https://open.spotify.com/track/2TpxZ7JUBn3uw46aR7qd6V"] |
[faq] |
Create a <details> tag with embedded content |
title |
[faq title="What is the answer to the ultimate question?"]42[/faq] |
[spoiler] |
Create a <details> tag with embedded content |
title |
[spoiler title="Spoiler"]This is hidden content[/spoiler] |
[facebook] |
Get a Facebook card | url |
[facebook url="https://www.facebook.com/elonmusk/posts/10157744420210129"] |
[instagram] |
Get a Instagram card | url |
[instagram url="https://www.instagram.com/p/CApQfIjBGxC/"] |
[image] |
Create an image with Image::class model |
id , caption (optional) |
[image id="123"] |
[gallery] |
Create a gallery image with Image::class model |
title , images |
Single or multiple images: [gallery title="Gallery title here" images="1"] or [gallery title="Gallery title here" images="1,2,3"] |
[photo] |
Create a gallery image with [Nova Media Hub](https://github.com/outl1ne/nova-media-hub) model |
didascalia effect (optional) link (optional) shape (optional) |
Single or multiple images: [photo didascalia="Gallery title here" id="1,2,3"] Effect [photo id="1,2,3" effect="carousel" link="https://..." shape="default |rounded"] |
[leggianche] |
Create a Read more div, based on Article or Post model |
id |
[leggianche id="1"] |
[distico] |
Create a side text block, based on Article or Post model |
id |
[distico id="1"] |
[button] |
Create a button that links to an URL | link , label , level (optional) |
[button link="https://www.google.com" label="Google" level="primary/secondary"] |
[tmdb] |
Create a TMDB card | type , id |
[tmdb type="movie/tv" id="123"] |
[widgetbay] |
Create a Widgetbay iframe | id (optional) , link (optional) , forceLink (optional) , title (optional) |
[widgetbay id="1"] [widgetbay title="Product Title" link="https://www.amazon.it/product?tag="41515&subtag="5151"..."] |
[index] |
Create an automatic index based on Heading (h2, h3, h4 etc...) | none | [index] |
[trivia] |
Create a trivia | id |
[trivia id="1"] |
Note for Facebook
Please remember to call the SDK before </body>
:
Note for Twitter
Please remember to call the SDK before </body>
:
Note for Reddit
Please remember to call the SDK before </body>
:
Note for Justwatch
Please remember to call the SDK before </body>
:
Note for Parse links
Please remember to add in config file the links to parse:
You can use a regex or a string to parse the links.
And, when parse your content, you can use forceRel():
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Stefano Novelli
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-shortcode-plus with dependencies
ext-curl Version *
guzzlehttp/guzzle Version ^7.7
illuminate/contracts Version ^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.13.0
webwizo/laravel-shortcodes Version 1.0.*