PHPackages                             abxy/foil-server - 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. abxy/foil-server

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

abxy/foil-server
================

Official Foil PHP server SDK

0.2.4(2w ago)00MITPHPPHP ^8.1CI failing

Since Mar 25Pushed 2w agoCompare

[ Source](https://github.com/abxy-labs/foil-server-php)[ Packagist](https://packagist.org/packages/abxy/foil-server)[ Docs](https://github.com/abxy-labs/foil-server-php)[ RSS](/packages/abxy-foil-server/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (5)Dependencies (7)Versions (20)Used By (0)

Foil PHP Library
================

[](#foil-php-library)

[![Preview](https://camo.githubusercontent.com/5725a500e5c00a11f803d5c246a0b93814e58133a5cc00494bc46832d9c5bf3e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d707265766965772d313131383237)](https://camo.githubusercontent.com/5725a500e5c00a11f803d5c246a0b93814e58133a5cc00494bc46832d9c5bf3e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d707265766965772d313131383237)[![PHP 8.1+](https://camo.githubusercontent.com/f77b2db5c3d509fa0cdc07060ddad7da5c53082540d9777cd85c6c44db1266a9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d254532253839254135382e312d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/f77b2db5c3d509fa0cdc07060ddad7da5c53082540d9777cd85c6c44db1266a9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d254532253839254135382e312d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)[![License: MIT](https://camo.githubusercontent.com/afd46581942d7d786fb84d2f099c6a104fa4d3be908eaa740e1b39cf52d5a0d0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3066373636652e737667)](https://camo.githubusercontent.com/afd46581942d7d786fb84d2f099c6a104fa4d3be908eaa740e1b39cf52d5a0d0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3066373636652e737667)

The Foil PHP library provides convenient access to the Foil API from applications written in PHP. It includes a framework-agnostic client for Sessions, visitor fingerprints, Organizations, Organization API key management, sealed token verification, Gate, and Gate delivery/webhook helpers.

The library also provides:

- a fast configuration path using `FOIL_SECRET_KEY`
- a bundled PSR-18 transport stack with support for custom PSR clients and factories
- structured API errors and built-in sealed token verification
- webhook endpoint management, test sends, and event delivery history
- public, bearer-token, and secret-key auth modes for Gate flows
- Gate delivery/webhook helpers

Documentation
-------------

[](#documentation)

See the [Foil docs](https://usefoil.com/docs) and [API reference](https://usefoil.com/docs/api-reference/introduction).

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

[](#installation)

You don't need this source code unless you want to modify the package. If you just want to use the package, run:

```
composer require abxy/foil-server
```

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

[](#requirements)

- PHP 8.1+

Usage
-----

[](#usage)

Use `FOIL_SECRET_KEY` or `secretKey` for core detect APIs. For public or bearer-auth Gate flows, the client can also be created without a secret key:

```
