stonehilt / blade
StoneHilt's blade directives and other view helpers
Installs: 113
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/stonehilt/blade
Requires
- php: ^8.4
- ext-json: *
- laravel/framework: ~12
- symfony/http-foundation: ^7.2.0
Requires (Dev)
- avastechnology/iolaus: *
- fakerphp/faker: ^1.24
- phpunit/phpunit: ^10.5.35|^11.5.3|^12.0.1
This package is auto-updated.
Last update: 2025-11-05 20:29:50 UTC
README
Adds blade directives that have not been integrated into the framework.
Overtime these directives may be deprecated and integrated into the core Laravel framework.
Installation
Include this library:
~ composer require stonehilt/blade
The StoneHiltBladeServiceProvider will automatically be loaded and the new directives will be available.
This overrides the creation of the Factory object with a custom version.
If the project has extended the Factory object, please change the extension to use StoneHilt\Blade\View\Factory.
Directives
form
Generate an HTML form element. The CSRF token is automatically included when the method if "POST". Automatically mocks "PUT", "PATCH" and "DELETE" requests via a hidden "_method" input.
Signature: @form(array $options)
$optionsis an associative array of attributes. Special Attributes:- method Form method attribute (required if route not set)
- action Form action attribute (required if route not set)
- route Use a named route to determine Form method and action attributes All other values are mapped directly to the HTML attribute.
Example:
@form(['method' => 'POST', 'action' => '/page/2', 'class' => 'class name'])
<!-- form contents -->
@endform
Signature: @form(string $method, string $action)
$methodForm method$actionForm action
Example:
@form('POST', '/page/2')
<!-- form contents -->
@endform
inherit
Inherit properties from the parent component into a child's component view. This is useful when the child component needs to know the id or other key attributes of the parent component.
Signature: @inherit(array $mapping)
$mappingis an associative array of parent component field to local alias
Example:
@inherit(['id' => 'parentId'])
{{ $parentId }}
route
Return the route path based upon the name.
Signature: @route(string $name, array $parameters = [])
$nameRoute name$parametersParameters for the route (if applicable)
Example:
@route('post.update', ['page' => 2])