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

ActivePhp-ext

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

PHP bindings for Biscuit authorization tokens

v0.3.3(1mo ago)1016↓50%1[3 issues](https://github.com/ptondereau/biscuit-php/issues)Apache-2.0PHPPHP ^8.1CI passing

Since Oct 19Pushed 1mo ago1 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 1mo ago

READMEChangelog (6)Dependencies (6)Versions (20)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 x86\_64 across multiple PHP versions, with both Thread-Safe (TS) and Non-Thread-Safe (NTS) variants. Download the appropriate binary for your PHP version and thread safety from the [latest release](https://github.com/ptondereau/biscuit-php/releases/latest).

#### Quick Installation

[](#quick-installation)

```
# Download binary for your PHP version and thread safety
# Replace 8.3 with your version and ts/nts based on your thread safety
wget https://github.com/ptondereau/biscuit-php/releases/latest/download/ext_biscuit_php-linux-x86_64-php8.3-nts.so

# Verify checksum
wget https://github.com/ptondereau/biscuit-php/releases/latest/download/ext_biscuit_php-linux-x86_64-php8.3-nts.so.sha256
sha256sum -c ext_biscuit_php-linux-x86_64-php8.3-nts.so.sha256

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

# Enable the extension
echo "extension=ext_biscuit_php-linux-x86_64-php8.3-nts.so" | sudo tee /etc/php/$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')/mods-available/biscuit.ini
sudo phpenmod biscuit

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

### 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": "*",
    // ...
}
```

### 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/libext_biscuit_php.so -m | grep biscuit
```

### 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)

```
