PHPackages                             haldayne/fox - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. haldayne/fox

ActiveLibrary

haldayne/fox
============

PHP implementation of generic, higher-order functions.

1.0.4(9y ago)130.7k↓100%11MITPHPPHP ^5.5.0 || ^7.0CI failing

Since Dec 23Pushed 9y agoCompare

[ Source](https://github.com/haldayne/fox)[ Packagist](https://packagist.org/packages/haldayne/fox)[ RSS](/packages/haldayne-fox/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (1)

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.

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](http://haldayne-docs.readthedocs.org/en/latest/fox/).

[![Latest Stable Version](https://camo.githubusercontent.com/3530e2b3f57df3ae2eadda55d0c5312368791991da5a56832c509436128c3d5a/68747470733a2f2f706f7365722e707567782e6f72672f68616c6461796e652f666f782f762f737461626c652e706e67)](https://packagist.org/packages/haldayne/fox)[![Build Status](https://camo.githubusercontent.com/79201c5dc00b9daed2a0dea9710e4283bd0fd4b01cbf633717e9546d019304e1/68747470733a2f2f7472617669732d63692e6f72672f68616c6461796e652f666f782e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/haldayne/fox)[![Coverage Status](https://camo.githubusercontent.com/ed5d15320e08f2f0af31630546c4e477600f9884f5ea56089994969727dc034a/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f68616c6461796e652f666f782f62616467652e706e673f6272616e63683d6d617374657226627573743d31)](https://coveralls.io/r/haldayne/fox?branch=master)[![Monthly Downloads](https://camo.githubusercontent.com/e962de84574622efbc8175d696e20cb344584aee06a91b82c2517c3bf72ecaab/68747470733a2f2f706f7365722e707567782e6f72672f68616c6461796e652f666f782f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/haldayne/fox)

Installation
============

[](#installation)

Install with composer: `php composer.phar require haldayne/fox ^1.0`

Requires PHP version 5.5.0 or higher. No other PHP extensions are required.

Select examples
===============

[](#select-examples)

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

```
$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
==================================

[](#package-contents-and-documentation)

Extensive documentation is available at Read the Docs:

- [End-user Documentation](http://haldayne-docs.rtfd.org/en/latest/Fox/)
- [API Documentation](http://haldayne.github.io/documentation/api/)
- [List of generic functions](http://haldayne-docs.readthedocs.org/en/latest/Fox/list-of-generic-functions/)

Contributing
============

[](#contributing)

Your contribution is welcome! [Open an issue](https://github.com/haldayne/fox/issues) or [create a gist](https://gist.github.com/)showing how you're using fox. If you want to [add a new algorithm](https://github.com/haldayne/fox/pulls)to fox, please keep these in mind:

- Please fork the repository and create a PR.
- Use [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md).
- 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
=============

[](#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.

Both [Go](https://github.com/cenkalti/backoff) and [Java](https://github.com/google/google-http-java-client) have implementations of the Retry function with exponential backoff.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~47 days

Total

5

Last Release

3602d ago

PHP version history (2 changes)1.0.0PHP ^5.5.0

1.0.3PHP ^5.5.0 || ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f7d1b2950f32597fbcd30215950167fb1390c6bdd7da5f8820b3e0c7f7c69a64?d=identicon)[bishopb](/maintainers/bishopb)

---

Top Contributors

[![bishopb](https://avatars.githubusercontent.com/u/6844145?v=4)](https://github.com/bishopb "bishopb (33 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/haldayne-fox/health.svg)

```
[![Health](https://phpackages.com/badges/haldayne-fox/health.svg)](https://phpackages.com/packages/haldayne-fox)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
