Download the PHP package mpetrovich/dash without Composer

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

Dash   Latest Stable Version Build Status codecov

A functional programming library for PHP. Inspired by Underscore, Lodash, and Ramda.

Jump to:

Operations

View full list of operations here

Highlights

Why use Dash?

PHP's built-in array_* functions are limited, difficult to compose, inconsistent, and don't work across many data types.

For instance, let's say we want to find the average age of males in this list:

Using PHP's built-in in functions, we might write something like this:

Dash makes common data transformation operations simpler:

This is just a tiny subset of what Dash can do. See the full list of operations here.

Installation

Requires PHP 7.4+

Usage

Dash operations are pure functions that can be used alone or chained together.

Standalone

Operations can be called as namespaced functions:

or as static methods:

Dash\_ can also be used as an alias for Dash\Dash:

Chaining

Multiple operations can be chained in sequence using chain(). Call value() to return the final value.

To explicitly convert the value to an array or stdClass, use arrayValue() or objectValue() respectively:

For convenience, Dash\chain() can be aliased to a global function using addGlobalAlias(). It only needs to be called once during your application bootstrap:

Sometimes you don't need the return value of the chain. However, the chain isn't processed until value() is called. For semantic convenience, run() is also an alias for value():

Supported data types

Dash can work with a wide variety of data types, including:

Examples

With an array:

With an object:

With a Traversable:

With a DirectoryIterator:

Currying

curry() and related operations can be used to create curried functions from any callable:

Most Dash functions have a curried version that accepts input data as the last parameter instead of as the first. Curried versions are located in the Dash\Curry namespace:

Similarly, partial() and related operations can be used to create partially-applied functions:

Lazy evaluation

Chained operations are not evaluated until value() or run() is called. Furthermore, the input data can be changed and evaluated multiple times using with(). This makes it simple to create reusable chains:

Chains can also be cloned and extended:

When value() is called, the result is cached until the chain is modified or the input is changed using with().

Custom operations

Custom operations can be added, retrieved, and removed using setCustom(), getCustom(), and unsetCustom(), respectively. Dash\custom() is also an alias for Dash::getCustom():

When chained, the current input is passed as the first parameter to the custom operation:

Tips

If you find that Dash doesn't have an operation that you need, fear not. Custom logic can be added without giving up Dash chaining or other features. The simplest way to integrate missing operations is via the Dash\thru() operation, which allows custom logic to modify and seamlessly pass through its results to the next step in the chain.

For example, suppose we want to use array_change_key_case() and keep the usual Dash chaining semantics. With thru(), it's simple:

Alternatively, if you find yourself needing to use array_change_key_case() often, it may be better to add a new custom operation:

which you can then use like any other chainable Dash method:

Feedback

Found a bug or have a suggestion? Please create a new GitHub issue. We want your feedback!


All versions of dash with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 mpetrovich/dash contains the following files

Loading the files please wait ....