PHPackages                             kjdev/cedar - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. kjdev/cedar

ActivePhp-ext[Authentication &amp; Authorization](/categories/authentication)

kjdev/cedar
===========

PHP extension that evaluates Cedar policies locally with an Amazon Verified Permissions (AVP) compatible API.

v0.1.0(1mo ago)03↓88.9%MITCPHP ^8.4CI passing

Since Jun 2Pushed 1mo agoCompare

[ Source](https://github.com/kjdev/php-ext-cedar)[ Packagist](https://packagist.org/packages/kjdev/cedar)[ Docs](https://github.com/kjdev/php-ext-cedar)[ RSS](/packages/kjdev-cedar/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP Cedar Extension
===================

[](#php-cedar-extension)

A PHP extension that evaluates [Cedar](https://www.cedarpolicy.com/) policies locally, with an API compatible with [Amazon Verified Permissions (AVP)](https://aws.amazon.com/verified-permissions/)(`Aws\VerifiedPermissions\VerifiedPermissionsClient`). Swap an AVP client for `Cedar\AuthorizationClient` in your code and the request / response payloads keep the same shape — there is no AVP service call, the policies are evaluated in-process.

The Cedar evaluation engine is a snapshot of [nxe-cedar](https://github.com/kjdev/nxe-cedar) (the NGINX-edge Cedar evaluator) rewritten for use inside a PHP extension. See [`src/cedar/UPSTREAM.md`](src/cedar/UPSTREAM.md) for the upstream commit and re-import policy.

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

[](#requirements)

- PHP **8.4 or later** (NTS or ZTS). PHP 8.4 introduced the `ext/random/`reorganization that this extension depends on for CSPRNG-backed `PolicyStore` id generation.
- A POSIX build environment (`phpize`, `make`, a C compiler).
- Both NTS and ZTS builds are supported (see [ZTS status](#zts-status) below).

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

[](#installation)

### With PIE (recommended)

[](#with-pie-recommended)

[PIE](https://github.com/php/pie) is the modern PHP extension installer (it replaces `pecl install`).

```
pie install kjdev/cedar
```

PIE drives the standard `phpize` → `configure` → `make` → `make install` flow under the hood, taking care of locating `php-config` and dropping a `cedar.ini` into the right SAPI directory.

### Manual build

[](#manual-build)

```
phpize
./configure --enable-cedar
make
make test
make install   # may need elevated privileges
```

Then enable the extension by adding `extension=cedar.so` to a PHP ini file (e.g. `/etc/php.d/40-cedar.ini`).

Quick start
-----------

[](#quick-start)

```
