PHPackages                             arpadhegedus/utility - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. arpadhegedus/utility

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arpadhegedus/utility
====================

Utility classes for everyday php development

1.0.0(6y ago)054MITPHP

Since Oct 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/arpadHegedus/Utility)[ Packagist](https://packagist.org/packages/arpadhegedus/utility)[ RSS](/packages/arpadhegedus-utility/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (3)Versions (7)Used By (0)

Utility
=======

[](#utility)

Table of Contents
-----------------

[](#table-of-contents)

- [Arr](#arr)
    - [get](#get)
    - [group](#group)
    - [keys](#keys)
    - [remove](#remove)
    - [set](#set)
    - [sort](#sort)
    - [sortKeys](#sortkeys)
    - [values](#values)
    - [abides](#abides)
    - [abidesAny](#abidesany)
    - [add](#add)
    - [dd](#dd)
    - [dump](#dump)
    - [merge](#merge)
    - [getShallowType](#getshallowtype)
    - [append](#append)
    - [average](#average)
    - [blueprint](#blueprint)
    - [clean](#clean)
    - [contains](#contains)
    - [containsAll](#containsall)
    - [containsAny](#containsany)
    - [divide](#divide)
    - [dot](#dot)
    - [each](#each)
    - [filter](#filter)
    - [find](#find)
    - [findAll](#findall)
    - [first](#first)
    - [flatten](#flatten)
    - [has](#has)
    - [hasAll](#hasall)
    - [hasAny](#hasany)
    - [implode](#implode)
    - [initial](#initial)
    - [intersection](#intersection)
    - [intersects](#intersects)
    - [isAssoc](#isassoc)
    - [isNumeric](#isnumeric)
    - [isSequential](#issequential)
    - [last](#last)
    - [map](#map)
    - [mapRecursive](#maprecursive)
    - [matches](#matches)
    - [matchesAny](#matchesany)
    - [max](#max)
    - [min](#min)
    - [normalize](#normalize)
    - [prepend](#prepend)
    - [pluck](#pluck)
    - [random](#random)
    - [range](#range)
    - [reject](#reject)
    - [removeFirst](#removefirst)
    - [removeLast](#removelast)
    - [removeValue](#removevalue)
    - [repeat](#repeat)
    - [replace](#replace)
    - [rest](#rest)
    - [reverse](#reverse)
    - [search](#search)
    - [size](#size)
    - [undot](#undot)
    - [unique](#unique)
    - [without](#without)
- [Chain](#chain)
    - [\_\_construct](#__construct)
    - [break](#break)
    - [swap](#swap)
    - [\_\_call](#__call)
    - [start](#start)
- [Collection](#collection)
    - [abides](#abides-1)
    - [abidesAny](#abidesany-1)
    - [add](#add-1)
    - [dd](#dd-1)
    - [dump](#dump-1)
    - [merge](#merge-1)
    - [getShallowType](#getshallowtype-1)
    - [get](#get-1)
    - [group](#group-1)
    - [keys](#keys-1)
    - [remove](#remove-1)
    - [set](#set-1)
    - [sort](#sort-1)
    - [sortKeys](#sortkeys-1)
    - [values](#values-1)
- [Func](#func)
    - [cache](#cache)
    - [call](#call)
    - [once](#once)
    - [only](#only)
    - [throttle](#throttle)
- [Geo](#geo)
    - [address](#address)
    - [addressDistance](#addressdistance)
    - [distance](#distance)
    - [getAddress](#getaddress)
    - [getDistance](#getdistance)
- [Misc](#misc)
    - [abides](#abides-2)
    - [abidesAny](#abidesany-2)
    - [add](#add-2)
    - [dd](#dd-2)
    - [dump](#dump-2)
    - [merge](#merge-2)
    - [getShallowType](#getshallowtype-2)
- [Num](#num)
    - [abides](#abides-3)
    - [abidesAny](#abidesany-3)
    - [add](#add-3)
    - [dd](#dd-3)
    - [dump](#dump-3)
    - [merge](#merge-3)
    - [getShallowType](#getshallowtype-3)
    - [accord](#accord)
    - [fileSize](#filesize)
    - [format](#format)
    - [isBetween](#isbetween)
    - [isEven](#iseven)
    - [isNegative](#isnegative)
    - [isOdd](#isodd)
    - [isOutside](#isoutside)
    - [isPositive](#ispositive)
    - [limit](#limit)
    - [max](#max-1)
    - [min](#min-1)
    - [ordinal](#ordinal)
    - [pad](#pad)
    - [percentOf](#percentof)
- [Obj](#obj)
    - [get](#get-2)
    - [group](#group-2)
    - [keys](#keys-2)
    - [remove](#remove-2)
    - [set](#set-2)
    - [sort](#sort-2)
    - [sortKeys](#sortkeys-2)
    - [values](#values-2)
    - [abides](#abides-4)
    - [abidesAny](#abidesany-4)
    - [add](#add-4)
    - [dd](#dd-4)
    - [dump](#dump-4)
    - [merge](#merge-4)
    - [getShallowType](#getshallowtype-4)
    - [has](#has-1)
    - [properties](#properties)
    - [methods](#methods)
    - [unpack](#unpack)
- [Str](#str)
    - [abides](#abides-5)
    - [abidesAny](#abidesany-5)
    - [add](#add-5)
    - [dd](#dd-5)
    - [dump](#dump-5)
    - [merge](#merge-5)
    - [getShallowType](#getshallowtype-5)
    - [accord](#accord-1)
    - [alpha](#alpha)
    - [alphaNumeric](#alphanumeric)
    - [append](#append-1)
    - [ascii](#ascii)
    - [at](#at)
    - [base64](#base64)
    - [between](#between)
    - [bool](#bool)
    - [camel](#camel)
    - [chars](#chars)
    - [clean](#clean-1)
    - [collapse](#collapse)
    - [common](#common)
    - [commonPrefix](#commonprefix)
    - [commonSuffix](#commonsuffix)
    - [contains](#contains-1)
    - [containsAll](#containsall-1)
    - [containsAny](#containsany-1)
    - [count](#count)
    - [dashed](#dashed)
    - [delimit](#delimit)
    - [endsWith](#endswith)
    - [endsWithAny](#endswithany)
    - [ensureLeft](#ensureleft)
    - [ensureRight](#ensureright)
    - [fileSize](#filesize-1)
    - [first](#first-1)
    - [htmlDecode](#htmldecode)
    - [htmlEncode](#htmlencode)
    - [index](#index)
    - [indexes](#indexes)
    - [insert](#insert)
    - [isAlpha](#isalpha)
    - [isAlphanumeric](#isalphanumeric)
    - [isBase64](#isbase64)
    - [isBlank](#isblank)
    - [isEmail](#isemail)
    - [isHexadecimal](#ishexadecimal)
    - [isHTML](#ishtml)
    - [isIP](#isip)
    - [isJSON](#isjson)
    - [isLower](#islower)
    - [isRegex](#isregex)
    - [isSerialized](#isserialized)
    - [isUpper](#isupper)
    - [isURL](#isurl)
    - [last](#last-1)
    - [lastIndex](#lastindex)
    - [length](#length)
    - [limit](#limit-1)
    - [limitWords](#limitwords)
    - [lines](#lines)
    - [lower](#lower)
    - [lowerFirst](#lowerfirst)
    - [matches](#matches-1)
    - [normalize](#normalize-1)
    - [ordinal](#ordinal-1)
    - [pad](#pad-1)
    - [padBoth](#padboth)
    - [padLeft](#padleft)
    - [padRight](#padright)
    - [pascal](#pascal)
    - [prepend](#prepend-1)
    - [random](#random-1)
    - [regexReplace](#regexreplace)
    - [remove](#remove-3)
    - [removeLeft](#removeleft)
    - [removeRight](#removeright)
    - [repeat](#repeat-1)
    - [replace](#replace-1)
    - [reverse](#reverse-1)
    - [shuffle](#shuffle)
    - [slice](#slice)
    - [slug](#slug)
    - [slugify](#slugify)
    - [snake](#snake)
    - [spacesToTabs](#spacestotabs)
    - [split](#split)
    - [startsWith](#startswith)
    - [startsWithAny](#startswithany)
    - [stringReplace](#stringreplace)
    - [stripWhitespace](#stripwhitespace)
    - [sub](#sub)
    - [tabsToSpaces](#tabstospaces)
    - [template](#template)
    - [timesContains](#timescontains)
    - [title](#title)
    - [titlize](#titlize)
    - [trim](#trim)
    - [trimLeft](#trimleft)
    - [trimRight](#trimright)
    - [underscored](#underscored)
    - [upper](#upper)
    - [upperFirst](#upperfirst)
    - [words](#words)
- [URL](#url)
    - [auth](#auth)
    - [build](#build)
    - [current](#current)
    - [fragment](#fragment)
    - [fragmentSet](#fragmentset)
    - [host](#host)
    - [hostSet](#hostset)
    - [parse](#parse)
    - [parts](#parts)
    - [pass](#pass)
    - [path](#path)
    - [pathRemove](#pathremove)
    - [pathSet](#pathset)
    - [port](#port)
    - [portSet](#portset)
    - [query](#query)
    - [queryAdd](#queryadd)
    - [queryArray](#queryarray)
    - [queryGet](#queryget)
    - [queryRemove](#queryremove)
    - [querySet](#queryset)
    - [scheme](#scheme)
    - [schemeSet](#schemeset)
    - [user](#user)

Arr
---

[](#arr)

- Full name: \\Utility\\Arr
- Parent class: \\Utility\\Collection

### get

[](#get)

Get a value of a $collection by a $key of $separator notation with $default fallback

```
Arr::get( array|object $collection, string $key = '', mixed $default = null, string $separator = '.' ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$key`**string**`$default`**mixed**`$separator`**string**---

### group

[](#group)

Group values from a $collection according to the results of a $callback

```
Arr::group( array|object $collection, callable $callback ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$callback`**callable**---

### keys

[](#keys)

Get keys from a $collection

```
Arr::keys( array|object $collection ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**---

### remove

[](#remove)

Remove a $key value in a $collection using $separator notation.

```
Arr::remove( array|object $collection, string|array $key, string $separator = '.' ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$key`**string|array**`$separator`**string**---

### set

[](#set)

Set a $value in a $collection using $separator notation.

```
Arr::set( array|object $collection, string $key, mixed $value, string $separator = '.' ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$key`**string**`$value`**mixed**`$separator`**string**---

### sort

[](#sort)

Sort a $collection by value, by a closure or by a property $sorter along a $direction

```
Arr::sort( array|object $collection, string $direction = 'ASC', null|callable|string $sorter = null ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$direction`**string**`$sorter`**null|callable|string**---

### sortKeys

[](#sortkeys)

Sort a $collection by keys or properties by $direction

```
Arr::sortKeys( array|object $collection, string $direction = 'ASC' ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$direction`**string**---

### values

[](#values)

Get values from a $collection

```
Arr::values( array|object $collection ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**---

### abides

[](#abides)

Check if $data abides an array of $rules

```
Arr::abides( mixed $data, array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**array|callable**---

### abidesAny

[](#abidesany)

Check if $data abides any of an array of $rules

```
Arr::abidesAny( mixed $data, string|array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**string|array|callable**---

### add

[](#add)

Add mixed $data to other mixed data cleverly

```
Arr::add( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dd

[](#dd)

Dump $data and die

```
Arr::dd( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dump

[](#dump)

Dry dump $data for debug

```
Arr::dump( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### merge

[](#merge)

Merge mixed $data to other mixed data cleverly

```
Arr::merge( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### getShallowType

[](#getshallowtype)

Get a simplified type of a variable.

```
Arr::getShallowType( mixed $data ): string
```

Return values: string|array|object|number|boolean|unknown

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### append

[](#append)

Append a $value to an $array

```
Arr::append( array $array, mixed $value ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$value`**mixed**---

### average

[](#average)

Get average value of an $array

```
Arr::average( array $array, integer $decimals ): float
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$decimals`**integer**---

### blueprint

[](#blueprint)

Build an $array from a $ruleset blueprint and fallback $defaults

```
Arr::blueprint( array $array, array $ruleset, array $defaults = array() ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$ruleset`**array**`$defaults`**array**---

### clean

[](#clean)

Clean all falsy values from an array

```
Arr::clean( array $array, boolean $normalize = true ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$normalize`**boolean**---

### contains

[](#contains)

Check if a $value is in an $array

```
Arr::contains( array $array, mixed $value ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$value`**mixed**---

### containsAll

[](#containsall)

Check if $array contains all $values

```
Arr::containsAll( array $array, array $values ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$values`**array**---

### containsAny

[](#containsany)

Check if $array contains any of the $values

```
Arr::containsAny( array $array, array $values ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$values`**array**---

### divide

[](#divide)

Divide an $array into to arrays, the first containing the keys, the second the values

```
Arr::divide( array $array ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### dot

[](#dot)

Flatten a multidimensional $array with $separator notation

```
Arr::dot( array $array, string $separator = '.', null|string $parent = null ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$separator`**string**`$parent`**null|string**---

### each

[](#each)

Iterate over an $array and modify the array's values via $callback function

```
Arr::each( array $array, callable $callback, boolean $passKey = false ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**callable**`$passKey`**boolean**---

### filter

[](#filter)

Find all items in an $array that pass a $callback truth test

```
Arr::filter( array $array, callable $callback, string|integer $pass = 'value', boolean $normalize = false ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**callable**`$pass`**string|integer**`$normalize`**boolean**---

### find

[](#find)

Find the first item in an $array that passes $callback the truth test

```
Arr::find( array $array, callable $callback, boolean $passKey = false ): void|mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**callable**`$passKey`**boolean**---

### findAll

[](#findall)

Find all items in an $array that passes $callback truth test

```
Arr::findAll( array $array, callable $callback, boolean $passKey ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**callable**`$passKey`**boolean**---

### first

[](#first)

Get the first $number of values from an $array

```
Arr::first( array $array, integer $number = 1 ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$number`**integer**---

### flatten

[](#flatten)

Flatten a multi-dimensional $array into a one-dimenisional array

```
Arr::flatten( array $array, boolean $preserveKeys = true ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$preserveKeys`**boolean**---

### has

[](#has)

Check if an $array has a $key

```
Arr::has( array $array, integer|string $key ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$key`**integer|string**---

### hasAll

[](#hasall)

Check if an $array has all $keys

```
Arr::hasAll( array $array, array $keys ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$keys`**array**---

### hasAny

[](#hasany)

Check if an $array has any of the $keys

```
Arr::hasAny( array $array, array $keys ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$keys`**array**---

### implode

[](#implode)

Implode an $array

```
Arr::implode( array $array, string $glue = '' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$glue`**string**---

### initial

[](#initial)

Get everything from $array but the last $number of items

```
Arr::initial( array $array, integer $number = 1 ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$number`**integer**---

### intersection

[](#intersection)

Return an array with all elements found in both $a and $b input arrays

```
Arr::intersection( array $a, array $b ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$a`**array**`$b`**array**---

### intersects

[](#intersects)

Return if $a and $b input arrays intersect or not

```
Arr::intersects( array $a, array $b ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$a`**array**`$b`**array**---

### isAssoc

[](#isassoc)

Check if an $array is associative

```
Arr::isAssoc( array $array ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### isNumeric

[](#isnumeric)

Check if an $array only has numeric keys

```
Arr::isNumeric( array $array ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### isSequential

[](#issequential)

Check if $array is a numeric sequential array

```
Arr::isSequential( array $array ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### last

[](#last)

Get the last $number of values from an $array

```
Arr::last( array $array, integer $number = 1 ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$number`**integer**---

### map

[](#map)

Invoke a $callback function on all of the values in an $array

```
Arr::map( array $array, callable $callback, array $arguments = array() ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**callable**`$arguments`**array**---

### mapRecursive

[](#maprecursive)

Invoke a $vallbackfunction on all of the values in an $array recursively

```
Arr::mapRecursive( array $array, callable $callback ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**callable**---

### matches

[](#matches)

Check if all items in an $array match a $callback truth test

```
Arr::matches( array $array, callable $callback ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**callable**---

### matchesAny

[](#matchesany)

Check if any item in an $array matches a $callback truth test

```
Arr::matchesAny( array $array, callable $callback ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**callable**---

### max

[](#max)

Get the max value of an $array

```
Arr::max( array $array, null|callable $callback = null ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**null|callable**---

### min

[](#min)

Get the min value of an $array

```
Arr::min( array $array, null|callable $callback = null ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**null|callable**---

### normalize

[](#normalize)

Normalize $array by sorting and filling missing keys

```
Arr::normalize( array $array ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### prepend

[](#prepend)

Prepend an $array with a $value

```
Arr::prepend( array $array, mixed $value ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$value`**mixed**---

### pluck

[](#pluck)

Get the value per $key from an $array of associative arrays

```
Arr::pluck( array $array, mixed $key, boolean $preserveKeys = true, boolean $keepEmpty = false ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$key`**mixed**`$preserveKeys`**boolean**`$keepEmpty`**boolean**---

### random

[](#random)

Get a $number of random values from an $array

```
Arr::random( array $array, integer $number = 1 ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$number`**integer**---

### range

[](#range)

Generate an array from a range starting from $base to $stop by $step

```
Arr::range( integer $base, integer $stop = null, integer $step = 1 ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$base`**integer**`$stop`**integer**`$step`**integer**---

### reject

[](#reject)

Return all items from an $array that fail the $callback truth test

```
Arr::reject( array $array, callable $callback, boolean $passKey = false, boolean $normalize = false ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$callback`**callable**`$passKey`**boolean**`$normalize`**boolean**---

### removeFirst

[](#removefirst)

Remove the first item from an $array

```
Arr::removeFirst( array $array ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### removeLast

[](#removelast)

Remove the last item from an array

```
Arr::removeLast( array $array ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### removeValue

[](#removevalue)

Remove a $value from an $array

```
Arr::removeValue( array $array, mixed $value, boolean $normalize = true ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$value`**mixed**`$normalize`**boolean**---

### repeat

[](#repeat)

Fill an array with some $data a number of $times

```
Arr::repeat( mixed $data, integer $times ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$times`**integer**---

### replace

[](#replace)

Replace each $search word or pattern with $replacement inside $array

```
Arr::replace( array $array, string $search, string $replacement ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$search`**string**`$replacement`**string**---

### rest

[](#rest)

Get the last $number of items of an $array.

```
Arr::rest( array $array, integer $number = 1 ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$number`**integer**---

### reverse

[](#reverse)

Reverse an $array

```
Arr::reverse( array $array ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### search

[](#search)

Search for the index of a value in an array.

```
Arr::search( array $array, mixed $value ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$value`**mixed**---

### size

[](#size)

Get the size of an array.

```
Arr::size( array $array ): integer
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### undot

[](#undot)

Unflatten a previously flattened $array using $separator notation

```
Arr::undot( array $array, string $separator = '.' ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$separator`**string**---

### unique

[](#unique)

Remove duplicates from an array.

```
Arr::unique( array $array ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**---

### without

[](#without)

Return an array without all instances of certain values.

```
Arr::without( array $array, mixed $values ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$array`**array**`$values`**mixed**---

Chain
-----

[](#chain)

- Full name: \\Utility\\Chain

### \_\_construct

[](#__construct)

Start a new chain

```
Chain::__construct( mixed $subject, string|object $class )
```

**Parameters:**

ParameterTypeDescription`$subject`**mixed**`$class`**string|object**---

### break

[](#break)

Break the chain and return subject

```
Chain::break(  ): mixed
```

---

### swap

[](#swap)

Swap Utility class along the chain

```
Chain::swap( string|object $class ): void
```

**Parameters:**

ParameterTypeDescription`$class`**string|object**---

### \_\_call

[](#__call)

Dispatch method calls to Utility class and pass in subject as the first argument

```
Chain::__call( string $method, array $arguments ): void
```

**Parameters:**

ParameterTypeDescription`$method`**string**`$arguments`**array**---

### start

[](#start)

Start a new chain

```
Chain::start( mixed $subject, string|object $class ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$subject`**mixed**`$class`**string|object**---

Collection
----------

[](#collection)

- Full name: \\Utility\\Collection
- Parent class: \\Utility\\Misc

### abides

[](#abides-1)

Check if $data abides an array of $rules

```
Collection::abides( mixed $data, array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**array|callable**---

### abidesAny

[](#abidesany-1)

Check if $data abides any of an array of $rules

```
Collection::abidesAny( mixed $data, string|array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**string|array|callable**---

### add

[](#add-1)

Add mixed $data to other mixed data cleverly

```
Collection::add( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dd

[](#dd-1)

Dump $data and die

```
Collection::dd( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dump

[](#dump-1)

Dry dump $data for debug

```
Collection::dump( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### merge

[](#merge-1)

Merge mixed $data to other mixed data cleverly

```
Collection::merge( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### getShallowType

[](#getshallowtype-1)

Get a simplified type of a variable.

```
Collection::getShallowType( mixed $data ): string
```

Return values: string|array|object|number|boolean|unknown

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### get

[](#get-1)

Get a value of a $collection by a $key of $separator notation with $default fallback

```
Collection::get( array|object $collection, string $key = '', mixed $default = null, string $separator = '.' ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$key`**string**`$default`**mixed**`$separator`**string**---

### group

[](#group-1)

Group values from a $collection according to the results of a $callback

```
Collection::group( array|object $collection, callable $callback ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$callback`**callable**---

### keys

[](#keys-1)

Get keys from a $collection

```
Collection::keys( array|object $collection ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**---

### remove

[](#remove-1)

Remove a $key value in a $collection using $separator notation.

```
Collection::remove( array|object $collection, string|array $key, string $separator = '.' ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$key`**string|array**`$separator`**string**---

### set

[](#set-1)

Set a $value in a $collection using $separator notation.

```
Collection::set( array|object $collection, string $key, mixed $value, string $separator = '.' ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$key`**string**`$value`**mixed**`$separator`**string**---

### sort

[](#sort-1)

Sort a $collection by value, by a closure or by a property $sorter along a $direction

```
Collection::sort( array|object $collection, string $direction = 'ASC', null|callable|string $sorter = null ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$direction`**string**`$sorter`**null|callable|string**---

### sortKeys

[](#sortkeys-1)

Sort a $collection by keys or properties by $direction

```
Collection::sortKeys( array|object $collection, string $direction = 'ASC' ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$direction`**string**---

### values

[](#values-1)

Get values from a $collection

```
Collection::values( array|object $collection ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**---

Func
----

[](#func)

- Full name: \\Utility\\Func

### cache

[](#cache)

Cache the return of a $function and return the value from cache in subsequent calls

```
Func::cache( callable $function ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$function`**callable**---

### call

[](#call)

Call a $function with $arguments whether it is a reference array string or an anonymus function

```
Func::call( null|callable $function, array $arguments = array() ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$function`**null|callable**`$arguments`**array**---

### once

[](#once)

Limit a $function to be only called once

```
Func::once( callable $function, boolean $unique = false ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$function`**callable**`$unique`**boolean**---

### only

[](#only)

Limit a $function to be only called a certain number of $times

```
Func::only( callable $function, integer $times = 1, boolean $unique = false ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$function`**callable**`$times`**integer**`$unique`**boolean**---

### throttle

[](#throttle)

Throttle a $function so that it can only be called once in every $miliseconds

```
Func::throttle( callable $function, integer $miliseconds = 300 ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$function`**callable**`$miliseconds`**integer**---

Geo
---

[](#geo)

- Full name: \\Utility\\Geo

### address

[](#address)

Get lat lng data from an address

```
Geo::address( string $address, array $apiParameters = array() ): null|string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$address`**string**`$apiParameters`**array**---

### addressDistance

[](#addressdistance)

Calculate the distance between 2 pairs of lat and lng values

```
Geo::addressDistance( string $address1, string $address2, array $apiParameters = array(), string $unit = 'M' ): float
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$address1`**string**`$address2`**string**`$apiParameters`**array**`$unit`**string**---

### distance

[](#distance)

Get the distance between 2 pairs of lat and lng values in various units

```
Geo::distance( float $lat1, float $lng1, float $lat2, float $lng2, string $unit = 'M' ): null|string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$lat1`**float**`$lng1`**float**`$lat2`**float**`$lng2`**float**`$unit`**string**---

### getAddress

[](#getaddress)

Get geo data from an address

```
Geo::getAddress( string $address, array $apiParameters = array() )
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$address`**string**`$apiParameters`**array**---

### getDistance

[](#getdistance)

Calculate the distance between 2 pairs of lat and lng values

```
Geo::getDistance( float $lat1, float $lng1, float $lat2, float $lng2 ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$lat1`**float**`$lng1`**float**`$lat2`**float**`$lng2`**float**---

Misc
----

[](#misc)

- Full name: \\Utility\\Misc

### abides

[](#abides-2)

Check if $data abides an array of $rules

```
Misc::abides( mixed $data, array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**array|callable**---

### abidesAny

[](#abidesany-2)

Check if $data abides any of an array of $rules

```
Misc::abidesAny( mixed $data, string|array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**string|array|callable**---

### add

[](#add-2)

Add mixed $data to other mixed data cleverly

```
Misc::add( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dd

[](#dd-2)

Dump $data and die

```
Misc::dd( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dump

[](#dump-2)

Dry dump $data for debug

```
Misc::dump( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### merge

[](#merge-2)

Merge mixed $data to other mixed data cleverly

```
Misc::merge( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### getShallowType

[](#getshallowtype-2)

Get a simplified type of a variable.

```
Misc::getShallowType( mixed $data ): string
```

Return values: string|array|object|number|boolean|unknown

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

Num
---

[](#num)

- Full name: \\Utility\\Num
- Parent class: \\Utility\\Misc

### abides

[](#abides-3)

Check if $data abides an array of $rules

```
Num::abides( mixed $data, array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**array|callable**---

### abidesAny

[](#abidesany-3)

Check if $data abides any of an array of $rules

```
Num::abidesAny( mixed $data, string|array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**string|array|callable**---

### add

[](#add-3)

Add mixed $data to other mixed data cleverly

```
Num::add( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dd

[](#dd-3)

Dump $data and die

```
Num::dd( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dump

[](#dump-3)

Dry dump $data for debug

```
Num::dump( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### merge

[](#merge-3)

Merge mixed $data to other mixed data cleverly

```
Num::merge( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### getShallowType

[](#getshallowtype-3)

Get a simplified type of a variable.

```
Num::getShallowType( mixed $data ): string
```

Return values: string|array|object|number|boolean|unknown

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### accord

[](#accord)

Parse the $plural or $singular or $none template of a $number

```
Num::accord( float $number, string $plural, string $singular, string $none = '' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$plural`**string**`$singular`**string**`$none`**string**---

### fileSize

[](#filesize)

Get filesize from $bytes

```
Num::fileSize( float $bytes, integer $decimals ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$bytes`**float**`$decimals`**integer**---

### format

[](#format)

Format $number

```
Num::format( float $number, integer $decimals, \Utility\string $decimalPoint = '.', \Utility\string $thousandSeparator = ',' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$decimals`**integer**`$decimalPoint`**\\Utility\\string**`$thousandSeparator`**\\Utility\\string**---

### isBetween

[](#isbetween)

Check if $number is between $min and $max

```
Num::isBetween( float $number, float $min, float $max = 1 ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$min`**float**`$max`**float**---

### isEven

[](#iseven)

Check if a $number is even

```
Num::isEven( float $number ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**---

### isNegative

[](#isnegative)

Check if a $number is negative

```
Num::isNegative( float $number ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**---

### isOdd

[](#isodd)

Check if a $number is odd

```
Num::isOdd( float $number ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**---

### isOutside

[](#isoutside)

Check if a $number is outside of $min and $max

```
Num::isOutside( float $number, float $min, float $max = 1 ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$min`**float**`$max`**float**---

### isPositive

[](#ispositive)

Check if a $number is positive

```
Num::isPositive( float $number, boolean $zeroIncluded = false ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$zeroIncluded`**boolean**---

### limit

[](#limit)

Limit $number to $min and $max values

```
Num::limit( float $number, float $min, float $max = 1 ): float
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$min`**float**`$max`**float**---

### max

[](#max-1)

Limit $number to a $max value

```
Num::max( float $number, float $max ): float
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$max`**float**---

### min

[](#min-1)

Limit $number to a $min value

```
Num::min( float $number, float $min ): float
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$min`**float**---

### ordinal

[](#ordinal)

Get the ordinal form of a $number using a $template

```
Num::ordinal( float $number, string $template = '%number&lt;sup&gt;%ordinal&lt;/sup&gt;' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$template`**string**---

### pad

[](#pad)

Pad a $number to a $length with $pad from a $direction

```
Num::pad( float $number, integer $length, string $pad = '0', string $direction = 'left' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$length`**integer**`$pad`**string**`$direction`**string**---

### percentOf

[](#percentof)

Check the percentage of $number relative to $normal

```
Num::percentOf( float $number, float $normal = 100 ): float
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**float**`$normal`**float**---

Obj
---

[](#obj)

- Full name: \\Utility\\Obj
- Parent class: \\Utility\\Collection

### get

[](#get-2)

Get a value of a $collection by a $key of $separator notation with $default fallback

```
Obj::get( array|object $collection, string $key = '', mixed $default = null, string $separator = '.' ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$key`**string**`$default`**mixed**`$separator`**string**---

### group

[](#group-2)

Group values from a $collection according to the results of a $callback

```
Obj::group( array|object $collection, callable $callback ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$callback`**callable**---

### keys

[](#keys-2)

Get keys from a $collection

```
Obj::keys( array|object $collection ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**---

### remove

[](#remove-2)

Remove a $key value in a $collection using $separator notation.

```
Obj::remove( array|object $collection, string|array $key, string $separator = '.' ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$key`**string|array**`$separator`**string**---

### set

[](#set-2)

Set a $value in a $collection using $separator notation.

```
Obj::set( array|object $collection, string $key, mixed $value, string $separator = '.' ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$key`**string**`$value`**mixed**`$separator`**string**---

### sort

[](#sort-2)

Sort a $collection by value, by a closure or by a property $sorter along a $direction

```
Obj::sort( array|object $collection, string $direction = 'ASC', null|callable|string $sorter = null ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$direction`**string**`$sorter`**null|callable|string**---

### sortKeys

[](#sortkeys-2)

Sort a $collection by keys or properties by $direction

```
Obj::sortKeys( array|object $collection, string $direction = 'ASC' ): array|object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**`$direction`**string**---

### values

[](#values-2)

Get values from a $collection

```
Obj::values( array|object $collection ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$collection`**array|object**---

### abides

[](#abides-4)

Check if $data abides an array of $rules

```
Obj::abides( mixed $data, array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**array|callable**---

### abidesAny

[](#abidesany-4)

Check if $data abides any of an array of $rules

```
Obj::abidesAny( mixed $data, string|array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**string|array|callable**---

### add

[](#add-4)

Add mixed $data to other mixed data cleverly

```
Obj::add( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dd

[](#dd-4)

Dump $data and die

```
Obj::dd( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dump

[](#dump-4)

Dry dump $data for debug

```
Obj::dump( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### merge

[](#merge-4)

Merge mixed $data to other mixed data cleverly

```
Obj::merge( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### getShallowType

[](#getshallowtype-4)

Get a simplified type of a variable.

```
Obj::getShallowType( mixed $data ): string
```

Return values: string|array|object|number|boolean|unknown

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### has

[](#has-1)

Check if an $object has a $key (property or method)

```
Obj::has(  $object, string $key ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$object`\*\*\*\*`$key`**string**---

### properties

[](#properties)

Get all properties from an $object

```
Obj::properties( object $object ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$object`**object**---

### methods

[](#methods)

Get all methods from an $object

```
Obj::methods( object $object ): null|array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$object`**object**---

### unpack

[](#unpack)

Unpack an $attribute from an $object

```
Obj::unpack( object $data, null|string $attribute = null ): object
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**object**`$attribute`**null|string**---

Str
---

[](#str)

- Full name: \\Utility\\Str
- Parent class: \\Utility\\Misc

### abides

[](#abides-5)

Check if $data abides an array of $rules

```
Str::abides( mixed $data, array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**array|callable**---

### abidesAny

[](#abidesany-5)

Check if $data abides any of an array of $rules

```
Str::abidesAny( mixed $data, string|array|callable $rules = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**`$rules`**string|array|callable**---

### add

[](#add-5)

Add mixed $data to other mixed data cleverly

```
Str::add( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dd

[](#dd-5)

Dump $data and die

```
Str::dd( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### dump

[](#dump-5)

Dry dump $data for debug

```
Str::dump( mixed $data ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### merge

[](#merge-5)

Merge mixed $data to other mixed data cleverly

```
Str::merge( mixed $data ): mixed
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### getShallowType

[](#getshallowtype-5)

Get a simplified type of a variable.

```
Str::getShallowType( mixed $data ): string
```

Return values: string|array|object|number|boolean|unknown

- This method is **static**. **Parameters:**

ParameterTypeDescription`$data`**mixed**---

### accord

[](#accord-1)

Get $plural or $singular string depending on $number

```
Str::accord( string|float $number, string $plural, string $singular, string $none = '' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**string|float**`$plural`**string**`$singular`**string**`$none`**string**---

### alpha

[](#alpha)

Convert a $string to alpha

```
Str::alpha( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### alphaNumeric

[](#alphanumeric)

Convert a $string to alpha numeric

```
Str::alphaNumeric( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### append

[](#append-1)

Add $append to $string at the end

```
Str::append( string $string, string $append ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$append`**string**---

### ascii

[](#ascii)

Convert a $string to ASCII removing all accents

```
Str::ascii( string $string, string $language = 'en', boolean $removeUnsupported = true ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$language`**string**`$removeUnsupported`**boolean**---

### at

[](#at)

Get character at a specific $index from a $string

```
Str::at( string $string, integer $index, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$index`**integer**`$encoding`**null|string**---

### base64

[](#base64)

Base 64 encode a $string

```
Str::base64( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### between

[](#between)

Get part of a $string between $start and $end substrings

```
Str::between( string $string, string $start, string $end, integer $offset, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$start`**string**`$end`**string**`$offset`**integer**`$encoding`**null|string**---

### bool

[](#bool)

Convert a $string to a bool

```
Str::bool( string $string, array $trueValues = array(), array $falseValues = array() ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$trueValues`**array**`$falseValues`**array**---

### camel

[](#camel)

Convert a $string to camelCase using a specific $language

```
Str::camel( string $string, string $language = '' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$language`**string**---

### chars

[](#chars)

Get all distinct characters of a $string as an array

```
Str::chars( string $string, null|string $encoding = null ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### clean

[](#clean-1)

Normalize and trim a $string

```
Str::clean( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### collapse

[](#collapse)

Ensure all white space characters only appear once in a $string

```
Str::collapse( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### common

[](#common)

Find a common sub string from $string and $otherString

```
Str::common( string $string, string $otherString, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$otherString`**string**`$encoding`**null|string**---

### commonPrefix

[](#commonprefix)

Find a common prefix from $string and $otherString

```
Str::commonPrefix( string $string, string $otherString, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$otherString`**string**`$encoding`**null|string**---

### commonSuffix

[](#commonsuffix)

Find a common suffix from $string and $otherString

```
Str::commonSuffix( string $string, string $otherString, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$otherString`**string**`$encoding`**null|string**---

### contains

[](#contains-1)

Check if $string contains $needle

```
Str::contains( string $string, string $needle, boolean $caseSensitive = false, null|string $encoding = null ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needle`**string**`$caseSensitive`**boolean**`$encoding`**null|string**---

### containsAll

[](#containsall-1)

Check if $string contains all substrings in a $needles array

```
Str::containsAll( string $string, array $needles, boolean $caseSensitive = false, null|string $encoding = null ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needles`**array**`$caseSensitive`**boolean**`$encoding`**null|string**---

### containsAny

[](#containsany-1)

Check if $string contains any substrings in a $needles array

```
Str::containsAny( string $string, array $needles, boolean $caseSensitive = false, null|string $encoding = null ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needles`**array**`$caseSensitive`**boolean**`$encoding`**null|string**---

### count

[](#count)

Count the characters in $string

```
Str::count( string $string, null|string $encoding = null ): integer
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### dashed

[](#dashed)

Delimit $string with dashes instead of spaces

```
Str::dashed( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### delimit

[](#delimit)

Connect words with $delimiter instead of spaces in $string

```
Str::delimit( string $string, string $delimiter, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$delimiter`**string**`$encoding`**null|string**---

### endsWith

[](#endswith)

Check if $string ends with $needle

```
Str::endsWith( string $string, string $needle, boolean $caseSensitive = false, null|string $encoding = null ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needle`**string**`$caseSensitive`**boolean**`$encoding`**null|string**---

### endsWithAny

[](#endswithany)

Check if $string ends with any of the $needles

```
Str::endsWithAny( string $string, array $needles, boolean $caseSensitive = false, null|string $encoding = null ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needles`**array**`$caseSensitive`**boolean**`$encoding`**null|string**---

### ensureLeft

[](#ensureleft)

Esnure $string starts with $ensure

```
Str::ensureLeft( string $string, string $ensure ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$ensure`**string**---

### ensureRight

[](#ensureright)

Ensure $string ends with $ensure

```
Str::ensureRight( string $string, string $ensure ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$ensure`**string**---

### fileSize

[](#filesize-1)

Return a formatted filesize from $bytes

```
Str::fileSize( float|string $bytes, integer $decimals ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$bytes`**float|string**`$decimals`**integer**---

### first

[](#first-1)

Get first $number characters from $string

```
Str::first( string $string, integer $number = 1, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$number`**integer**`$encoding`**null|string**---

### htmlDecode

[](#htmldecode)

HTML decode $string

```
Str::htmlDecode( string $string, string $flags = ENT_COMPAT, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$flags`**string**`$encoding`**null|string**---

### htmlEncode

[](#htmlencode)

HTML encode $string

```
Str::htmlEncode( string $string, string $flags = ENT_COMPAT, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$flags`**string**`$encoding`**null|string**---

### index

[](#index)

Get position of $needle within $string

```
Str::index( string $string, string $needle, integer $offset, null|string $encoding = null ): integer
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needle`**string**`$offset`**integer**`$encoding`**null|string**---

### indexes

[](#indexes)

Get all positions of $needle within $string

```
Str::indexes( string $string, string $needle, null|string $encoding = null ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needle`**string**`$encoding`**null|string**---

### insert

[](#insert)

Push $insert into $string at the $index character

```
Str::insert( string $string, string $insert, integer $index, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$insert`**string**`$index`**integer**`$encoding`**null|string**---

### isAlpha

[](#isalpha)

Check if $string is alfa

```
Str::isAlpha( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isAlphanumeric

[](#isalphanumeric)

Check if $string is alfa numeric

```
Str::isAlphanumeric( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isBase64

[](#isbase64)

Check if $string is base 64 encoded

```
Str::isBase64( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isBlank

[](#isblank)

Check if $string is empty or has only white space

```
Str::isBlank( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isEmail

[](#isemail)

Check if $string is a valid email

```
Str::isEmail( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isHexadecimal

[](#ishexadecimal)

Check if $string is hexadecimal

```
Str::isHexadecimal( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isHTML

[](#ishtml)

Check if $string contains HTML code

```
Str::isHTML( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isIP

[](#isip)

Check if $string is a valid IP address

```
Str::isIP( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isJSON

[](#isjson)

Check if $string is valid JSON

```
Str::isJSON( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isLower

[](#islower)

Check if $string is lower-case

```
Str::isLower( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isRegex

[](#isregex)

Check if $string is a valid regex

```
Str::isRegex( string $pattern ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$pattern`**string**---

### isSerialized

[](#isserialized)

Check if $string is serialized

```
Str::isSerialized( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isUpper

[](#isupper)

Check if $string is upper case

```
Str::isUpper( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### isURL

[](#isurl)

Check if $string is a valid URL

```
Str::isURL( string $string ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### last

[](#last-1)

Get the last $number characters of a $string

```
Str::last( string $string, integer $number = 1, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$number`**integer**`$encoding`**null|string**---

### lastIndex

[](#lastindex)

Get last position of $needle in $string

```
Str::lastIndex( string $string, string $needle, integer $offset, null|string $encoding = null ): integer
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needle`**string**`$offset`**integer**`$encoding`**null|string**---

### length

[](#length)

Count length of $string

```
Str::length( string $string, null|string $encoding = null ): integer
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### limit

[](#limit-1)

Safely truncate $string in $length

```
Str::limit( string $string, integer $length, string $append = '...', null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$length`**integer**`$append`**string**`$encoding`**null|string**---

### limitWords

[](#limitwords)

Limit $string to a $limit of words

```
Str::limitWords( string $string, integer $length, \Utility\string $append = '...' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$length`**integer**`$append`**\\Utility\\string**---

### lines

[](#lines)

Get an array of lines in $string

```
Str::lines( string $string, boolean $trimEachLine = false ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$trimEachLine`**boolean**---

### lower

[](#lower)

Convert $string to lower case

```
Str::lower( string $string, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### lowerFirst

[](#lowerfirst)

Convert the first character of each word in $string to lower case

```
Str::lowerFirst( string $string, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### matches

[](#matches-1)

Check if $string matches $pattern

```
Str::matches( string $string, string $pattern ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$pattern`**string**---

### normalize

[](#normalize-1)

Convert punctuation characters to a standardised, simpler version

```
Str::normalize( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### ordinal

[](#ordinal-1)

Get ordinal version of $number according to $template

```
Str::ordinal( string|float $number, string $template = '%number&lt;sup&gt;%ordinal&lt;/sup&gt;' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$number`**string|float**`$template`**string**---

### pad

[](#pad-1)

Add $pad to $string until it reaches $length

```
Str::pad( string $string, integer $length, string $pad = ' ', string $direction = 'right', null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$length`**integer**`$pad`**string**`$direction`**string**`$encoding`**null|string**---

### padBoth

[](#padboth)

Add $pad to both ends of a $string until it reaches $length

```
Str::padBoth( string $string, integer $length, string $pad = ' ', null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$length`**integer**`$pad`**string**`$encoding`**null|string**---

### padLeft

[](#padleft)

Add $pad to the left side of a $string until it reaches $length

```
Str::padLeft( string $string, integer $length, string $pad = ' ', null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$length`**integer**`$pad`**string**`$encoding`**null|string**---

### padRight

[](#padright)

Add $pad to the right side of a $string until it reaches $length

```
Str::padRight( string $string, integer $length, string $pad = ' ', null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$length`**integer**`$pad`**string**`$encoding`**null|string**---

### pascal

[](#pascal)

Convert $string to PascalCase

```
Str::pascal( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### prepend

[](#prepend-1)

Add $prepend at the beginning of $string

```
Str::prepend( string $string, string $prepend ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$prepend`**string**---

### random

[](#random-1)

Generate random or $readable random string of $length

```
Str::random( integer $length = 10, boolean $readable = true ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$length`**integer**`$readable`**boolean**---

### regexReplace

[](#regexreplace)

Replace $pattern with $replacement in $string

```
Str::regexReplace( string $string, string|array $pattern, string|array $replacement ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$pattern`**string|array**`$replacement`**string|array**---

### remove

[](#remove-3)

Remove $search pattern from $string

```
Str::remove( string $string, string $search ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$search`**string**---

### removeLeft

[](#removeleft)

Remove $needle from the beginning of $string

```
Str::removeLeft( string $string, string $needle, boolean $caseSensitive = false, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needle`**string**`$caseSensitive`**boolean**`$encoding`**null|string**---

### removeRight

[](#removeright)

Remove $needle from the end of $string

```
Str::removeRight( string $string, string $needle, boolean $caseSensitive = false, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needle`**string**`$caseSensitive`**boolean**`$encoding`**null|string**---

### repeat

[](#repeat-1)

Repeat $string $times

```
Str::repeat( string $string, \Utility\int $times ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$times`**\\Utility\\int**---

### replace

[](#replace-1)

Replace $search string with $replacement in $string

```
Str::replace( string $string, string $search, string $replacement ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$search`**string**`$replacement`**string**---

### reverse

[](#reverse-1)

Reverse the characters of $string

```
Str::reverse( string $string, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### shuffle

[](#shuffle)

Randomly shuffle the characters of $string

```
Str::shuffle( string $string, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### slice

[](#slice)

Cut $string from $start to $end

```
Str::slice( string $string, integer $start, null|integer $end = null, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$start`**integer**`$end`**null|integer**`$encoding`**null|string**---

### slug

[](#slug)

Convert $string to slug-case

```
Str::slug( string $string, string $language = 'en' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$language`**string**---

### slugify

[](#slugify)

Remove special characters and change whitespace characters with $delimiter in $string

```
Str::slugify( string $string, string $delimiter = '-', string $language = 'en' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$delimiter`**string**`$language`**string**---

### snake

[](#snake)

Convert $string to snake\_case

```
Str::snake( string $string, string $language = 'en' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$language`**string**---

### spacesToTabs

[](#spacestotabs)

Convert spaces to tabs in $string

```
Str::spacesToTabs( string $string, integer $tabLength = 4 ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$tabLength`**integer**---

### split

[](#split)

Split $string at $pattern

```
Str::split( string $string, string $pattern = '', null|integer $limit = null ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$pattern`**string**`$limit`**null|integer**---

### startsWith

[](#startswith)

Check if $string starts with $needle

```
Str::startsWith( string $string, string $needle, boolean $caseSensitive = false, null|string $encoding = null ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needle`**string**`$caseSensitive`**boolean**`$encoding`**null|string**---

### startsWithAny

[](#startswithany)

Check if $string starts with any $needles

```
Str::startsWithAny( string $string, array $needles, boolean $caseSensitive = false, null|string $encoding = null ): boolean
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needles`**array**`$caseSensitive`**boolean**`$encoding`**null|string**---

### stringReplace

[](#stringreplace)

Swap $search with $replacement in $string

```
Str::stringReplace( string $string, string $search, string $replacement ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$search`**string**`$replacement`**string**---

### stripWhitespace

[](#stripwhitespace)

Remove all white space characters from $string

```
Str::stripWhitespace( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### sub

[](#sub)

Cut $string from $start to a certain $length

```
Str::sub( string $string, integer $start, null|integer $length = null, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$start`**integer**`$length`**null|integer**`$encoding`**null|string**---

### tabsToSpaces

[](#tabstospaces)

Convert tabs to spaces in $string

```
Str::tabsToSpaces( string $string,  $tabLength = 4 ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$tabLength`\*\*\*\*---

### template

[](#template)

Replace template variables in $string according to associate $data array

```
Str::template( string $string, array $data = array(), string $varSymbol = '%' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$data`**array**`$varSymbol`**string**---

### timesContains

[](#timescontains)

Count how many times $string contains $needle

```
Str::timesContains( string $string, string $needle, boolean $caseSensitive = false, null|string $encoding = null ): integer
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$needle`**string**`$caseSensitive`**boolean**`$encoding`**null|string**---

### title

[](#title)

Convert $string to Title Case

```
Str::title( string $string, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### titlize

[](#titlize)

Convert $string to Title Case with an $ignore list of words that would not be converted to uppercase

```
Str::titlize( string $string, array $ignore = array(), null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$ignore`**array**`$encoding`**null|string**---

### trim

[](#trim)

Trim $characters from each end of a $string

```
Str::trim( string $string, string $characters = ' ' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$characters`**string**---

### trimLeft

[](#trimleft)

Trim $characters from the left side of $string

```
Str::trimLeft( string $string, string $characters = ' ' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$characters`**string**---

### trimRight

[](#trimright)

Trim $characters from the right side of $string

```
Str::trimRight( string $string, string $characters = ' ' ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$characters`**string**---

### underscored

[](#underscored)

Replace spaces with \_ (underscores) in $string

```
Str::underscored( string $string ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**---

### upper

[](#upper)

Convert string to UPPER CASE

```
Str::upper( string $string, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### upperFirst

[](#upperfirst)

Upper Case first character of each word in $string

```
Str::upperFirst( string $string, null|string $encoding = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$encoding`**null|string**---

### words

[](#words)

Get an array of words from $string

```
Str::words( string $string, boolean $unique = true ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$string`**string**`$unique`**boolean**---

URL
---

[](#url)

- Full name: \\Utility\\URL

### auth

[](#auth)

Add $user and $pass to a $url

```
URL::auth( null|string|array $url, string $user, null|string $pass = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$user`**string**`$pass`**null|string**---

### build

[](#build)

Build a URL from a parsed array

```
URL::build( array $url ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**array**---

### current

[](#current)

Get the current URL or its $parts

```
URL::current( array $parts = array() ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$parts`**array**---

### fragment

[](#fragment)

Get or $set the fragment of a $url

```
URL::fragment( null|string|array $url, null|string $set = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$set`**null|string**---

### fragmentSet

[](#fragmentset)

Set $fragment part of a $url

```
URL::fragmentSet( null|string|array $url, string $fragment ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$fragment`**string**---

### host

[](#host)

Get or $set the host of a $url

```
URL::host( null|string|array $url, null|string $set = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$set`**null|string**---

### hostSet

[](#hostset)

Set $host part of a $url

```
URL::hostSet( null|string|array $url, string $host ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$host`**string**---

### parse

[](#parse)

Consistently parse $url

```
URL::parse( string $url ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**string**---

### parts

[](#parts)

Get $parts of a $url

```
URL::parts( null|string|array $url,  $parts = array('scheme', 'host', 'path') ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$parts`\*\*\*\*---

### pass

[](#pass)

Get the pass part of a $url

```
URL::pass( null|string|array $url ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**---

### path

[](#path)

Get or $set the path of a $url

```
URL::path( null|string|array $url, null|string $set = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$set`**null|string**---

### pathRemove

[](#pathremove)

Remove $search string or pattern from $url path

```
URL::pathRemove( null|string|array $url, \Utility\string $search ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$search`**\\Utility\\string**---

### pathSet

[](#pathset)

Set $path part of a $url

```
URL::pathSet( null|string|array $url, null|string $path ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$path`**null|string**---

### port

[](#port)

Get or $set the port of a $url

```
URL::port( null|string|array $url, boolean $set = false ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$set`**boolean**---

### portSet

[](#portset)

Set $port part of a $url

```
URL::portSet( null|string|array $url, string|integer $port ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$port`**string|integer**---

### query

[](#query)

Get or $set the query of a $url

```
URL::query( null|string|array $url, boolean $set = false ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$set`**boolean**---

### queryAdd

[](#queryadd)

Add a parameter $key and $value to the query of the $url

```
URL::queryAdd( null|string|array $url, string $key, mixed $value ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$key`**string**`$value`**mixed**---

### queryArray

[](#queryarray)

Get the array of query args from a $url

```
URL::queryArray( null|string|array $url ): array
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**---

### queryGet

[](#queryget)

Get a query parameter from a URL

```
URL::queryGet( null|string|array $url, string $parameter ): string|null
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$parameter`**string**---

### queryRemove

[](#queryremove)

Remove a parameter by $key from the query of the $url

```
URL::queryRemove( null|string|array $url,  $keys ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$keys`\*\*\*\*---

### querySet

[](#queryset)

Set the $url path part to $data

```
URL::querySet( null|string|array $url, string|array $data ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$data`**string|array**---

### scheme

[](#scheme)

Get or $set the scheme of a $url

```
URL::scheme( null|string|array $url, null|string $set = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$set`**null|string**---

### schemeSet

[](#schemeset)

Set $scheme part of a $url

```
URL::schemeSet( null|string|array $url, null|string $scheme ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$scheme`**null|string**---

### user

[](#user)

Get the user part of a $url

```
URL::user( null|string|array $url, null|string $set = null ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**null|string|array**`$set`**null|string**---

---

> This document was automatically generated from source code comments on 2019-08-07 using [phpDocumentor](http://www.phpdoc.org/) and [cvuorinen/phpdoc-markdown-public](https://github.com/cvuorinen/phpdoc-markdown-public)

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~61 days

Recently: every ~76 days

Total

6

Last Release

2519d ago

Major Versions

0.0.9 → 1.0.02019-08-07

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6638176?v=4)[Arpad Hegedus](/maintainers/arpadhegedus)[@arpadHegedus](https://github.com/arpadHegedus)

---

Top Contributors

[![arpadHegedus](https://avatars.githubusercontent.com/u/6638176?v=4)](https://github.com/arpadHegedus "arpadHegedus (20 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/arpadhegedus-utility/health.svg)

```
[![Health](https://phpackages.com/badges/arpadhegedus-utility/health.svg)](https://phpackages.com/packages/arpadhegedus-utility)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
