Download the PHP package parfumix/arrayy without Composer

On this page you can find all versions of the php package parfumix/arrayy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package arrayy

Stories in Ready Build Status Coverage Status codecov.io Scrutinizer Code Quality Codacy Badge SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version PHP 7 ready License

documentation via gitbooks.io

A PHP array manipulation library. Compatible with PHP 5.3+, PHP 7, and HHVM.

Installation via "composer require"

Installation via composer (manually)

If you're using Composer to manage dependencies, you can include the following in your composer.json file:

Then, after running composer update or php composer.phar update, you can load the class using Composer's autoloading:

And in either case, I'd suggest using an alias.

Multidimensional ArrayAccess

You can access / change the array via Object, Array or with "Arrayy"-syntax.

Access via "Arrayy"-syntax: (dot-notation)

-- Recommended --

Access via "array"-syntax:

Access via "object"-syntax:

Set values via "Arrayy"-syntax: (dot-notation)

-- Recommended --

Set values via "array"-syntax:

Set values via "object"-syntax:

OO and Chaining

The library offers OO method chaining, as seen below:

Implemented Interfaces

Arrayy\Arrayy implements the IteratorAggregate interface, meaning that foreach can be used with an instance of the class:

It implements the Countable interface, enabling the use of count() to retrieve the number of elements in the array:

PHP 5.6 Creation

As of PHP 5.6, use function is available for importing functions. Arrayy exposes a namespaced function, Arrayy\create, which emits the same behaviour as Arrayy\Arrayy::create(). If running PHP 5.6, or another runtime that supports the use function syntax, you can take advantage of an even simpler API as seen below:

StaticArrayy

All methods listed under "Instance methods" are available as part of a static wrapper.

Class methods

use a "default object"

Creates an Arrayy object.

create(array $array) : Arrayy (Immutable)

Creates an Arrayy object, via static "create()"-method

createByReference(array &$array) : Arrayy (Mutable)

WARNING: Creates an Arrayy object by reference.

createFromJson(string $json) : Arrayy (Immutable)

Create an new Arrayy object via JSON.

createFromObject(ArrayAccess $object) : Arrayy (Immutable)

Create an new instance filled with values from an object that have implemented ArrayAccess.

createFromObjectVars(\object $object) : Arrayy (Immutable)

Create an new instance filled with values from an object.

createWithRange() : Arrayy (Immutable)

Create an new instance containing a range of elements.

createFromString(string $str) : Arrayy (Immutable)

Create an new Arrayy object via string.

Instance Methods

Arrayy: All examples below make use of PHP 5.6 function importing, and PHP 5.4 short array syntax. For further details, see the documentation for the create method above, as well as the notes on PHP 5.6 creation.

"set an array value"
"get an array value"
"get the array"
"delete an array value"
"check if an array value is-set"
"simple loop with an Arrayy-object"
append(mixed $value) : Arrayy (Mutable)

Append a value to the current array.

alias: "Arrayy->add()"

prepend(mixed $value) : Arrayy (Mutable)

Prepend a value to the current array.

at(Closure $closure) : Arrayy (Immutable)

Iterate over the current array and execute a callback for each loop.

average(int $decimals) : int|double

Returns the average value of the current array.

chunk(int $size, bool $preserveKeys) : Arrayy (Immutable)

Create a chunked version of the current array.

clean() : Arrayy (Immutable)

Clean all falsy values from the current array.

clear() : Arrayy (Mutable)

WARNING!!! -> Clear the current array.

customSortKeys($function) : Arrayy (Mutable)

Custom sort by index via "uksort".

customSortValues($function) : Arrayy (Mutable)

Custom sort by value via "usort".

contains(string|int|float $value) : boolean

Check if an item is in the current array.

alias: "Arrayy->containsValue()"

containsValues(array $values) : boolean

Check if all given needles are present in the array.

containsKey(string|int|float $key) : boolean

Check if the given key/index exists in the array.

containsKeys(array $key) : boolean

Check if all given needles are present in the array as key/index.

containsCaseInsensitive(string $value) : boolean

Check if an (case-insensitive) string is in the current array.

