Download the PHP package hopr/pipeable without Composer

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

🐇 Hopr\Pipeable

A collection of pipeable functions from PHP's standard library, reworked for the pipe operator. Designed to be straightforward and minimalistic. This repository will not see frequent updates, as it is not intended for continuous development.

Table of Contents

Description

This library provides a set of functions that can be chained together using the |> operator to create expressive and readable data transformations. It offers utilities for both arrays and strings, allowing for a more functional programming style in PHP.

The pipe operator only allows us to use single-argument functions, which is inconvenient. It forces us to create closures for almost everything. Hopr\Pipeable tries to solves this issue.

Without Hopr\Pipeable:

With Hopr\Pipeable:

Nothing fancy, just straight to the point.

Behind the scenes, filter (or reduce) are implemented like this:

It desugars to the exact equivalent of the example without Hopr\Pipeable! You can also use this library to take advantage of partial application and lazy operations without using the pipe operator.

It allows us to have a more declarative way of coding.

Installation

Usage

Array Functions

String Functions

Available Functions

**Array Functions** - `map(callable $callback)`: Applies a callback to each element of an array. - `filter(callable $callback)`: Filters an array using a callback. - `filter_map(callable $callback)`: Filters and maps an array in a single step. - `reduce(callable $callback, mixed $initial)`: Reduces an array to a single value. - `first()`: Gets the first element of an array. - `last()`: Gets the last element of an array. - `reverse()`: Reverses the order of elements in an array. - `unique()`: Removes duplicate values from an array. - `slice(int $offset, ?int $length = null)`: Extracts a slice of an array. - `sort()`: Sorts an array. - `asort()`: Sorts an array and maintains index association. - `shuffle()`: Shuffles an array. - `count()`: Counts the number of elements in an array. - `contains(mixed $value)`: Checks if a value exists in an array. - `hasKey(mixed $key)`: Checks if a key exists in an array. - `values()`: Gets all values from an array. - `keys()`: Gets all keys from an array.
**String Functions** - `map(callable $callback, string $separator = '')`: Maps a callable over each character of a string. - `filter(callable $callback)`: Filters the characters of a string using a callable. - `join(string|array $with)`: Joins the elements of an array into a string. - `reduce(callable $callback, mixed $initial)`: Reduces a string to a single value. - `first()`: Gets the first character of a string. - `last()`: Gets the last character of a string. - `reverse()`: Reverses a string. - `unique()`: Removes duplicate characters from a string. - `slice(int $offset, ?int $length = null)`: Extracts a substring from a string. - `sort()`: Sorts the characters of a string alphabetically. - `asort()`: Sorts the characters of a string alphabetically. - `shuffle()`: Shuffles the characters of a string randomly. - `count()`: Gets the length of a string. - `contains(string $value)`: Checks if a string contains a given value. - `values()`: Converts a string into an array of characters. - `toUpper()`: Converts a string to uppercase. - `toLower()`: Converts a string to lowercase. - `trim()`: Strips whitespace from the beginning and end of a string. - `replace(string $search, string $replace)`: Replaces occurrences of a substring within a string. - `chunk(int $by)`: Chunks a string into parts of a specified size. - `split(string $delimiter = '', int $chunk_by = 1)`: Splits a string either by a delimiter or into chunks.
**Other Functions** - `dump_and_die(mixed $var)`: Dumps a variable and terminates the script.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License

This project is licensed under the MIT License.


All versions of pipeable with dependencies

PHP Build Version
Package Version
No informations.
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 hopr/pipeable contains the following files

Loading the files please wait ....