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

TOON Reference

Public API

Facade and service methods:

  • Toon::convert(mixed $input): string
  • Toon::convertWith(mixed $input, ?callable $replacer = null): string
  • Toon::encode(mixed $input): string
  • Toon::encodeWith(mixed $input, ?callable $replacer = null): string
  • Toon::decode(string $toon): array
  • Toon::encodeLines(mixed $input): \Generator
  • Toon::decodeFromLines(iterable $lines): array
  • Toon::skip(): object
  • Toon::estimateTokens(string $toon): array
  • Toon::diff(mixed $input): array
  • Toon::promptBlock(mixed $input, string $fenceLabel = 'toon'): string
  • Toon::validate(string $toon, bool $strict = true): array
  • Toon::contentType(): string
  • Toon::fileExtension(): string

Replacer callback contract:

  • signature: fn(array $path, string|int|null $key, mixed $value): mixed
  • return Toon::skip() to remove fields/items
  • called recursively on nested values

Global helpers:

  • toon_encode(mixed $data): string
  • toon_encode_with(mixed $data, callable $replacer): string
  • toon_encode_lines(mixed $data): array
  • toon_decode(string $toon): array
  • toon_diff(mixed $data): array
  • toon_prompt(mixed $data, string $label = 'toon'): string
  • toon_validate(string $toon, bool $strict = true): array

Collection macro:

  • collect($rows)->toToon(): string

Opt-in trait:

  • Sbsaga\Toon\Concerns\Toonable

Config Keys

  • enabled
  • escape_style
  • delimiter
  • min_rows_to_tabular
  • max_preview_items
  • coerce_scalar_types
  • strict_mode
  • compatibility_mode

Recommended Modes

  • use legacy when protecting existing serialized output contracts
  • use modern for new projects that want cleaner nested-data round trips

Related Guides

Suggested GitHub Topics

Apply these manually in the repository metadata for discoverability:

  • laravel
  • laravel-package
  • laravel-ai
  • toon
  • laravel-toon
  • llm
  • prompt-compression
  • token-optimization
  • structured-data
  • openai
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