Download the PHP package mischasigtermans/laravel-toon without Composer

On this page you can find all versions of the php package mischasigtermans/laravel-toon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-toon

Laravel TOON

Latest Version on Packagist Total Downloads

The most complete TOON implementation for Laravel, and the only one with full TOON v3.0 specification compliance. Listed as official Laravel implementation.

TOON (Token-Optimized Object Notation) is a compact, YAML-like format designed to reduce token usage when sending data to LLMs. This package achieves ~50% token reduction compared to JSON while maintaining full round-trip fidelity, backed by 470 tests.

Installation

Quick Start

Output:

Global Helper Functions

For convenience, global helper functions are available:

Collection Macro: toToon

You can convert any Laravel collection directly to TOON format with the built-in toToon macro:

Output:

Eloquent Model: toToon

Eloquent models have a toToon method, similar to toJson and toArray:

Why TOON?

When building MCP servers or LLM-powered applications, every token counts. JSON's verbosity wastes context window space with repeated keys and structural characters.

JSON (201 bytes):

TOON (62 bytes) - 69% smaller:

Benchmarks

For a typical paginated API response (50 records):

Real-world benchmarks from a production application with 17,000+ records:

Data Type JSON TOON Savings
50 records 30,389 bytes 14,343 bytes 53%
100 records 60,856 bytes 28,498 bytes 53%
500 records 303,549 bytes 140,154 bytes 54%
1,000 records 604,408 bytes 277,614 bytes 54%

Features

Tabular Format

Arrays of uniform objects with primitive values are encoded as compact tables:

List Format for Nested Objects

Arrays containing objects with nested properties use list format for clarity:

Type Preservation

All scalar types are preserved through encode/decode:

String Quoting (Spec-Compliant)

Strings containing special characters are automatically quoted per the TOON spec:

Safe strings (alphanumeric, underscores, dots) remain unquoted for minimal overhead.

Configuration

Publish the config file:

Basic Options

Token-Saving Options

Value Transformation

Utility Methods

Measure Savings

Encode Specific Keys Only

Use Cases

MCP Servers

Reduce token usage when returning data from MCP tool calls:

LLM Context

Pack more data into your context window:

API Responses

Optional TOON responses for token-conscious clients:

Spec Compliance

This package implements the TOON v3.0 specification and passes the official specification test suite. Key compliance features:

Testing

The test suite includes 470 tests covering encoding, decoding, nested object handling, and official spec compliance fixtures.

Requirements

Credits

License

MIT


All versions of laravel-toon with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mischasigtermans/laravel-toon contains the following files

Loading the files please wait ...