PHPackages                             adrienbrault/instructrice-bundle - 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. [API Development](/categories/api)
4. /
5. adrienbrault/instructrice-bundle

ActiveLibrary[API Development](/categories/api)

adrienbrault/instructrice-bundle
================================

Typed LLM Outputs with Symfony

36991PHP

Since May 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/adrienbrault/instructrice-bundle)[ Packagist](https://packagist.org/packages/adrienbrault/instructrice-bundle)[ RSS](/packages/adrienbrault-instructrice-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Symfony bundle for the [adrienbrault/instructrice](https://github.com/adrienbrault/instructrice) library.

Install the bundle:

```
composer require adrienbrault/instructrice-bundle:@dev adrienbrault/instructrice:@dev

```

Configure api keys:

```
# config/packages/instructrice.yaml
instructrice:
    default: '%env(string:INSTRUCTRICE_DSN)%'
    #default: Ollama::HERMES2THETA_LLAMA3_8B
    anthropic:
        api_key: '%env(string:default::ANTHROPIC_API_KEY)%'
    anyscale:
        api_key: '%env(string:default::ANYSCALE_API_KEY)%'
    deepinfra:
        api_key: '%env(string:default::DEEPINFRA_API_KEY)%'
    fireworks:
        api_key: '%env(string:default::FIREWORKS_API_KEY)%'
    groq:
        api_key: '%env(string:default::GROQ_API_KEY)%'
    google:
        api_key: '%env(string:default::GEMINI_API_KEY)%'
    mistral:
        api_key: '%env(string:default::MISTRAL_API_KEY)%'
    ollama:
        api_key: '%env(string:default::OLLAMA_API_KEY)%'
    openai:
        api_key: '%env(string:default::OPENAI_API_KEY)%'
    perplexity:
        api_key: '%env(string:default::PERPLEXITY_API_KEY)%'
    together:
        api_key: '%env(string:default::TOGETHER_API_KEY)%'
```

Use [instructrice](https://github.com/adrienbrault/instructrice):

```
use AdrienBrault\Instructrice\Instructrice;
use AdrienBrault\Instructrice\LLM\Provider\OpenAi;

public function controller(Instructrice $instructrice, HubInterface $hub)
{
    $sentiment = $instructrice->get(
        type: [
            'type' => 'string',
            'enum' => ['positive', 'neutral', 'negative'],
        ],
        'Pretty descent!',
        'Sentiment analysis',
        llm: OpenAi::GPT_4T,
    );
}
```

You can use Mercure to update your frontend while the LLM is completing JSON, using the `onChunk` callback:

```
use AdrienBrault\Instructrice\Instructrice;
use AdrienBrault\Instructrice\LLM\LLMChunk;
use AdrienBrault\Instructrice\LLM\Provider\OpenAi;
use Symfony\Component\Mercure\HubInterface;
use Symfony\Component\Mercure\Update;

public function controller(Instructrice $instructrice, HubInterface $hub)
{
    $context = 'web page html converted to markdown';
    $context = 'email html body converted to markdown';
    // See https://github.com/thephpleague/html-to-markdown
    // And I highly suggest making sure League\HTMLToMarkdown\Converter\TableConverter is enabled!

    $products = $instructrice->getList(
        Product::class,
        $context,
        'Find all the products!',
        llm: OpenAi::GPT_4T,
        onChunk: function (array $products, LLMChunk $chunk) use ($hub) {
            // FYI: $chunk->propertyPath
            // You could leverage that to only update each property once in the UI, instead of streaming every single character

            $hub->publish(new Update(
                'product_123',
                $this->renderView('product.stream.html.twig', [
                    'products' => $products,
                ])
            ));
        },
    );
}
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/014b3653b1f38cb85fa553f23e32a10a9584fee5dc80c7be2d01900202045033?d=identicon)[AdrienBrault](/maintainers/AdrienBrault)

---

Top Contributors

[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (19 commits)")[![baldurrensch](https://avatars.githubusercontent.com/u/871417?v=4)](https://github.com/baldurrensch "baldurrensch (2 commits)")

### Embed Badge

![Health badge](/badges/adrienbrault-instructrice-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/adrienbrault-instructrice-bundle/health.svg)](https://phpackages.com/packages/adrienbrault-instructrice-bundle)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M453](/packages/google-gax)

PHPackages © 2026

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