PHPackages                             tomzx/policy-evaluator - 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. tomzx/policy-evaluator

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

tomzx/policy-evaluator
======================

Policy evaluator based on AWS AMI Policies.

16.4k1[5 issues](https://github.com/tomzx/policy-evaluator/issues)PHP

Since Feb 19Pushed 8y agoCompare

[ Source](https://github.com/tomzx/policy-evaluator)[ Packagist](https://packagist.org/packages/tomzx/policy-evaluator)[ RSS](/packages/tomzx-policy-evaluator/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Policy Evaluator
================

[](#policy-evaluator)

[![License](https://camo.githubusercontent.com/c775e00c5d3c15fd8e3b758254381291313b930e7fa21d9294e58278f3d0be27/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f706f6c6963792d6576616c7561746f722f6c6963656e73652e737667)](https://packagist.org/packages/tomzx/policy-evaluator)[![Latest Stable Version](https://camo.githubusercontent.com/76de11ffa797a2a1407b9ecd578979f0a9ab418a4de1216a57914aec1fe7f1dd/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f706f6c6963792d6576616c7561746f722f762f737461626c652e737667)](https://packagist.org/packages/tomzx/policy-evaluator)[![Latest Unstable Version](https://camo.githubusercontent.com/2464eecf802107a976dfd48b0eff4739b4cacda291d44f65f9ef792f7dcb86b9/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f706f6c6963792d6576616c7561746f722f762f756e737461626c652e737667)](https://packagist.org/packages/tomzx/policy-evaluator)[![Build Status](https://camo.githubusercontent.com/b739253f1e98797f6a62d5576a2eeb157c6f7d224428fa661f9336c26f47f80f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f6d7a782f706f6c6963792d6576616c7561746f722e737667)](https://travis-ci.org/tomzx/policy-evaluator)[![Code Quality](https://camo.githubusercontent.com/cf20a55fab2fa2ce6074092e504f7998ccbf64443d0533e7ab5497990090d023/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f6d7a782f706f6c6963792d6576616c7561746f722e737667)](https://scrutinizer-ci.com/g/tomzx/policy-evaluator/code-structure)[![Code Coverage](https://camo.githubusercontent.com/878d00bbe4cfe6161f0394530081d0303a8d1e04e814daea1419e2ca40e18c84/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f6d7a782f706f6c6963792d6576616c7561746f722e737667)](https://scrutinizer-ci.com/g/tomzx/policy-evaluator)[![Total Downloads](https://camo.githubusercontent.com/7c421801b49bfbfc25a860df14d22807ad845f09cac0ddc15f6a4ed9248d0a14/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6d7a782f706f6c6963792d6576616c7561746f722e737667)](https://packagist.org/packages/tomzx/policy-evaluator)

`Policy Evaluator` is a simple system based on AWS Policies. Given a set of statements, `Policy Evaluator` will then be able to answers to queries about whether this set of policies is allowed (or not) to perform a given action on a given resource.

Getting started
---------------

[](#getting-started)

`php composer.phar require tomzx/policy-evaluator`

Example
-------

[](#example)

```
use tomzx\PolicyEvaluator\Evaluator;
use tomzx\PolicyEvaluator\Resource;

Resource::$prefix = 'arn';

$evaluator = new Evaluator([
	'Statement' => [
		[
			'Action' => 'service:*',
			'Resource' => 'arn:aws:*',
			'Effect' => 'Allow',
		],
		[
			'Action' => 's3:*',
			'Resource' => 'arn:aws:s3:::my-bucket/*',
			'Effect' => 'Allow',
		],
	],
]);

$evaluator->canExecuteActionOnResource('service:test', 'arn:aws:test');
$evaluator->canExecuteActionOnResource('s3:GetObject', 'arn:aws:s3:::my-bucket/some-file');
```

### Variables support

[](#variables-support)

```
use tomzx\PolicyEvaluator\Evaluator;
use tomzx\PolicyEvaluator\Resource;

Resource::$prefix = 'arn';

$evaluator = new Evaluator([
	'Statement' => [
		[
			'Action' => 'service:*',
			'Resource' => 'arn:aws:${aws:username}',
			'Effect' => 'Allow',
		],
	],
]);

$evaluator->canExecuteActionOnResource('service:test', 'arn:aws:test', [
    'aws:username' => 'someUsername',
]);
```

License
-------

[](#license)

The code is licensed under the [MIT license](http://choosealicense.com/licenses/mit/). See [LICENSE](LICENSE).

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.6% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/218f6db237e6937c05550d4d6df648f50cd9b26b098fc8c1be3930fe7d5c71e9?d=identicon)[tomzx](/maintainers/tomzx)

---

Top Contributors

[![tomzx](https://avatars.githubusercontent.com/u/188960?v=4)](https://github.com/tomzx "tomzx (11 commits)")[![xel1045](https://avatars.githubusercontent.com/u/1497697?v=4)](https://github.com/xel1045 "xel1045 (2 commits)")

---

Tags

awspoliciespolicypolicy-evaluator

### Embed Badge

![Health badge](/badges/tomzx-policy-evaluator/health.svg)

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

###  Alternatives

[phpseclib/bcmath_compat

PHP 5.x-8.x polyfill for bcmath extension

16721.2M25](/packages/phpseclib-bcmath-compat)[wikimedia/aho-corasick

An implementation of the Aho-Corasick string matching algorithm.

563.9M6](/packages/wikimedia-aho-corasick)[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

247.7M20](/packages/tecnickcom-tc-lib-color)[jfcherng/php-mb-string

A high performance multibytes sting implementation for frequently reading/writing operations.

145.5M2](/packages/jfcherng-php-mb-string)[wplake/typed

Lightweight PHP utility for seamless type-casting and data retrieval from dynamic variables, arrays, and objects.

231.2k](/packages/wplake-typed)

PHPackages © 2026

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