Download the PHP package digitalcorehub/laravel-toon without Composer

On this page you can find all versions of the php package digitalcorehub/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

A lightweight Laravel package that converts standard JSON into TOON format - a human-readable, ultra-minimal, line-based data format.

Latest Version Laravel PHP

🇹🇷 Türkçe Dokümantasyon için tıklayın

Features

Installation

Install the package via Composer:

The package will automatically register its service provider and facade.

Requirements

Usage

Helper Functions

The package provides global helper functions for easy access:

Using the Facade

Fluent Interface

The package supports a fluent builder-style API:

The fluent interface is especially useful for method chaining and readability.

Encode from JSON String

Arrays with Objects

Nested Structures

Blade Directive

Use the @toon() directive in your Blade templates to display TOON output:

The directive automatically:

Example:

Output:

Logging Support

Log data in TOON format using the Log::toon() macro:

The macro encodes your data to TOON format and logs it through Laravel's logging system.

Console Styling

Get colored TOON output for console/terminal:

Syntax Highlighting:

Laravel Debugbar Integration

If you have Laravel Debugbar installed, the package automatically registers a TOON panel that shows:

The integration is automatic - no configuration needed. If Debugbar is not installed, the package works normally without it.

Note: Debugbar integration is optional and does not affect package functionality if Debugbar is not installed.

Streaming Encoder

For large JSON files, use the streaming encoder to avoid loading everything into memory:

The streaming encoder:

Lazy Encoder

Get TOON output line by line using a generator:

Lazy encoder is perfect for:

Compact Mode

Enable compact mode for smaller, faster output:

Compact mode:

Example:

Benchmarking

Measure performance with the benchmark command:

The benchmark shows:

Example Output:

Performance Best Practices

  1. Use streaming for large files:

  2. Enable compact mode in production:

  3. Use lazy encoder for real-time output:

  4. Monitor performance:

Decode TOON to Array

Decode Multiple Rows

Decode Nested Structures

Error Handling

The decode method throws InvalidToonFormatException for invalid TOON formats:

Common errors include:

Example Error Messages:

Using Dependency Injection

CLI Commands

Encode: JSON → TOON

Convert JSON files to TOON format using the Artisan command:

Options:

Example:

Decode: TOON → JSON

Convert TOON files to JSON format using the Artisan command:

Options:

Example:

Error Handling:

If the TOON file has invalid format, the command will display an error message:

Benchmark: Performance Testing

Measure TOON encode/decode performance:

Options:

Example:

The benchmark command displays:

Store: Save TOON to Laravel Storage

Save TOON files using Laravel Storage:

Options:

Example:

File Storage & Download

Storing TOON Files

Save TOON data to Laravel Storage:

Features:

Configuration:

Downloading TOON Files

Download TOON data as a file response:

Response Headers:

The download method:

API Response Macro

Return TOON format in API responses:

Response Headers:

Example Route:

The response()->toon() macro:

File Structure: After storing files, they will be located at:

TOON Format Rules

The TOON format follows these rules:

  1. Objects: Keys are listed on the first line, followed by values on the next line

  2. Arrays: Display with size indicator arrayName[count]{...}

  3. Minimal Syntax: Removes unnecessary {}, [], commas, and quotes where possible

  4. Order Preservation: Maintains the original JSON key ordering

  5. Nested Support: Fully supports nested arrays and objects

Configuration

Publishing the Configuration File

To customize the package settings, you need to publish the configuration file to your Laravel application:

This command will create a config/toon.php file in your Laravel project's config directory.

Configuration File Location

After publishing, the configuration file will be located at:

Configuration Options

The published configuration file contains the following options:

Using Configuration Values

You can access configuration values in your code:

Note: The configuration file is optional. If you don't publish it, the package will use default values.

Testing

Run the test suite:

Examples

Example 1: Simple Object

Input (JSON):

Output (TOON):

Example 2: Array of Objects

Input (JSON):

Output (TOON):

Example 3: Complex Nested Structure

Input (JSON):

Output (TOON):

Version

Current version: v0.6.0

This version includes:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

The MIT License (MIT). Please see License File for more information.

Credits

Developed by DigitalCoreHub


Made with ❤️ for the Laravel community


All versions of laravel-toon with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.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 digitalcorehub/laravel-toon contains the following files

Loading the files please wait ...