rtler/blademacro

add macro to blade laravel
10 2
Install
composer require rtler/blademacro
License:GPL2
Last Updated:Aug 17, 2015
Links: GitHub  ·  Packagist
Maintainer: RTLer

bladeMacro

macro extension for laravel blade. it add macros to laravel blade that work just like html macro but there is problem with html macro that it register and echo function into compiled view code and run functin every time page loads, but this library run fubction and echo return into compiled view.

##installation add this to your providers

    'providers' => [
		...
        RTLer\BladeMacro\BladeMacroServiceProvider::class
		...
    ],

##usage and register macroes using(for adding php code to view write it in string)

      BladeMacro::macro('inputText', function ($arg1, $arg2, $arg3, $arg4) {
          return 'testing ' . $arg1 . ' ' . $arg2 . ' ' . $arg3 . ' ' . $arg4;
      });

*it can contains php code in return string

and in view use it like this (macroName(arg1, arg2, ...)):

    @macroInputText('name', 'value', 'label', 'options')

and becuse of that this code replase the return string of the BladeMacro::macro function and cache it, after changeing the macro run the command

php artisan view:clear

##contribute i add Illuminate\Html to it (htmlName(arg1, arg2, ...),formName(arg1, arg2, ...)) but there is problem with form if you like to help fix form.

Related Packages

erirk/paypalpayment

laravel-paypalpayment is simple package help you process direct credit card paym...

0
gabrieloliverio/laravel5-generators

Database metadata-based generators for Laravel 5

1
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

628,058,007 9,707
laravel/framework

The Laravel Framework.

576,155,700 34,907
laravel/tinker

Powerful REPL for the Laravel framework.

485,678,092 7,440