diff(array $array) : Arrayy (Immutable)

Return values that are only in the current array.

diffReverse(array $array) : Arrayy (Immutable)

Return values that are only in the new $array.

diffRecursive(array $array, null|array $helperVariableForRecursion) : Arrayy (Immutable)

Return values that are only in the current multi-dimensional array.

divide() : Arrayy (Immutable)

Divide an array into two arrays. One with keys and the other with values.

each(Closure $closure) : Arrayy (Immutable)

Iterate over the current array and modify the array's value.

exists(Closure $closure) : boolean
filter(Closure|null $closure) : Arrayy (Immutable)

Find all items in an array that pass the truth test.

filterBy() : Arrayy (Immutable)

Filters an array of objects (or a numeric array of associative arrays) based on the value of a particular property within that.

find(Closure $closure) : mixed

Find the first item in an array that passes the truth test, otherwise return false.

first() : mixed

Get the first value from the current array and return null if there wasn't a element.

firstsMutable(null|int $take) : Arrayy (Mutable)

Get the first value(s) from the current array.

firstsImmutable(null|int $take) : Arrayy (Immutable)

Get the first value(s) from the current array.

flip() : Arrayy (Immutable)

Exchanges all keys with their associated values in an array.

get(string $key, [null $default], [null $array]) : mixed

Get a value from an array (optional using dot-notation).

getColumn(mixed $columnKey, mixed $indexKey) : Arrayy

Returns the values from a single column of the input array, identified by the $columnKey, can be used to extract data-columns from multi-arrays.

getIterator()

Returns a new ArrayyIterator, thus implementing the IteratorAggregate interface.

implode(string $with) : string

Implodes an array.

initial(int $to) : Arrayy (Immutable)

Get everything but the last..$to items.

intersection(array $search) : Arrayy (Immutable)

Return an array with all elements found in input array.

intersects(array $search) : boolean

Return a boolean flag which indicates whether the two input arrays have any common elements.

isAssoc() : boolean

Check if we have named keys in the current array.

isEqual() : boolean

Check if we have named keys in the current array.

isMultiArray() : boolean

Check if the current array is a multi-array.

isSequential() : boolean

Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not.

keys() : Arrayy (Immutable)

Get all keys from the current array.

alias: "Arrayy->getKeys()"

last() : mixed

Get the last value from the current array.

lastsImmutable(null|int $take) : Arrayy (Immutable)

Get the last value(s) from the current array.

lastsMutable(null|int $take) : Arrayy (Mutable)

Get the last value(s) from the current array.

length() : int

Count the values from the current array.

alias: "Arrayy->count()" || "Arrayy->size()"

max() : mixed

Get the max value from an array.

matches(Closure $closure) : boolean

Check if all items in an array match a truth test.

matchesAny(Closure $closure) : boolean

Check if any item in an array matches a truth test.

mergeAppendKeepIndex(array $array) : Arrayy (Immutable)

Merge the new $array into the current array.

mergePrependKeepIndex(array $array) : Arrayy (Immutable)

Merge the the current array into the $array.

mergeAppendNewIndex(array $array) : Arrayy (Immutable)

Merge the new $array into the current array.

mergePrependNewIndex(array $array) : Arrayy (Immutable)

Merge the current array into the new $array.

min() : mixed

Get the min value from an array.

moveElement(int|string $from, int|string $to) : Arrayy

Move an array element to a new index.

randomKey() : mixed

Pick a random key/index from the keys of this array.

alias: "Arrayy->getRandomKey()"

randomKeys() : Arrayy (Immutable)

Pick a given number of random keys/indexes out of this array.

alias: "Arrayy->getRandomKeys()"

randomValue() : mixed

Pick a random value from the values of this array.

alias: "Arrayy->getRandomValue()"

randomValues() : Arrayy (Immutable)

Pick a given number of random values out of this array.

alias: "Arrayy->getRandomValues()"

randomImmutable(int|null $take) : Arrayy (Immutable)

Get a random string from an array.

alias: "Arrayy->getRandom()"

randomMutable(int|null $take) : Arrayy (Mutable)

Get a random string from an array.

