Download the PHP package graze/array-merger without Composer

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

Array Merger

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads

Array Merger allows you to recursively merge arrays and choose how the values should be merged.

Merge

Why

The php function: array_merge_recursive does indeed merge arrays, but it converts values with duplicate keys to arrays rather than overwriting the value in the first array with the duplicate value in the second array, as array_merge does. I.e., with array_merge_recursive, this happens (documented behaviour).

There is also array_replace_recursive which replaces values in the first with values in the second, but it handles value arrays differently and only supports replacing with the last value.

This library gives you the flexibility to ensure you get the values you actually want in the merge.

Install

Via Composer

Value Mergers

Usage

There is an ArrayMerger which will only merge at the top level, and a RecursiveArrayMerger which will merge recursively.

The mergers can take any number of arguments, and will treat the first argument as the base array to merge the subsequent arrays into.

Supplying a Value Merger

By default the last value will be used when merging, however you can supply a different Value Merger to change the behaviour of the merged value.

The Value Merger is a callable that can take 2 arguments. This allows you to use in-built and in-line functions:

Calling Statically

You can call merge statically and specify the Value Merger of your choice:

Each of the supplied value mergers also have static helper methods to call them:

Value Arrays

By default value arrays (arrays with no indexes supplied) will be appended onto each other, if you want to treat them as associative arrays, you can supply this flag: RecursiveArrayMerger::FLAG_MERGE_VALUE_ARRAY.

Unique Values

By default, when we append value arrays it will keep duplicate values. If you want to remove the duplicate values you can supply the flag: RecursiveArrayMerger::FLAG_UNIQUE_VALUE_ARRAY. This flag will only be relevant if the RecursiveArrayMerger::FLAG_MERGE_VALUE_ARRAY flag is not supplied.

Testing

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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


All versions of array-merger 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 graze/array-merger contains the following files

Loading the files please wait ....