PHPackages                             boltci/shards - 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. boltci/shards

ActiveLibrary

boltci/shards
=============

Patch PHPUnit and Paratest to shard your Laravel test suite.

v0.1.2(5mo ago)32.0k—3.8%MITPHPPHP ^8.2CI passing

Since Dec 7Pushed 5mo agoCompare

[ Source](https://github.com/boltci/shards)[ Packagist](https://packagist.org/packages/boltci/shards)[ RSS](/packages/boltci-shards/feed)WikiDiscussions main Synced 1mo ago

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

Shards
======

[](#shards)

[![Unit Tests](https://github.com/boltci/shards/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/boltci/shards/actions/workflows/unit-tests.yml)[![Integration Tests](https://github.com/boltci/shards/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/boltci/shards/actions/workflows/integration-tests.yml)

Patch PHPUnit and Paratest to shard your Laravel test suite.

Caveats
-------

[](#caveats)

Both [Pest](https://github.com/pestphp/pest/) (as of [version 4.0.0](https://github.com/pestphp/pest/releases/tag/v4.0.0)) and [ParaTest](https://github.com/paratestphp/paratest) (as of [version 7.13.0](https://github.com/paratestphp/paratest/releases/tag/v7.13.0)) support test sharding natively, in more robust ways than this package provides.

You should only use this as a last resort if your version of testing framework does not support sharding natively.

Supported Versions
------------------

[](#supported-versions)

- PHP 8.2 or higher
- Laravel 10.x or higher
- PHPUnit 10.x or higher
- ParaTest 7.2.0 or higher

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

[](#installation)

Install the package via Composer:

```
composer require boltci/shards --dev
```

Usage
-----

[](#usage)

### 1. Patch PHPUnit

[](#1-patch-phpunit)

Before running your tests, patch PHPUnit to enable sharding:

```
php artisan shards:patch-phpunit
```

This command modifies the PHPUnit test suite builder to shard tests based on your environment configuration.

### 2. Patch ParaTest

[](#2-patch-paratest)

If you're using ParaTest versions between 7.2.0 and 7.4.2, you may need to apply a compatibility patch:

```
php artisan shards:patch-paratest
```

**Note**: ParaTest 7.4.3 and above have the issue fixed and don't require patching.

### 3. Run Your Tests

[](#3-run-your-tests)

Run your tests with the `SHARD` environment variable set to specify which shard to run. The format is `x/y`, where `x` is the shard number and `y` is the total number of shards.

```
SHARD=1/5 php artisan test
```

You can optionally set the `SEED` variable to any positive integers to shuffle the test order using a deterministic seed (i.e. the same seed will always produce the same test order):

```
SHARD=1/5 SEED=1 php artisan test
```

When using ParaTest (by passing `--parallel`), include the `--functional` flag to parallelize by Test to avoid overlaps between shards:

```
SHARD=1/5 SEED=1 php artisan test --parallel --functional
```

This is useful to help distribute tests more evenly across shards.

Credits
-------

[](#credits)

- The first version of this code was first written for internal use at [Springloaded](https://springloaded.co).
- The use of the word "shard" and the "x/y" shard notation was later adapted from [Pest](https://pestphp.com/docs/4.x/sharding).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance72

Regular maintenance activity

Popularity25

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~2 days

Total

3

Last Release

159d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dd4c3943583b0db4572b8702f3ee8f85a3fa7ecf99401d5f1add6613821f031?d=identicon)[matt-daneshvar](/maintainers/matt-daneshvar)

---

Top Contributors

[![matt-daneshvar](https://avatars.githubusercontent.com/u/10030505?v=4)](https://github.com/matt-daneshvar "matt-daneshvar (17 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/boltci-shards/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[laravel/jetstream

Tailwind scaffolding for the Laravel framework.

4.1k19.8M136](/packages/laravel-jetstream)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)

PHPackages © 2026

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