Download the PHP package mulertech/collections without Composer

On this page you can find all versions of the php package mulertech/collections. 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 collections

Collections


Latest Version on Packagist GitHub Tests Action Status GitHub PHPStan Action Status Total Downloads Test Coverage


This is a simple collections package for PHP. It provides a set of methods to work with arrays in a more functional way.

Installation

Two methods to install Collections package with composer :

1. Add to your "composer.json" file into require section :

and run the command :

2. Run the command :


Usage

__construct(array $items = []) : Initializes a new collection with the provided items.

all(callable $callback): bool : Checks if all items in the collection satisfy the callback.

any(callable $callback): bool : Checks if at least one item in the collection satisfies the callback.

arsort(int $sortFlags = SORT_REGULAR): void : Sorts the items in the collection in descending order while maintaining key association.

asort(int $sortFlags = SORT_REGULAR): void : Sorts the items in the collection in ascending order while maintaining key association.

changeKeyCase(int $case = CASE_LOWER): void : Changes the case of all keys in the collection.

chunk(int $length, bool $preserveKeys = false): array : Splits the collection into chunks of the specified size.

column(int|string|null $columnKey, int|string|null $indexKey = null): array : Returns the values from a single column of the collection.

combine(array $keys, array $values): void : Creates a new collection using the provided keys and values.

contains(mixed $value): bool : Checks if a value exists in the collection.

count(int $mode = COUNT_NORMAL): int : Counts the number of items in the collection.

countValues(): array : Counts the values of the collection.

current(): mixed : Returns the current item in the collection.

diff(array ...$arrays): array : Computes the difference between the collection and the provided arrays.

diffAssoc(array ...$arrays): array : Computes the difference with the provided arrays by comparing keys and values.

diffKey(array ...$arrays): array : Computes the difference with the provided arrays by comparing only keys.

diffUassoc(callable $callback, array ...$arrays): array : Computes the difference with the provided arrays using a callback function for keys.

diffUkey(callable $callback, array ...$arrays): array : Computes the difference with the provided arrays using a callback function for keys.

end(): mixed : Returns the last item in the collection.

extract(int $flags = EXTR_OVERWRITE, string $prefix = ''): int : Extracts variables from the collection.

fill(int $startIndex, int $count, mixed $value): void : Fills the collection with a specified value.

fillKeys(array $keys, mixed $value): void : Fills the collection with the specified keys and value.

filter(?callable $callback = null, int $mode = 0): void : Filters the items in the collection using a callback.

find(callable $callback): mixed : Finds the first item that satisfies the callback.

findKey(callable $callback): mixed : Finds the key of the first item that satisfies the callback.

flip(): void : Exchanges the keys and values of the collection.

getIterator(): Traversable : Returns an external iterator for the collection, allowing it to be used in foreach loops.

// Output: // Key: 0, Value: 1 // Key: 1, Value: 2 // Key: 2, Value: 3

inArray(mixed $needle, bool $strict = false): bool : Checks if a value exists in the collection.

intersect(array ...$arrays): array : Computes the intersection of the collection with the provided arrays.

intersectAssoc(array ...$arrays): array : Computes the intersection with the provided arrays by comparing keys and values.

intersectKey(array ...$arrays): array : Computes the intersection with the provided arrays by comparing only keys.

intersectUassoc(callable $callback, array ...$arrays): array : Computes the intersection with the provided arrays using a callback function for keys.

intersectUkey(callable $callback, array ...$arrays): array : Computes the intersection with the provided arrays using a callback function for keys.

isList(): bool : Checks if the collection is a list.

items(): array : Returns the items in the collection.

key(): int|string|null : Returns the key of the current item.

keyExists(mixed $key): bool : Checks if a key exists in the collection.

keyFirst(): int|string|null : Returns the first key of the collection.

keyLast(): int|string|null : Returns the last key of the collection.

keys(mixed $filterValue = null, bool $strict = false): array : Returns all keys in the collection.

krsort(int $sortFlags = SORT_REGULAR): void : Sorts the keys of the collection in descending order.

