Download the PHP package thorough-php/arrays without Composer

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

Array Extensions

Build Status Coverage Status License: MIT PHPStan

This is a collection of array wrappers.

Table of Contents =================

Composite Key Array

Sometimes it is useful to have ability to access nested value with one, array like, key (some questions were asked about this: on quora, on stackoverflow).

CompositeKeyArray class gives you the ability to do all basic array operations using array-like (nested) key. It implemets ArrayAccess interface:

1. offsetExists:

You can check nested keys for existance.

2. offsetGet:

You can get value by nested key. If nested key is not set the UndefinedOffsetException will be thrown.

3. offsetSet:

You can set value for nested key.

There is one pitfall. When you try to do $array['foo']['bar'] = 'baz' you get Indirect modification of overloaded element of CompositeKeyArray has no effect. The reason was explained here. So in order to achive the desired result you have to do the following:

But there is another edge case left: when you need to append element at the end of an array.

4. offsetUnset:

You can unset nested key.

After nested manipulations you might want to get back the real array. This can be done by calling $array->toArray().

XPath Key Array

This is not a real xpath! This class instead of array-like key users string of keys delimited with /.

This one was inspired by an old article.

Compared to CompositeKeyArray, XPathKeyArray has some limitations:

  1. You cannot use keys with / in them.
  2. You cannot use null as key.

Dotted Key Array

This class instead of array-like key users string of keys delimited with ..

Compared to CompositeKeyArray, DottedKeyArray has some limitations:

  1. You cannot use keys with . in them.
  2. You cannot use null as key.

One-off Array

Sometimes you want to get value from an array by key and unset this key after that. The OneOffArray class helps you with this.

Again this class can be used in combination with CompositeKeyArray or its descendents: XPathKeyArray or DottedKeyArray. Actually, it can be used in combination with any object that implemets ArrayAccess.

Write-once Array

If you want to be sure that each offset in your array would be written only once you can use WriteOnceArray. If you try to set one particular offset more than one time IllegalOffsetException will be thrown:

Because offsetExists method is used in order to ensure write-once behaviour, offsetUnset method call is illegal:


All versions of arrays with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
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 thorough-php/arrays contains the following files

Loading the files please wait ....