PHPackages                             sferra/delta - 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. sferra/delta

ActivePackage

sferra/delta
============

HTTP connection for AI providers OpenAI API Compatible with SSE stream type

1.0.0(today)05↑2900%1MITPHPPHP ^8.2

Since Jul 31Pushed todayCompare

[ Source](https://github.com/FelipeSferra/delta)[ Packagist](https://packagist.org/packages/sferra/delta)[ RSS](/packages/sferra-delta/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (1)

Delta
=====

[](#delta)

OpenAI-compatible SSE streaming client for PHP / Laravel.

Stream AI responses token-by-token via a clean, fluent API. Works with any provider that exposes a `/chat/completions` endpoint.

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

[](#installation)

```
composer require sferra/delta
```

Laravel will auto-discover the service provider. No manual registration needed.

Configuration
-------------

[](#configuration)

Publish the config file (optional):

```
php artisan vendor:publish --tag=delta-config
```

Or use environment variables:

```
DELTA_URL=http://localhost:8642/v1/chat/completions
DELTA_KEY=my-api-key
DELTA_MODEL=hermes-agent
```

Usage
-----

[](#usage)

### Facade (Laravel)

[](#facade-laravel)

```
use Sferra\Delta\Facades\Delta;

$response = Delta::using(
    url: 'http://localhost:8642/v1/chat/completions',
    key: 'my-key',
    model: 'hermes-agent'
)->stream(
    messages: [['role' => 'user', 'content' => 'What is PHP?']],
    onChunk: fn(string $chunk) => echo $chunk  // real-time streaming
);
```

### Direct client

[](#direct-client)

```
use Sferra\Delta\DeltaClient;

$client = new DeltaClient(
    url: 'https://api.openai.com/v1/chat/completions',
    key: 'sk-...',
    model: 'gpt-4'
);

$response = $client->stream(
    messages: [['role' => 'user', 'content' => 'Hello!']]
);

echo $response; // complete response
```

Supported Providers
-------------------

[](#supported-providers)

Any OpenAI-compatible API:

- [Hermes Agent](https://hermes-agent.nousresearch.com)
- [OpenCode](https://opencode.ai)
- [Ollama](https://ollama.com)
- [OpenAI](https://platform.openai.com)
- [vLLM](https://github.com/vllm-project/vllm)
- Custom `/chat/completions` endpoints

How It Works
------------

[](#how-it-works)

Delta sends a `POST` request with `stream: true` and parses the SSE (Server-Sent Events) response byte-by-byte, extracting `choices[0].delta.content` from each chunk.

The `$onChunk` callback receives each text delta as it arrives, enabling real-time streaming in Livewire components, console commands, or any PHP application.

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a4b85581d1a8c3702f73461193a4b2528b77d3ed1d48d4197c251ff786ec9291?d=identicon)[Sferra](/maintainers/Sferra)

---

Top Contributors

[![FelipeSferra](https://avatars.githubusercontent.com/u/86127586?v=4)](https://github.com/FelipeSferra "FelipeSferra (1 commits)")

### Embed Badge

![Health badge](/badges/sferra-delta/health.svg)

```
[![Health](https://phpackages.com/badges/sferra-delta/health.svg)](https://phpackages.com/packages/sferra-delta)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.4M350](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

78727.1M203](/packages/laravel-mcp)[illuminate/auth

The Illuminate Auth package.

9328.5M1.3k](/packages/illuminate-auth)[illuminate/routing

The Illuminate Routing package.

1419.4M3.3k](/packages/illuminate-routing)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[api-platform/laravel

API Platform support for Laravel

58174.6k18](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