randomWeighted(array $array, int|null $take) : Arrayy (Immutable)

Get a random value from an array, with the ability to skew the results.

reduce(callable $predicate, array $init) : Arrayy (Immutable)

Reduce the current array via callable e.g. anonymous-function.

reindex() : Arrayy (Mutable)

Create a numerically re-indexed Arrayy object.

reject(Closure $closure) : Arrayy (Immutable)

Return all items that fail the truth test.

remove(mixed $key) : (Immutable)

Remove a value from the current array (optional using dot-notation).

removeFirst() : Arrayy (Immutable)

Remove the first value from the current array.

removeLast() : Arrayy (Immutable)

Remove the last value from the current array.

removeValue(mixed $value) : Arrayy (Immutable)

Removes a particular value from an array (numeric or associative).

replace(array $keys) : Arrayy (Immutable)

Replace a key with a new key/value pair.

replaceAllKeys(array $keys) : Arrayy (Immutable)

Create an array using the current array as values and the other array as keys.

replaceAllValues(array $array) : Arrayy (Immutable)

Create an array using the current array as keys and the other array as values.

replaceKeys(array $keys) : Arrayy (Immutable)

Replace the keys in an array with another set.

WARNING: An array of keys must matching the array's size and order!

replaceOneValue(mixed $search, mixed $replacement) : Arrayy (Immutable)

Replace the first matched value in an array.

replaceValues(string $search, string $replacement) : Arrayy (Immutable)

Replace values in the current array.

rest(int $from) : Arrayy (Immutable)

Get the last elements from index $from until the end of this array.

reverse() : Arrayy (Mutable)

Return the array in the reverse order.

searchIndex(mixed $value) : mixed

Search for the first index of the current array via $value.

searchValue(mixed $index) : Arrayy (Immutable)

Search for the value of the current array via $index.

set(mixed $key, mixed $value) : Arrayy (Immutable)

Set a value for the current array (optional using dot-notation).

setAndGet()

Get a value from a array and set it if it was not.

WARNING: this method only set the value, if the $key is not already set

serialize() : string

Serialize the current arrayy-object.

unserialize(string $string) : Arrayy (Mutable)

Unserialize an string and return this object.

sort(string|int(SORT_ASC) $direction, int(SORT_REGULAR) $strategy, bool(false) $keepKeys) : Arrayy (Mutable)

Sort the current array and optional you can keep the keys.

sorter(null|callable $sorter, string|int(SORT_ASC) $direction, int(SORT_REGULAR) $strategy) : Arrayy (Immutable)

Sort a array by value, by a closure or by a property.

sortKeys(string|int(SORT_ASC) $direction) : Arrayy (Mutable)

Sort the current array by key by $direction = 'asc' or $direction = 'desc'.

sortValueNewIndex(string|int(SORT_ASC) $direction, int(SORT_REGULAR) $strategy) : Arrayy (Immutable)

Sort the current array by value.

sortValueKeepIndex(string|int(SORT_ASC) $direction, int(SORT_REGULAR) $strategy) : Arrayy (Immutable)

Sort the current array by value.

split(int(2) $numberOfPieces, bool(false) $keepKeys) : Arrayy (Immutable)

Split an array in the given amount of pieces.

stripEmpty() : Arrayy (Immutable)

Stripe all empty items.

swap(string|int $swapA, string|int $swapB) : Arrayy (Immutable)

Swap two values between positions by key.

shuffle() : Arrayy (Immutable)

Shuffle the current array.

toJson() : string

Convert the current array to JSON.

uniqueNewIndex() : Arrayy (Mutable)

Return a duplicate free copy of the current array.

uniqueKeepIndex() : Arrayy (Mutable)

Return a duplicate free copy of the current array.

values() : Arrayy (Immutable)

Get all values from a array.

walk() : Arrayy (Mutable)

Apply the given function to every element in the array, discarding the results.

Tests

From the project directory, tests can be ran using phpunit

License

Released under the MIT License - see LICENSE.txt for details.


All versions of arrayy with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
voku/portable-utf8 Version ~3.1
ramsey/array_column Version ~1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package parfumix/arrayy contains the following files

Loading the files please wait ....