2017 © Pedro Peláez
 

library fox

PHP implementation of generic, higher-order functions.

image

haldayne/fox

PHP implementation of generic, higher-order functions.

  • Monday, June 27, 2016
  • by bishopb
  • Repository
  • 1 Watchers
  • 2 Stars
  • 5,478 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 35 % Grown

The README.md

Many algorithms are generic. That is, the way the algorithm functions is independent of what the algorithm does to the underlying data. These generic algorithms can be wrapped in a reusable function., (*1)

This package provides reusable, generic functions implemented using the callable object pattern. You can nest these generic functions to solve more complex problems. See below and the docs., (*2)

Latest Stable Version Build Status Coverage Status Monthly Downloads, (*3)

Installation

Install with composer: php composer.phar require haldayne/fox ^1.0, (*4)

Requires PHP version 5.5.0 or higher. No other PHP extensions are required., (*5)

Select examples

Retry a function until it either succeeds or reaches the maximum number of attempts. Delay each attempt by an exponentially increasing time:, (*6)

$retry = new \Haldayne\Fox\Retry(
    function ($src, $dst) { return copy($src, $dst); }
);
$retry->setAttempts(3);
$retry('ssh2.sftp://user:pass@host/the/file', 'thefile')
    or die("Copy failed after {$retry->getAttempts()} attempts");

Package contents and documentation

Extensive documentation is available at Read the Docs:, (*7)

Contributing

Your contribution is welcome! Open an issue or create a gist showing how you're using fox. If you want to add a new algorithm to fox, please keep these in mind:, (*8)

  • Please fork the repository and create a PR.
  • Use PSR-2.
  • Update tests so that you have at least 80% coverage.
  • Choose something useful. If the algorithm takes many arguments, or exposes state after calculating a result, it's a good candidate.

Miscellaneous

These algorithms can be composed together. The repository name fox is an abbreviation for f(x) said "f of x", which harks back to these functions' compositional ability., (*9)

Both Go and Java have implementations of the Retry function with exponential backoff., (*10)

The Versions

27/06 2016

dev-master

9999999-dev

PHP implementation of generic, higher-order functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bishop Bettini

27/06 2016

1.0.3

1.0.3.0

PHP implementation of generic, higher-order functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bishop Bettini

27/06 2016

1.0.4

1.0.4.0

PHP implementation of generic, higher-order functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bishop Bettini

31/12 2015

1.0.2

1.0.2.0

PHP implementation of generic, higher-order functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bishop Bettini

28/12 2015

1.0.1

1.0.1.0

PHP implementation of generic, higher-order functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bishop Bettini

23/12 2015

1.0.0

1.0.0.0

PHP implementation of generic, higher-order functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bishop Bettini