PHPackages                             jamsouf/repeat - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jamsouf/repeat

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jamsouf/repeat
==============

Repeater utility. Work with repeated actions in a simple way.

v1.0.0(11y ago)028MITPHPPHP &gt;=5.3.0

Since Mar 8Pushed 11y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Repeat
======

[](#repeat)

[![Latest Stable Version](https://camo.githubusercontent.com/434cd16456cb853a2a35ab01f9480dac91e5bcd460b528595415929853c014ba/68747470733a2f2f706f7365722e707567782e6f72672f6a616d736f75662f7265706561742f762f737461626c652e737667)](https://packagist.org/packages/jamsouf/repeat)[![Build Status](https://camo.githubusercontent.com/5344fb7bac7e643da03a7752ffb656b2014648e24f2f7a73fba3864e7986261e/68747470733a2f2f7472617669732d63692e6f72672f6a616d736f75662f7068702d7265706561742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jamsouf/php-repeat)

Repeat is a repeater utility for PHP / Composer.
It makes it easy to repeat calling a function or similar operations.

Installation
------------

[](#installation)

#### Via composer

[](#via-composer)

Install the latest version with `composer require jamsouf/repeat`

```
require 'vendor/autoload.php';
```

Examples
--------

[](#examples)

##### Call a anonymous function 100 times

[](#call-a-anonymous-function-100-times)

```
$results = Repeat::_function(100, function () {
    // your function code
});
```

##### Call a named function and access in each call the current result

[](#call-a-named-function-and-access-in-each-call-the-current-result)

```
$calculate = function ($result) {
    // your function code
};

$results = Repeat::_function(20, $calculate);
```

##### Call a named function until a specific condition

[](#call-a-named-function-until-a-specific-condition)

```
$calculate = function ($result) {
    // your function code
};

$until = function ($result) {
    // return true or false
};

$results = Repeat::_function(50, $calculate, $until);
```

##### Repeat a string with index reference and delimiter until a specific condition

[](#repeat-a-string-with-index-reference-and-delimiter-until-a-specific-condition)

```
$result = Repeat::_string(10, 'v1.{j}.{i}', function ($result) {
    return strpos($result, '.4.') !== false ? true : false;
}, ', ');

// => v1.1.0, v1.2.1, v1.3.2, v1.4.3
```

API Documentation
-----------------

[](#api-documentation)

#### **Repeat::\_function**($count, $func, $until = *null*)

[](#repeat_functioncount-func-until--null)

*Repeat calling a function*

- *integer* `$count`: How often the function should be called
- *callable* `$func`: Function to call repeated
- *callable* `$until` (optional): Repeat calling until this function returns true
- =&gt; return *array*: Results from each function call

#### **Repeat::\_string**($count, $string, $until = *null*, $delimiter = *null*)

[](#repeat_stringcount-string-until--null-delimiter--null)

*Repeat a string*

- *integer* `$count`: How often the string should be repeated
- *string* `$string`: String to repeat
- *callable* `$until` (optional): Repeat the string until this function returns true
- *string* `$delimiter` (optional): Signs to separate the strings
- =&gt; return *string*: Repeated string

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

4089d ago

### Community

Maintainers

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

---

Top Contributors

[![jamsouf](https://avatars.githubusercontent.com/u/6104602?v=4)](https://github.com/jamsouf "jamsouf (6 commits)")

---

Tags

composerphprepeater-utilitycalliteraterepeattimes

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jamsouf-repeat/health.svg)

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

###  Alternatives

[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)[vkartaviy/retry

The library for repeatable and retryable operations

29227.2k2](/packages/vkartaviy-retry)[tobion/retry

A generic library to retry an operation in case of an error. You can configure the behavior like the exceptions to retry on.

16396.8k](/packages/tobion-retry)[mvo/contao-group-widget

Adds a new group widget that allows repeating a set of DCA fields.

28124.3k31](/packages/mvo-contao-group-widget)

PHPackages © 2026

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