AriasBros / laravel-shortcode by AriasBros.

Laravel Shortcode Service
100
0
2
Package Data
Maintainer Username: AriasBros.
Maintainer Contact: david@ariasbros.com (David Arias Vázquez)
Package Create Date: 2016-09-08
Package Last Update: 2017-09-05
Language: PHP
License: MIT
Last Refreshed: 2024-11-14 15:13:14
Package Statistics
Total Downloads: 100
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

laravel-shortcode

A implementation of shortcodes in a package for Laravel

'providers' => [
    AriasBros\Shortcode\Providers\ShortcodeServiceProvider::class,     
],

'aliases' => [
    "Shortcode" => AriasBros\Shortcode\Facades\Shortcode::class
],
use Shortcode;

Shortcode::composer("shortcode_tag", "App\Http\ViewShortcodes\MyShortcode");
use AriasBros\Shortcode\Contracts\Factory as ShortcodeFactory;

public function boot(ShortcodeFactory $shortcode)
{   
    $shortcode->composer("shortcode_tag", "App\Http\ViewShortcodes\MyShortcode");
}
<?php
    
namespace App\Http\ViewShortcodes;

use AriasBros\Shortcode\Contracts\Shortcode;

class MyShortcode implements Shortcode
{
    /**
     * @return Illuminate\View\View
     */
    public function compose($attrs = null)
    {
        return view("shortcodes.my-shortcode", $attrs);
    }
}