ksort(int $sortFlags = SORT_REGULAR): void : Sorts the keys of the collection in ascending order.

map(callable $callback, array ...$arrays): void : Applies a function to each item in the collection.

merge(array ...$arrays): void : Merges the collection with the provided arrays.

mergeRecursive(array ...$arrays): void : Recursively merges the collection with the provided arrays.

multisort(mixed $sortOrder = SORT_ASC, mixed $sortFlags = SORT_REGULAR, mixed ...$rest): void : Sorts the collection using multiple criteria.

natcasesort(): void : Sorts the collection using a case-insensitive natural order algorithm.

natsort(): void : Sorts the collection using a natural order algorithm.

next(): mixed : Advances the internal pointer of the collection and returns the next item.

pad(int $length, mixed $value): void : Pads the collection to the specified length with a value.

pop(): mixed : Pops and returns the last item of the collection.

prev(): mixed : Rewinds the internal pointer of the collection and returns the previous item.

product(): int|float : Computes the product of the values in the collection.

push(mixed ...$values): void : Pushes one or more items onto the end of the collection.

rand(int $num = 1): int|string|array : Selects one or more random items from the collection.

range(string|int|float $start, string|int|float $end, int|float $step = 1): void : Creates a collection containing a range of elements.

reduce(callable $callback, mixed $initial = null): mixed : Reduces the collection to a single value using a callback.

remove(int|string $key): void : Removes an item from the collection by its key.

removeItem(mixed $item, bool $strict = true): bool : Removes an item from the collection by its value and returns whether the item was found and removed.

replace(array ...$replacements): void : Replaces the items in the collection with the items from the provided arrays.

replaceRecursive(array ...$replacements): void : Recursively replaces the items in the collection with the items from the provided arrays.

reset(): mixed : Resets the internal pointer of the collection and returns the first item.

reverse(bool $preserveKeys = false): void : Reverses the order of the items in the collection.

rsort(int $sortFlags = SORT_REGULAR): void : Sorts the collection in descending order.

search(mixed $needle, bool $strict = false): int|string|false : Searches for a value in the collection and returns the corresponding key.

shift(): mixed : Shifts and returns the first item of the collection.

shuffle(): void : Shuffles the items in the collection.

slice(int $offset, ?int $length = null, bool $preserveKeys = false): array : Extracts a slice of the collection.

sort(int $sortFlags = SORT_REGULAR): void : Sorts the collection in ascending order.

splice(int $offset, ?int $length = null, mixed $replacement = []): void : Removes a portion of the collection and replaces it with the provided items.

sum(): int|float : Computes the sum of the values in the collection.

uasort(callable $callback): void : Sorts the collection using a user-defined comparison function.

udiff(callable $callback, array ...$arrays): array : Computes the difference between the collection and the provided arrays using a callback function.

udiffAssoc(callable $callback, array ...$arrays): array : Computes the difference with the provided arrays using a callback function for values.

udiffUassoc(callable $valueCallback, callable $keyCallback, array ...$arrays): array : Computes the difference with the provided arrays using callback functions for values and keys.

uintersect(callable $callback, array ...$arrays): array : Computes the intersection of the collection with the provided arrays using a callback function.

uintersectAssoc(callable $callback, array ...$arrays): array : Computes the intersection with the provided arrays using a callback function for values.

uintersectUassoc(callable $valueCallback, callable $keyCallback, array ...$arrays): array : Computes the intersection with the provided arrays using callback functions for values and keys.

uksort(callable $callback): void : Sorts the collection by keys using a user-defined comparison function.

unique(int $sortFlags = SORT_STRING): void : Removes duplicate values from the collection.

unshift(mixed ...$values): int : Unshifts one or more items onto the beginning of the collection.

usort(callable $callback): void : Sorts the collection using a user-defined comparison function.

values(): array : Returns all values in the collection.

walk(callable $callback, mixed $arg = null): void : Applies a function to each item in the collection.

walkRecursive(callable $callback, mixed $arg = null): void : Recursively applies a function to each item in the collection.

`


All versions of collections with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
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 mulertech/collections contains the following files

Loading the files please wait ....