Download the PHP package loilo/collection without Composer

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

Collection

Travis Packagist

An extended version of Laravel's collections

This is my very personal extension of Laravel's amazing Collection class (as extracted by tightenco/collect). It adds some methods that I need regularly.

The declared aim of this project is to feed its methods back into Laravel by making proposals in laravel/ideas.

Install

Methods

Note: In all code examples below, Collection refers to Loilo\Collection\Collection.

Table of Contents:

insertBefore()/insertAfter()

Inserts items before/after a reference item (modifies the collection).

Proposal: #650 (declined)

Details: Specification

Examples:

Insert a list of items after a certain value:

Insert data after a certain key:

mergeInBefore()/mergeInAfter()

These are equivalent to insertBefore()/insertAfter() but do not modify the collection.

extract()

Extract structures from the collection, kind of an advanced pluck().

Details: Specification

Examples:

Take certain items from a list:

Transform a collection to a certain structure:

rearrange()

This method re-orders a collection, according to a predefined order.

Behavior of Unarrangeable Items

When a collection item is not matched by the new order, it will be appended to the ordered items:

This behavior is controlled by the second argument of the rearrange() method. The default behavior $c->rearrange([ ... ]) is equivalent to $c->rearrange([ ... ], Collection::UNARRANGEABLE_APPEND).

Possible values for this parameter are:

Class Constant Description
UNARRANGEABLE_APPEND Appends unarrangeable items after the rearranged ones.
UNARRANGEABLE_PREPEND Prepends unarrangeable items before the rearranged ones.
UNARRANGEABLE_PARTITION Partitions the return value and maps rearranged and unarrangeable items to the rearranged respectively the unarrangeable key.
UNARRANGEABLE_DISCARD Omits the unarrangeable items from the returned collection.
UNARRANGEABLE_THROW Throws an UnexpectedValueException when an unarrangeable item is encountered.

Map to Reordered Items

By default, the new order passed to rearrange() will map to the collection's keys. However, you may pass any callable as the 3rd parameter to the method to map the order values yourself:


All versions of collection with dependencies

PHP Build Version
Package Version
Requires tightenco/collect Version ^5.7
php Version ^7.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 loilo/collection contains the following files

Loading the files please wait ....