vesperabr / laravel-data-binder
Bind and retrieve input data
1.1.1
2021-09-16 02:46 UTC
Requires
- php: ^7.3|^8.0
- illuminate/support: ^7.0|^8.0
- vesperabr/laravel-macros: ^1.0
Requires (Dev)
- orchestra/testbench: ^6.20
- phpunit/phpunit: ^9.4.4
This package is auto-updated.
Last update: 2025-03-16 10:18:42 UTC
README
The vesperabr/laravel-data-binder
package provides an easy whay to bind and retrieve input data.
Installation
You can install the package via composer:
$ composer require vesperabr/laravel-data-binder
The package will automatically register itself.
Binding values
You can append values to the binding tree by two ways:
Using bind()
method
use Vespera\DataBinder\Support\Facades\DataBinder; DataBinder::bind(['foo' => 'bar'])
Using blade directives
@bind(['foo' => 'bar']) ... @endbind
Pop data from binding
To remove the last data from binding tree just call pop()
method.
use Vespera\DataBinder\Support\FacadesDataBinder; DataBinder::pop();
Retrieving values from binding
To retrieve a value from binding tree use the DataValue facade.
use Vespera\DataBinder\Support\Facades\DataValue; DataValue::get('foo');
You can also override the current bind data passing a second parameter.
$user = User::find(1); DataValue::get('name', $user);
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.