Download the PHP package gears/arrays without Composer

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

Looking for maintainers, I no longer do much if any PHP dev, I have moved on, mostly work in dotnet core, node.js & golang these days. If anyone is keen to take over these projects, get in touch - [email protected]

The Array Gear

Build Status Latest Stable Version Total Downloads License

A collection of array conversions and manipulators. There are 2 APIs:

I am not going to bother documenting every single last function here but please see below for some general usage examples. The rest you can work out for yourself by reading the source, it's fairly straight forward and well commented.

How to Install

Installation via composer is easy:

composer require gears/arrays:*

How to Use

Here are a few procedural examples:

In PHP 5.6 you can import functions so you could change the above to:

NOTE: All function names are camelCased.

Prior to PHP 5.6 this is not possible. So you can do this instead:

NOTE: Just like the standard array_ functions included in PHP. Some functions act on a refrence of an array while others will take a copy and return the modifications or other values.

The Fluent Array Object:

Okay so this is such a massive part of the package it requires it's own HOW-TO section. To get started you can create a new object like so:

As you can see the data variable is now an Array-Like object. This is key because some times certian functions will expect real arrays. To get a real array back out of the fluent object you can do this:

You may wish to use a factory method to initiate a new Fluent object.

When you are using the Fluent API, please note how the subsequent method call signature changes vs that of the procedural api. You no longer need to provide the array to be performed on as the first argument. This is automatically done for you.

Here is the same example from the procedural api:

Now a keen eye might have thought that on line 2 there is an error. You might be thinking that the second line should look like this:

But you would be wrong. Unlike the package. The Fluent API and the Procedural API of , while similar, they are not identical. In part this is due to the more complex nature of arrays. Please beware that there are methods in both APIs that have the same name yet do slightly different things.

For example I can also use the add method like so:

Recursive Nature: Unlike a standard object a object is recursive. Each new fluent object is only loaded when it is accessed, thus minimizing any performance losses.

Lets show with an example:

Object Access: The last thing I would like to show off is the way you can now use your array is if it were an object. Again I like my examples:

This Readme only skims the surface of what is possible with the Fluent API. I promise a full set of documentation is coming... but I do have a life as well.

Laravel Integration

Gears\Arrays has been designed as functionally compatible to the Laravel Arr class, in fact it extends the class. Thus everything you could do before you can still do and then some.

By default Laravel does not alias the Arr class. So feel free to add the following to your alias list in the file :

Also note that is again compaitible with the standard class.

Credits

Thanks to axelarge for the inspiration, I have taken his methods re-factored them slightly and added a few of my own methods, into the mix. https://github.com/axelarge/php-array-tools

Additionally all methods in the class provided by Laravel. Have been integrated into . https://github.com/laravel/framework/blob/4.2/src/Illuminate/Support/Arr.php

Also from Laravel , our fluent interface extends this class. Some have refered to the Laravel Collection class as Arrays on steriods. So I am not sure what you would call our fluent class. Arrays on INSERT HARD CORE DRUG HERE...


Developed by Brad Jones - [email protected]


All versions of arrays with dependencies

PHP Build Version
Package Version
Requires zendframework/zend-dom Version 2.2.x
zendframework/zend-json Version 2.2.x
illuminate/support Version 5.*
patchwork/utf8 Version 1.*
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 gears/arrays contains the following files

Loading the files please wait ....