RTLer / bladeMacro by RTLer

add macro to blade laravel
10
2
1
Package Data
Maintainer Username: RTLer
Maintainer Contact: hooman@rtler.com (hooman naghiee)
Package Create Date: 2015-08-04
Package Last Update: 2015-08-17
Language: PHP
License: GPL2
Last Refreshed: 2025-04-29 03:03:21
Package Statistics
Total Downloads: 10
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 2
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

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.