A bundle for sharing usefully stuff around several projects.
composer require braunstetter/helper
This method is just handy when it comes to add a class to an existing class string.
Braunstetter\Helper\Arr::attachClass([ 'class' => 'mx-4 my-2' ], 'container')
# output:
# ['class' => 'mx-4 my-2 container']
Sometimes just want to add some new attribute to an existing string.
Braunstetter\Helper\Arr::attach(
[ 'data-controller' => 'example'],
[ 'data-controller' => 'another-example']
)
# output:
# ['data-controller' => 'example another-example']
Returns the first value of a given array. If the array is empty it returns null.
Braunstetter\Helper\Arr::firstValue([
3 => 'first',
2 => 'second',
0 => 'third'
])
# output:
# first