Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/braunstetter/helper
A library to help on common stuff needed in every project.
https://github.com/braunstetter/helper
helper php
Last synced: 19 days ago
JSON representation
A library to help on common stuff needed in every project.
- Host: GitHub
- URL: https://github.com/braunstetter/helper
- Owner: Braunstetter
- Created: 2022-03-07T06:09:29.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-29T16:55:03.000Z (over 2 years ago)
- Last Synced: 2024-12-05T11:13:00.579Z (about 1 month ago)
- Topics: helper, php
- Language: PHP
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Helper
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Braunstetter/helper/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/Braunstetter/helper/?branch=main)
[![Code Coverage](https://scrutinizer-ci.com/g/Braunstetter/helper/badges/coverage.png?b=main)](https://scrutinizer-ci.com/g/Braunstetter/helper/?branch=main)
[![Total Downloads](http://poser.pugx.org/braunstetter/helper/downloads)](https://packagist.org/packages/braunstetter/helper)
[![License](http://poser.pugx.org/braunstetter/helper/license)](https://packagist.org/packages/braunstetter/helper)A bundle for sharing usefully stuff around several projects.
* [Installation](#installation)
* [Array](#array)
* [attachClass](#attachclass)
* [attach](#attach)
* [firstValue](#firstvalue)## Installation
```shell
composer require braunstetter/helper
```## Array
### attachClass
This method is just handy when it comes to add a class to an existing class string.
```php
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.
```php
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.
```php
Braunstetter\Helper\Arr::firstValue([
3 => 'first',
2 => 'second',
0 => 'third'
])# output:
# first
```