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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity