PHPackages                             dlnsk/faker-sequence - 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. dlnsk/faker-sequence

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

dlnsk/faker-sequence
====================

Faker provider to generate incrementing, decrementing and manual sequences.

v0.2.0(3y ago)01381WTFPLPHPPHP ^7.1 || ^8.0

Since Dec 7Pushed 2y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Sequence Provider for Faker
---------------------------

[](#sequence-provider-for-faker)

This package will allow [Faker](https://github.com/FakerPHP/Faker) to generate incrementing, decrementing and manual sequences.

[![tests](https://github.com/dlnsk/faker-sequence/actions/workflows/tests.yml/badge.svg)](https://github.com/dlnsk/faker-sequence/actions/workflows/tests.yml)[![Latest Stable Version](https://camo.githubusercontent.com/c8477e4071166bb898e9f11896b0a0307c78b42bd23d668d00ce72da500c1ed2/687474703a2f2f706f7365722e707567782e6f72672f646c6e736b2f66616b65722d73657175656e63652f76)](https://packagist.org/packages/dlnsk/faker-sequence)[![License](https://camo.githubusercontent.com/93a7215d9d83f3c7f1157e39be7e3d3d4923206c0f9cc520d27f048b2b967011/687474703a2f2f706f7365722e707567782e6f72672f646c6e736b2f66616b65722d73657175656e63652f6c6963656e7365)](https://packagist.org/packages/dlnsk/faker-sequence)

Install
-------

[](#install)

To install, use composer:

```
composer require dlnsk/faker-sequence
```

Use
---

[](#use)

#### Laravel

[](#laravel)

This package supports Laravel's auto discovering, so you don't have to do anything else.

If you want to use the package in tests initialize sequences in `setUp`:

```
public function setUp(): void {
    ...
    $faker = app(\Faker\Generator::class);
    $faker->initSequence('seq_name', ['one', 'two']);
}
```

#### Other frameworks

[](#other-frameworks)

```
# When installed via composer
require_once 'vendor/autoload.php';

$faker = \Faker\Factory::create();
$faker->addProvider(new \Dlnsk\Faker\SequenceProvider($faker));
```

Generate
--------

[](#generate)

### Numeric sequences

[](#numeric-sequences)

#### Quick use

[](#quick-use)

```
echo $faker->nextInSequence('seq_name');    // 0
echo $faker->nextInSequence('seq_name');    // 1

$faker->resetSequence('seq_name');
echo $faker->nextInSequence('seq_name');    // 0
```

#### Initialization

[](#initialization)

```
$faker->initSequence(
    $name,          // Sequence name. You can use number of sequences simultaneously
    $start = 0,     // Starting value
    $step = 1,      // Sequence step, may be positive or negative
    $bound = null,  // Value that can be reached
    $loop = false   // Loop sequence or throw the exception NoMoreException on the bound
);
```

#### Improved use

[](#improved-use)

```
$faker->initSequence('seq_name', 10, -2);
echo $faker->nextInSequence('seq_name');    // 10
echo $faker->nextInSequence('seq_name');    // 8

$faker->initSequence('seq_name', 0, 2, 5);
echo $faker->nextInSequence('seq_name');    // 0
echo $faker->nextInSequence('seq_name');    // 2
echo $faker->nextInSequence('seq_name');    // 4
echo $faker->nextInSequence('seq_name');    // throw NoMoreException

$faker->initSequence('seq_name', 0, 2, 5, true);
echo $faker->nextInSequence('seq_name');    // 0
echo $faker->nextInSequence('seq_name');    // 2
echo $faker->nextInSequence('seq_name');    // 4
echo $faker->nextInSequence('seq_name');    // 0
```

### Iterable sequences

[](#iterable-sequences)

#### Initialization

[](#initialization-1)

```
$faker->initSequence(
    $name,          // Sequence name. You can use number of sequences simultaneously
    $collection,    // Array or iterable object
    $loop = false   // Loop sequence or throw the exception NoMoreException on the end
);
```

#### Using

[](#using)

```
$faker->initSequence('seq_name', ['one', 'two']);
echo $faker->nextInSequence('seq_name');    // one
echo $faker->nextInSequence('seq_name');    // two
echo $faker->nextInSequence('seq_name');    // throw NoMoreException

$faker->initSequence('seq_name', ['one', 'two'], true)
echo $faker->nextInSequence('seq_name');    // one
echo $faker->nextInSequence('seq_name');    // two
echo $faker->nextInSequence('seq_name');    // one

$singers = Employee::where('salary', '>', 10000)->get();
$faker->initSequence('seq_name', $singers);
echo $faker->nextInSequence('seq_name');    // { 'firstname' => 'Bob', 'lastname' => 'Dylan'}
echo $faker->nextInSequence('seq_name');    // { 'firstname' => 'Laura', 'lastname' => 'Marling'}
```

License
-------

[](#license)

This package is under the WTFPL license. Do whatever you want with it.

[LICENSE](https://github.com/dlnsk/faker-sequence/blob/master/LICENSE)

Reporting an issue or a feature request
---------------------------------------

[](#reporting-an-issue-or-a-feature-request)

Fork it, send a PR. Issues and feature requests are tracked in the [GitHub issue tracker](https://github.com/dlnsk/faker-sequence/issues).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

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

Every ~1 days

Total

3

Last Release

1250d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/85fb8b60466b2bf511bfe08ccef1bc928010c10cea11385d8287488c7fcfe0ae?d=identicon)[dlnsk](/maintainers/dlnsk)

---

Top Contributors

[![dlnsk](https://avatars.githubusercontent.com/u/332778?v=4)](https://github.com/dlnsk "dlnsk (14 commits)")

---

Tags

fakerprovidersequenceiterateincrementDecrement

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dlnsk-faker-sequence/health.svg)

```
[![Health](https://phpackages.com/badges/dlnsk-faker-sequence/health.svg)](https://phpackages.com/packages/dlnsk-faker-sequence)
```

###  Alternatives

[mbezhanov/faker-provider-collection

A collection of custom providers for the Faker library

2138.6M24](/packages/mbezhanov-faker-provider-collection)[mmo/faker-images

Different images provider for Faker

59370.3k6](/packages/mmo-faker-images)[pelmered/fake-car

Fake-Car is a Faker provider that generates fake car data for you.

1271.2M2](/packages/pelmered-fake-car)[bluemmb/faker-picsum-photos-provider

picsum.photos provider for Faker

31225.7k1](/packages/bluemmb-faker-picsum-photos-provider)[aalaap/faker-youtube

Faker provider for generating fake YouTube video URLs

2288.6k](/packages/aalaap-faker-youtube)[smknstd/fakerphp-picsum-images

Alternative image provider for fakerphp using picsum.photos

45218.1k3](/packages/smknstd-fakerphp-picsum-images)

PHPackages © 2026

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