Download the PHP package baka/support without Composer
On this page you can find all versions of the php package baka/support. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package support
Short Description The baka Support package.
License MIT
Homepage https://mctekk.com
Informations about the package support
Baka Support
A curated collection of useful PHP snippets.
Requirements
This package requires PHP 7.2 or higher.
Installation
You can install the package via composer:
The package will automatically register itself.
📚 Array
all
Returns true
if the provided function returns true
for all elements of an array, false
otherwise.
any
Returns true
if the provided function returns true
for at least one element of an array, false
otherwise.
deepFlatten
Deep flattens an array.
drop
Returns a new array with n
elements removed from the left.
findLast
Returns the last element for which the provided function returns a truthy value.
findLastIndex
Returns the index of the last element for which the provided function returns a truthy value.
flatten
Flattens an array up to the one level depth.
groupBy
Groups the elements of an array based on the given function.
hasDuplicates
Checks a flat list for duplicate values. Returns true
if duplicate values exists and false
if values are all unique.
head
Returns the head of a list.
last
Returns the last element in an array.
pluck
Retrieves all of the values for a given key:
pull
Mutates the original array to filter out the values specified.
reject
Filters the collection using the given callback.
remove
Removes elements from an array for which the given function returns false.
tail
Returns all elements in an array except for the first one.
take
Returns an array with n elements removed from the beginning.
without
Filters out the elements of an array, that have one of the specified values.
orderBy
Sorts a collection of arrays or objects by key.
📜 String
endsWith
Check if a string is ends with a given substring.
firstStringBetween
Returns the first string there is between the strings from the parameter start and end.
upperResttrue``` to convert to uppercase.
contains
Check if a word / substring exist in a given string input.
Using strpos
to find the position of the first occurrence of a substring in a string. Returns either true
or false
License
This project is licensed under the MIT License - see the License File for details
Thanks
Thanks to appzcoder for the snippets!