Download the PHP package daveross/functional-programming-utils without Composer

On this page you can find all versions of the php package daveross/functional-programming-utils. 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 functional-programming-utils

PHP Functional Programming Utils

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

Functional Programming utilities for PHP 5.4+

Table of Contents

Installation

Using composer

Put the require statement for functional-programming-utils in your composer.json file and run composer install or php composer.phar install:

Manually

Include all the files in the src directory, or individual files as needed:

License

MIT

See why I contribute to open source software.

Buy me a coffee

Contributing

Pull requests are welcome. Unit tests are encouraged but not required.

Further reading & suggested viewing

Simon Holywell's Functional PHP talk at PHP Hampshire Feb 2014

PHP Hampshire Feb 2014: Functional PHP

A note for PHP 5.6+ users

Starting in PHP 5.6, you can at the top of a file to reference that function without typing its whole name, including the namespace. I encourage you to try it.

Features

Mathematical functions

add

Adds two values

subtract

Subtracts two values

multiply

Multiplies two numbers

divide

Divides two numbers

modulus

Computes the remainder after division

inverse

Inverts a number

truthy

Checks if a value evaluates to using standard PHP rules

true

Checks if a value is boolean true

falsy

Checks if a value evaluates to using standard PHP rules

false

Checks if a value is boolean false

default_value

Returns a value, or a default if the value is null

Property Access

array_prop

Returns a value from an array given the corresponding key, or null if the key doesn't exist in the array

object_prop

Returns a value from an object given the corresponding property name, or null if the property doesn't exist in the object

prop

Calls or as appropriate

Memoization

memoize

Wraps a function in a layer that stores the function's return value for every set of parameters it's called with, so the function doesn't need to be called again the next time it's called with the same parameters

Currying

See Curry or Partial Application? The Difference Between Partial Application and Curry for details on how these functions differ.

partially_apply

Partially applies a function. Given a function that takes more than one parameter, returns a function that already knows the first parameter.

partially_apply_right

Partially applies a function. Given a function that takes more than one parameter, returns a function that already knows the last parameter.

curry

Curries a function. Given a function that takes more than one parameter, applies a single parameter to it and returns a function that takes the next parameter until all required parameters are provided.

Composition

compose

Creates a new function consisting of a series of functions that each take one parameter. When the new function is called, that series of functions is called from right to left, processing the result of the previous function.

Monads

Monad

Abstract parent class for Monads. A Monad is a class that wraps a single value and implements function map(callable $f). Monad::map() returns another Monad wrapping the function's return value. See the Monad.

Just

The Monad "just" wraps a value and maps functions to it.

Maybe

The Maybe Monad recognizes when it's holding a value and returns when a function is mapped to it. Otherwise, it behaves like a Just Monad.

maybe function

May be used to extract the value from a Maybe Monad.

Either

To implement conditionals, a function can be defined as returning either one value or another. This is represented with the Either Monad and its children, and .

Left

The Left Monad wraps an error value from an unsuccessful function call.

Right

The Right Monad wraps the result of a successful function call.

either function

May be used to extract the value from either a Left Monad or a Right Monad.

Release History


All versions of functional-programming-utils with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.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 daveross/functional-programming-utils contains the following files

Loading the files please wait ....