PHPackages                             ptondereau/biscuit-php - 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. ptondereau/biscuit-php

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

ptondereau/biscuit-php
======================

PHP bindings for Biscuit authorization tokens

v0.5.0(1mo ago)16537↑121.4%1[3 issues](https://github.com/ptondereau/biscuit-php/issues)Apache-2.0PHPPHP ^8.1CI passing

Since Oct 19Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/ptondereau/biscuit-php)[ Packagist](https://packagist.org/packages/ptondereau/biscuit-php)[ RSS](/packages/ptondereau-biscuit-php/feed)WikiDiscussions main Synced today

READMEChangelog (8)Dependencies (10)Versions (26)Used By (0)

PHP Extension for Biscuit
=========================

[](#php-extension-for-biscuit)

PHP bindings for [Biscuit](https://www.biscuitsec.org), a bearer token supporting offline attenuation, decentralized verification, and powerful authorization policies.

[![CI](https://github.com/ptondereau/biscuit-php/actions/workflows/tests.yml/badge.svg)](https://github.com/ptondereau/biscuit-php/actions/workflows/tests.yml)

Documentation and Specifications
--------------------------------

[](#documentation-and-specifications)

- [Biscuit Website](https://www.biscuitsec.org) - Documentation and examples
- [Biscuit Specification](https://github.com/biscuit-auth/biscuit)
- [Biscuit Rust](https://github.com/biscuit-auth/biscuit-rust) - Technical details
- [Upgrading Guide](./UPGRADING.md) - Migration guide for breaking changes

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

[](#requirements)

- [`cargo-php`](https://crates.io/crates/cargo-php)
- PHP &gt;= 8.1 with `php-dev` installed
- Rust
- Clang

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

[](#installation)

### Pre-built Binaries (Recommended)

[](#pre-built-binaries-recommended)

Pre-built binaries are available for Linux (glibc/musl, x86\_64/arm64), macOS (x86\_64/arm64), and Windows (x86\_64) across PHP 8.1 through 8.5, with both Thread-Safe (TS) and Non-Thread-Safe (NTS) variants. Download the appropriate archive for your platform from the [latest release](https://github.com/ptondereau/biscuit-php/releases/latest).

#### Quick Installation (Linux glibc x86\_64, PHP 8.3 NTS shown)

[](#quick-installation-linux-glibc-x86_64-php-83-nts-shown)

```
# Pick the archive matching your PHP version, libc, arch, and TS/NTS:
VERSION=v0.4.0
wget https://github.com/ptondereau/biscuit-php/releases/download/${VERSION}/php_biscuit_php-${VERSION}_php8.3-x86_64-linux-glibc-nts.zip
unzip php_biscuit_php-${VERSION}_php8.3-x86_64-linux-glibc-nts.zip

# Move to PHP extension directory (adjust path for your system)
sudo mv biscuit_php.so /usr/lib/php/$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')/

# Enable the extension
echo "extension=biscuit_php.so" | sudo tee /etc/php/$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')/mods-available/biscuit_php.ini
sudo phpenmod biscuit_php

# Verify installation
php -m | grep biscuit_php
```

### PIE installation

[](#pie-installation)

We support [PIE](https://github.com/php/pie/) installation:

```
pie install ptondereau/biscuit-php
```

and you can add in your `composer.json`:

```
{
    // ...
    "ext-biscuit_php": "*",
    // ...
}
```

### Build from Source

[](#build-from-source)

If pre-built binaries are not available for your platform:

```
# Clone the repository
git clone https://github.com/ptondereau/biscuit-php.git
cd biscuit-php

# Install dependencies
composer install

# Build the extension
cargo build --release

# Load the extension
php -dextension=target/release/libbiscuit_php.so -m | grep biscuit_php
```

### Using stubs for autocompletion

[](#using-stubs-for-autocompletion)

We're exposing PHP stubs for IDE integration

```
composer require --dev ptondereau/biscuit-php
```

Quick Start
-----------

[](#quick-start)

```
