Download the PHP package simondeeley/tuple without Composer

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

Reusable tuple object for PHP

License Latest Stable Version Latest Unstable Version Total Downloads Build Status Scrutinizer Code Quality Code Coverage

This package provides a tuple type object for PHP. It is based off simondeeley\Type package which provides immutable objects.

In mathematics a tuple is a finite ordered list (sequence) of elements. An n-tuple is a sequence (or ordered list) of n elements, where n is a non-negative integer.

Wikipedia

An example of a tuple could be [1, 2, 3, 4, 5]. The order of the items in a tuple is important, so given a set of 'A' being [1, 2, 3] and 'B' also being [1, 2, 3] then it's true that A equals B. However if we have another set 'C' which is [3, 2, 1] then this is not equal to A (or B).

This package was born out of a love creating beautifully crafted 'boilerplate' code which can be reused again and again in any number of both simple and complex objects. Most of the ideas used in this package revolve around the need to create the most basic of PHP objects - one that is immutable and unchanging. Trouble is, PHP has a fair few 'magic methods' which, although great for method overriding, are less great for ensuring an immutable state. This package aims to solve that problem and provide a number of base classes to allow you to build easy-to-use immutable classes of your own.

Requirements

Installation

Usage

Create your own tuple object

This is the starting point to creating a tuple. By default you can have any number of items in your tuple object (up to the limit of PHP's PHP_INT_MAX value). You can override this and create your own maximum length tuples.

Let's go ahead and create a simple tuple called a pair. Unsurprisingly this has a maximum of two items.

Now we have our new class we can create pair-type objects until out hearts content...

As well as a maximum length value, you can also specify minimum length values. By setting the two values as the same, you effectively impose an exact requirement for the number of arguments a tuple can have. This is very useful for creating tuples that are true to their mathematical form, which brings us on to...

Example Tuples

This package provides two pre-built tuples out-of-the box, Single and Pair these provide functionality for 1-tuple and 2-tuple objects, respectively. Using them is very simple

Testing Equality

The base tuple implements the TypeEquality interface from the simondeeley\Type package. Using this equality check we can compare two tuples. Following on from our Pair example above we can do the following

Explore the source code to see how the comparisons are made or to see how the base tuple class is built.


All versions of tuple with dependencies

PHP Build Version
Package Version
Requires php Version ~7.1
simondeeley/type Version ~1.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 simondeeley/tuple contains the following files

Loading the files please wait ....