PHPackages                             fabrikage/requirements - 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. fabrikage/requirements

ActiveLibrary

fabrikage/requirements
======================

A helper class to set requirements for your PHP application.

0.2.0(2y ago)163MITPHP

Since Dec 9Pushed 2y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

  ![Fabrikage logo](https://camo.githubusercontent.com/ab7138e1ceb31b23b62baba37b0922cd14b264c7c99493b4be88187ec0963985/68747470733a2f2f66616272696b6167652e6e6c2f6173736574732f696d672f6c6f676f2e737667)

fabrikage/requirements

[](#fabrikagerequirements)

An elegant solution to check if your PHP application meets the requirements to run on a server.

Requirements
------------

[](#requirements)

Will be added soon.

Installation with Composer
--------------------------

[](#installation-with-composer)

```
composer require fabrikage/requirements
```

Usage
-----

[](#usage)

Valid version strings are:

- `1` Major
- `1.0` Major and minor
- `1.0.0` Major, minor and patch

*Or anything that is readable by `version_compare()`.*

Valid comparators are:

- `=` Equal to
- `!=` Not equal to
- `>` Greater than
- `>=` Greater than or equal to
- `=1.0.0`.

### Example

[](#example)

```
require_once __DIR__ . '/vendor/autoload.php';

use Fabrikage\Requirements;
use Fabrikage\Requirements\Requirement;

$requirements = [
    new Requirement\PHP('8.1'),
    new Requirement\PHPExtension('curl'),
    new Requirement\WordPress('6.4.1'),
    new Requirement\WordPressPlugin('woocommerce/woocommerce.php', '8.3.1'),
];

// Pass false to the constructor to disable exception throwing, leave empty to enable.
$validator = new Requirements\Validator(false);
$validator->addRequirements($requirements);

if (!$validator->valid()) {
    // Your application does not meet the requirements.
}

// Alternatively, you can invoke the validator as a function.
if (!$validator()) {
    // Your application does not meet the requirements.
}

App::run();
```

### WordPress example

[](#wordpress-example)

```
use Fabrikage\Requirements\Validator;

class App
{
    private static Validator $validator;

    public static function run(Validator $validator): void
    {
        if (!$validator->valid()) {
            static::$validator = $validator;
            static::handleErrors();

            return; // Block further execution
        }

        static::init();
    }

    private static function init(): void
    {
        // Initialize your application
    }

    private static function handleErrors(): void
    {
        add_action('admin_notices', function () {
            static::renderErrors();
        });
    }

    private static function renderErrors(): void
    {
        if (empty($errors = static::$validator->getErrors())) {
            return;
        }

        echo sprintf(
            '%s%s%s',
            PLUGIN_NAME,
            __('The plugin could not be loaded because the following requirements are not met:', 'plugin-name'),
            implode('', array_map(function (string $error) {
                return sprintf('- %s', $error);
            }, $errors))
        );
    }
}
```

This would result in the following output if not all requirements are met:

[![WordPress notification](screenshot.png)](screenshot.png)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

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

Total

2

Last Release

884d ago

### Community

Maintainers

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

---

Top Contributors

[![bartkleinreesink](https://avatars.githubusercontent.com/u/28318911?v=4)](https://github.com/bartkleinreesink "bartkleinreesink (12 commits)")

---

Tags

phpphp-libraryphp8

### Embed Badge

![Health badge](/badges/fabrikage-requirements/health.svg)

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

PHPackages © 2026

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