Download the PHP package bkvfoundry/utility-belt without Composer

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

Deprecated

UPDATE!: UtilityBelt has a new home at Rex Labs

Please update your projects to use the new package as it will no longer be maintained under the bkvfoundry repository

UtilityBelt

Build Status Coverage Status

Every time we start a new php project that requires even a small amount of data wrangling, we find ourselves re-writing the same helper functions over and over again.

This package provides some key functions that make it easier to perform common tasks like:

These functions are all provided without pulling in any heavy framework dependencies or third party packages.

Installation

Install the latest version with

CollectionUtility

filterWhere / filterWhereNot

(array $items, array $properties)

Some extremely common functionality involves filtering collections (arrays of rows) based on a property list. The code required for this via array_filter tends to become fairly bloated and makes the purpose of the underlying code harder to understand. These functions provide a simpler way to perform these kinds of filters.

All comparisons below can be run as case insensitive or strict checks.

findWhere / findWhereNot

(array $items, array $properties)

Similar to the filter methods but returns the first matching result and optionally the key where it was found.

groupByProperty / keyByProperty

(array $array, $key)

Re-organises rows in a collection under the values of one or more properties.

The difference between the two methods is that key by property allows for only a single row per property in the result while grouping will return an array of collections.

sort / asort

(array $array, $property, $sort_direction = self::SORT_DIRECTION_ASCENDING, $sort_flags=SORT_REGULAR)

Sort a collection using a property or nested property

keepKeys

(array $array, array $keys, $removal_action = CollectionUtility::REMOVAL_ACTION_DELETE)

Remove (or nullify) all keys in each collection item except for those specified in the keys arg

removeKeys

(array $array, array $keys, $removal_action = CollectionUtility::REMOVAL_ACTION_DELETE)

Remove (or nullify) any keys provided in the $keys argument in each collection item.

random

(array $array)

Get a random item from an array

shuffle

(array $array)

Shuffle an array and return the result

ArrayUtility

dotRead

(array $array, $property, $default_value=null)

dotWrite

(array $array, $property, $value)

Original array:

Return a new array containing the updated property:

Array is now:

Set new properties:

Array is now:

dotMutate

(array $array, $property, $value)

This method is similar to dotWrite() except the array is passed by reference so that property changes directly mutate the given array.

Original array:

Mutate the array with the updated property:

Array is now:

Set new properties:

Array is now:

flatten / inflate

(array $array)

isAssoc

(array $array)

Quick test to determine whether an array is associative or not.

keepKeys

(array $array, array $keys, ArrayUtility::REMOVAL_ACTION_DELETE)

Same as CollectionUtility::keepKeys but operates on a basic array instead of a collection of arrays.

removeKeys

(array $array, array $keys, ArrayUtility::REMOVAL_ACTION_DELETE)

Same as CollectionUtility::removeKeys but operates on a basic array instead of a collection of arrays.

mapRecursive

(array $array, callable $callback, $map_arrays = false)

Like array walk recursive but doesn't mutate the array. Also, callback receives three arguments: $value, $key, $array

map

(array $array, callable $callback)

Like array_map but the callback receives three arguments: $value, $key, $array

first

(array $array)

Returns the first element from an array. More useful than reset() because it can handle the result of a function.

last

(array $array)

Returns the last element from an array. More useful than end() because it can handle the result of a function.

firstKey

(array $array)

Returns the key of the first element in an array.

lastKey

(array $array)

Returns the key of the last element in an array.

Install

Install UtilityBelt using Composer.

Testing

UtilityBelt has a PHPUnit test suite. To run the tests, run the following command from the project folder.

Credits

License

The MIT License (MIT). Please see LICENSE for more information.


All versions of utility-belt with dependencies

PHP Build Version
Package Version
Requires php Version ^5.5 || ^7.0
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 bkvfoundry/utility-belt contains the following files

Loading the files please wait ....