PHPackages                             edisonlabs/policy-verification - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. edisonlabs/policy-verification

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

edisonlabs/policy-verification
==============================

PHP library for policies verification and report.

1.2.0(2y ago)349.8k1[1 issues](https://github.com/EdisonLabs/policy-verification/issues)[1 PRs](https://github.com/EdisonLabs/policy-verification/pulls)GPL-2.0+PHPCI failing

Since Feb 21Pushed 2y ago3 watchersCompare

[ Source](https://github.com/EdisonLabs/policy-verification)[ Packagist](https://packagist.org/packages/edisonlabs/policy-verification)[ RSS](/packages/edisonlabs-policy-verification/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelogDependencies (5)Versions (15)Used By (0)

[![Build Status](https://camo.githubusercontent.com/ddeb9109a4bb5702ac86996e963f29bd0b424626896acfa20467e22c356bfd35/68747470733a2f2f7472617669732d63692e636f6d2f456469736f6e4c6162732f706f6c6963792d766572696669636174696f6e2e7376673f6272616e63683d312e78)](https://travis-ci.com/EdisonLabs/policy-verification)[![Coverage Status](https://camo.githubusercontent.com/4a00c5d4526ea0ee055f71310f5810f7bd801eea62a1333399c317e4f2665698/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f456469736f6e4c6162732f706f6c6963792d766572696669636174696f6e2f62616467652e7376673f6272616e63683d312e78)](https://coveralls.io/github/EdisonLabs/policy-verification?branch=1.x)

Policy verification
===================

[](#policy-verification)

Overview
--------

[](#overview)

Policy verification is a simple library that provides base classes for creating and reporting security policy checks.

Each policy check returns as a result whether the policy passes or not. Other information is also reported like the actions to be taken if the policy is failing.

Usage
-----

[](#usage)

This library does not provide any policy check by default. To create new checks, [create a new Composer package](https://getcomposer.org/doc/01-basic-usage.md) and add a dependency to it.

```
composer require edisonlabs/policy-verification

```

Now create the policy check classes extending the base class provided by the library.

The classes must be created at `/src/EdisonLabs/PolicyVerification`. This is a requirement for the library to automagically locate and perform the checks during the report generation.

```
// File: /src/EdisonLabs/PolicyVerification/PhpVersion.php

namespace EdisonLabs\PolicyVerification;

use EdisonLabs\PolicyVerification\Check\AbstractPolicyCheckBase;

class PhpVersion extends AbstractPolicyCheckBase
{
    public function getName()
    {
        return 'PHP version';
    }

    public function getDescription()
    {
        return 'Checks whether system is running a recent version of PHP';
    }

    public function getCategory()
    {
        return 'PHP';
    }

    public function getSeverity()
    {
        return parent::POLICY_SEVERITY_HIGH;
    }

    public function checkRequirements()
    {
        // Example of requirement verification.
        if (!is_array($this->getData())) {
            $this->setRequirementError('Invalid data');
        }
    }

    public function check()
    {
        $phpVersion = phpversion();

        if ($phpVersion[0] < 7) {
            $this->setAction('Upgrade to PHP 7 or greater');
            $this->setResultErrorMessage('The system is running an older version of PHP');

            return parent::POLICY_FAIL;
        }

        $this->setWarning('PHP 7.1 will have security support up to Dec 2019');
        $this->setResultPassMessage('The system is running a recent version of PHP');

        return parent::POLICY_PASS;
    }
}
```

Configure the autoload in `composer.json`.

```
"autoload": {
    "psr-4": {
        "EdisonLabs\\PolicyVerification\\": "src/EdisonLabs/PolicyVerification"
    }
}

```

Re-create the Composer autoloader.

```
composer dump-autoload

```

Report
------

[](#report)

There are two ways to generate the policy check results report: programmatically and/or by command-line.

### Programmatically

[](#programmatically)

```
use EdisonLabs\PolicyVerification\Report;

// Some custom data to pass to the policy checks.
$data = array();

$report = new Report($data);

// Prints the result summary.
print_r($report->getResultSummary());

// Other report methods.
$report->getChecks();
$report->getPassChecks();
$report->getScorePercentage();
$report->setData($data);
$report->getData();
$report->getFailChecks();
$report->getActions();
$report->getPassChecksResultMessages();
$report->getFailChecksResultMessages();
$report->getRequirementErrors();
$report->getResult();
$report->getResultSummary();
$report->getScore();
$report->getTotalChecks();
$report->getWarnings();
$report->setCheck($check);
```

### Command

[](#command)

The command is located at `vendor/bin/policy-verification`. Include the `vendor/bin` directory in the system `$PATH` to run this command from anywhere.

Type `policy-verification --help` to see all the available options.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 73.4% 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 ~157 days

Recently: every ~308 days

Total

12

Last Release

909d ago

Major Versions

1.0.1 → 2.x-dev2020-06-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/82291593cc1356f74a314304499ad8aa14c24ca61f99e6be72d24e21844457ab?d=identicon)[jkribeiro](/maintainers/jkribeiro)

---

Top Contributors

[![jkribeiro](https://avatars.githubusercontent.com/u/1932061?v=4)](https://github.com/jkribeiro "jkribeiro (47 commits)")[![manuee](https://avatars.githubusercontent.com/u/105582?v=4)](https://github.com/manuee "manuee (7 commits)")[![alexis-saransig-work](https://avatars.githubusercontent.com/u/92549148?v=4)](https://github.com/alexis-saransig-work "alexis-saransig-work (4 commits)")[![suzymasri](https://avatars.githubusercontent.com/u/12935384?v=4)](https://github.com/suzymasri "suzymasri (4 commits)")[![jeqq](https://avatars.githubusercontent.com/u/2793969?v=4)](https://github.com/jeqq "jeqq (1 commits)")[![vijaycs85](https://avatars.githubusercontent.com/u/1220029?v=4)](https://github.com/vijaycs85 "vijaycs85 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/edisonlabs-policy-verification/health.svg)

```
[![Health](https://phpackages.com/badges/edisonlabs-policy-verification/health.svg)](https://phpackages.com/packages/edisonlabs-policy-verification)
```

###  Alternatives

[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M1.9k](/packages/behat-behat)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[cuyz/valinor-bundle

Symfony integration of `cuyz/valinor` — a library that helps to map any input into a strongly-typed value object structure.

51215.0k2](/packages/cuyz-valinor-bundle)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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