Download the PHP package bartoszbartniczak/array-object without Composer

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

BartoszBartniczak/ArrayOfObjects Build Status Coverage Status

ArrayOfObjects is the extension of the SPL ArrayObject concept. ArrayOfObjects may contain only objects of given type.

Table of contents:

  1. Class ArrayObject
  2. Class ArrayOfObjects
  3. Tests

Class ArrayObject

Methods:

filter()

Iterates over each value in the array passing them to the callback function. If the callback function returns true, the current value from array is returned into the result ArrayObject. Array keys are preserved.

shift()

Shifts an element off the beginning of array.

pop()

Pops the element off the end of array.

merge()

Merges two arrays.

isEmpty()

Checks if array is empty.

isNotEmpty()

Checks if array is not empty.

keys()

Returns all the keys of the array.

first()

Returns the first element, ignoring the type of the keys.

last()

Returns the last element, ignoring the type of the keys.

Class ArrayOfObjects

Class ArrayOfObjects is the extension of the ArrayObject concept. This array may contain only objects of given type.

Methods:

__construct()

The first argument is the class name. The rest of the arguments are this same as in class \ArrayObject. Constructor can throw InvalidArgumentException if one of objects is not instance of the class.

getClassName()

Returns the name of the class which this array may contain.

offsetSet()

Overrides the method in class \ArrayObject. It can throw InvalidArgumentException if the object is not the instance of the class.

This method is used in three methods of adding new object to the array:

NOTICE: exchangeArray() method does not use any of those methods. So, it has to be overwrite.

exchangeArray()

Exchange the array for another one.

throwExceptionIfObjectIsNotInstanceOfTheClass()

You can overwrite this protected method if you want to throw your own exception.

Key Naming Strategy

Since version 1.3 this library delivers new functionality - Key Naming Strategy. It allows you to choose how the keys of array are generated.

StandardStrategy

Default strategy is StandardStrategy. Which behaves exactly like PHP arrays key naming strategy.

Keys in this ArrayObject are: 0, 1 and 2.

In fact you do not need to deliver this object to constructor. By default ArrayObject::__construct will create this object for you.

ValueAsKeyStrategy

The second strategy is ValueAsKeyStrategy. Which forces array to store values as keys.

Keys in this ArrayObject are: a, b and c.

ClosureStrategy

The last one, but probably the most useful is ClosureStrategy. You need to determine Closure function which will be extracting keys. This strategy fits to working with objects.

Keys in this ArrayObject are: 2017-03-15, 2017-03-16 and 2017-03-17.

Tests

Unit tests

The code has been tested by unit tests. You can run unit test in console (tested only on Linux Ubuntu):


All versions of array-object with dependencies

PHP Build Version
Package Version
Requires php Version >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 bartoszbartniczak/array-object contains the following files

Loading the files please wait ....