PHPackages                             fgdumitru/viceroy - 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. fgdumitru/viceroy

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

fgdumitru/viceroy
=================

Viceroy: An LLM interactions library with an OpenAI compatible completion endpoint via PHP.

1.0.13(7mo ago)0611MITPHPPHP &gt;=8.1CI failing

Since Jun 17Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/FGDumitru/viceroy)[ Packagist](https://packagist.org/packages/fgdumitru/viceroy)[ Docs](https://github.com/FGDumitru/viceroy)[ RSS](/packages/fgdumitru-viceroy/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (5)Versions (24)Used By (0)

Viceroy LLM Library [![PHP Version](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565) [![License](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#viceroy-llm-library--)

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Features](#features)
- [Image Processing](#image-processing-examples)
- [Advanced Capabilities](#advanced-capabilities)
- [Configuration](#custom-configuration)
- [License](#license)

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

[](#installation)

```
composer require viceroy/llm-library
```

Basic Usage
-----------

[](#basic-usage)

```
use Viceroy\Configuration\ConfigObjects;
use Viceroy\Configuration\ConfigManager;
use Viceroy\Connections\Definitions\OpenAICompatibleEndpointConnection;

// Initialize configuration
$config = new ConfigObjects('config.json');
$configManager = new ConfigManager($config);

// Create connection
$connection = new OpenAICompatibleEndpointConnection($config);
$connection->setSystemMessage("You are a helpful assistant.")
    ->setParameter('temperature', 0.7)
    ->setParameter('top_p', 0.9);

// Send query
$response = $connection->query("Explain quantum physics");

// Handle response
if ($response->wasStreamed()) {
    echo "Streamed response received";
} else {
    echo $response->getLlmResponse();
    echo "\nThink content: " . $response->getThinkContent();
}
```

Features
--------

[](#features)

- Dynamic function chaining
- Custom configuration inheritance
- Multi-turn conversation support
- Vision capabilities

Image Processing Examples
-------------------------

[](#image-processing-examples)

```
use Viceroy\Connections\Definitions\OpenAICompatibleEndpointConnection;

// describe_image.php
$imagePath = 'examples/images/ocr.png';
$imageData = base64_encode(file_get_contents($imagePath));

$response = $connection->query("Describe this image", [
    'vision' => true,
    'image' => $imageData,
    'max_tokens' => 500
]);

echo $response->getLlmResponse();
```

Available images:

- Document analysis: `/examples/images/image_1.jpg`
- Diagram parsing: `/examples/images/image_2.jpg`
- OCR demonstration: `/examples/images/ocr.png`

Advanced Capabilities
---------------------

[](#advanced-capabilities)

### Dynamic Function Chaining

[](#dynamic-function-chaining)

```
use Viceroy\Connections\Definitions\OpenAICompatibleEndpointConnection;

$connection->enableFunctionCalling()
    ->registerFunction('get_weather', 'Retrieves weather data')
    ->query("What's the weather in Berlin?");
```

Custom Configuration
--------------------

[](#custom-configuration)

```
use Viceroy\Configuration\ConfigObjects;

$customConfig = [
    'endpoint' => 'https://api.example.com/v1',
    'timeout' => 30,
    'vision_support' => true,
    'model_mappings' => [
        'gpt-4' => 'company-llm-v4'
    ]
];
```

License
-------

[](#license)

MIT License
Copyright (c) 2024 Viceroy Project

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance67

Regular maintenance activity

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78% 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

Every ~29 days

Recently: every ~42 days

Total

19

Last Release

225d ago

Major Versions

0.0.2-alpha2 → 1.0.02024-10-10

PHP version history (2 changes)v0.0.1-alpha1PHP &gt;=8.0.0

1.0.9PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/81620182?v=4)[Florin-Gabriel Dumitru](/maintainers/FGDumitru)[@FGDumitru](https://github.com/FGDumitru)

---

Top Contributors

[![XelotX](https://avatars.githubusercontent.com/u/22030592?v=4)](https://github.com/XelotX "XelotX (128 commits)")[![FGDumitru](https://avatars.githubusercontent.com/u/81620182?v=4)](https://github.com/FGDumitru "FGDumitru (36 commits)")

---

Tags

phpopenaillmllamallama.cpp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fgdumitru-viceroy/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M991](/packages/statamic-cms)[roundcube/roundcubemail

The Roundcube Webmail suite

7.1k2.4k3](/packages/roundcube-roundcubemail)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)

PHPackages © 2026

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