Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Toon Laravel Package

sbsaga/toon

View on GitHub
Deep Wiki
Context7

Using TOON with LLMs

TOON is a strong fit for LLM workflows because it keeps structured data readable while reducing repeated JSON punctuation and field names.

Practical Prompt Pattern

Use TOON as the structured context block instead of pasting raw JSON.

use Sbsaga\Toon\Facades\Toon;

$context = [
    'account' => $account->only(['id', 'name', 'tier']),
    'orders' => $orders->map->only(['id', 'status', 'total'])->all(),
    'alerts' => $alerts->map->only(['severity', 'message'])->all(),
];

$prompt = <<<PROMPT
Review the following business context and produce a summary:

%s
PROMPT;

$response = $llm->chat(sprintf($prompt, Toon::promptBlock($context)));

Validating Model Output

If you ask a model to return TOON, validate it before trusting it:

$result = Toon::validate($modelOutput, strict: true);

if (!$result['valid']) {
    // Ask the model to regenerate or fall back to JSON handling.
}

Delimiter Tip

The wider TOON ecosystem recommends tab delimiters when maximum compactness matters. This package supports opt-in delimiter changes through config/toon.php.

'delimiter' => 'tab',

Safe Rollout Advice

For existing projects, keep compatibility_mode on legacy unless you are intentionally migrating consumers to the newer nested-data behavior.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle
dmstr/api-platform-utils-bundle
dmstr/api-configuration-bundle
chrisdev/ux-components
baks-dev/finances
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle