braunstetter / helper
Just a package for php helper classes.
Installs: 1 576
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
Requires (Dev)
- phpunit/phpunit: ^9
README
A bundle for sharing usefully stuff around several projects.
Installation
composer require braunstetter/helper
Array
attachClass
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']
attach
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']
firstValue
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