Search by

mnfst / manifest-php

guillaumegay13

Turn 4xx API errors into 2xx in real time.

Package info

github.com/mnfst/manifest-php

pkg:composer/mnfst/manifest-php

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0


README

Manifest SDK Architecture

Manifest for PHP

Turn πŸ”΄ 4xx API errors into 🟒 2xx in real time.

CI Packagist version Packagist downloads

What is Manifest

Manifest is a self-healing layer that fixes and retries failed API requests on the fly.

  • 🎯 Fix failures automatically before they impact your users.
  • πŸ”” Get notified of root causes so you can fix them permanently.
  • πŸ”Œ Works across your stack with internal APIs, external services, and agent tools.

How it works

How Manifest heals a failed request: a 400 reaches Manifest, drops to a patch from the knowledge base or the healing agents, and is retried once, returning a 200 OK

Prerequisites

pecl install opentelemetry && docker-php-ext-enable opentelemetry

In Docker, one line:

RUN pecl install opentelemetry && docker-php-ext-enable opentelemetry

PHP cannot instrument an HTTP client without it, so the SDK sees nothing until it is installed.

Get started

Start with your agent

"Install Manifest in this app: https://app-staging.manifest.build/prompt-php.md"

Read the prompt β†’

The prompt installs the extension, wires the loading order, and stops to let you paste your key.

Start with code

composer require mnfst/manifest-php

Manifest must load before your application makes its first HTTP call. A PHP hook cannot attach to a function that has already run, so an SDK that loads late sees nothing. Point auto_prepend_file at the bundled entry point:

; php.ini, a .user.ini, or your php-fpm pool config
auto_prepend_file = vendor/mnfst/manifest-php/prepend.php

Or call it yourself, as the first thing your application does:

use function Mnfst\manifest;

manifest();  // before any HTTP call

Laravel and CakePHP need no code of their own for coverage: their HTTP clients are instrumented. In Laravel, make the call from a service provider:

// app/Providers/AppServiceProvider.php
public function register(): void
{
    \Mnfst\manifest(config('services.manifest.key'), config('services.manifest.url'));
}

with 'manifest' => ['key' => env('MNFST_KEY'), 'url' => env('MNFST_URL')] in config/services.php. The SDK stays silent under PHPUnit and Pest, so Http::fake() answers are never reported as failures; MNFST_IN_TESTS=1 opts back in. See the guide.

Setup

  1. Create a project in your Manifest dashboard and copy its project key.
  2. Set the key as an environment variable:
export MNFST_KEY='your-project-key'

Verify the install from your project directory:

vendor/bin/manifest doctor

It masks and validates the key, reports which coverage level is active, and tells you whether the SDK is loading early enough.

Try it

Send a request that would normally fail. Manifest catches it, repairs it, and retries:

use Illuminate\Support\Facades\Http;

$response = Http::post('https://api.example.com/orders', [
    'limit' => 500,   // Invalid? Manifest fixes it and retries.
]);

echo $response->status();  // See the 200 OK response.

Check your Manifest dashboard to see all repairs and insights.

What is covered

The app calls an API via… Covered
Laravel's Http facade βœ… healed
Guzzle, any client, including one built inside a third-party library βœ… healed
CakePHP's Cake\Http\Client βœ… healed
Symfony's HttpClient (curl & native transports) βœ… healed
WordPress wp_remote_* / WpOrg\Requests βœ… healed
A library with its own raw curl_* client, such as stripe/stripe-php ⚠️ captured, never healed
file_get_contents ❌ not seen

The curl_* row is a permanent limit of PHP, not a temporary gap. The extension can observe an internal function but cannot replace its return value, so those failures appear in your dashboard while your application still receives the original error.

Symfony responses consumed through stream() or with buffer => false stay under the caller's control and are not healed. See the coverage details.

Supported infrastructure

Infrastructure Supported
Docker, Kubernetes βœ… one line in the Dockerfile
A VPS or your own server (Forge, Ploi) βœ… pecl install opentelemetry
Heroku, Platform.sh ⚠️ only if the platform ships the extension
Laravel Vapor, Bref ⚠️ possible with a custom Lambda layer
Shared hosting (cPanel, Hostinger, OVH) ❌ you do not control the runtime

More

Configuration, limits & development Β· API contract Β· Website