The vesperabr/laravel-data-binder
package provides an easy whay to bind and retrieve input data.
You can install the package via composer:
$ composer require vesperabr/laravel-data-binder
The package will automatically register itself.
You can append values to the binding tree by two ways:
use Vespera\DataBinder\Support\Facades\DataBinder;
DataBinder::bind(['foo' => 'bar'])
@bind(['foo' => 'bar'])
...
@endbind
To remove the last data from binding tree just call pop()
method.
use Vespera\DataBinder\Support\FacadesDataBinder;
DataBinder::pop();
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);
$ composer test
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.