PHP Classes

How to manipulate serialized values using the PHP TOON package MGTOON: Perform operations with values in TOON format

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-12-03 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
mgtoon 1.0GNU Lesser Genera...7Data types, PHP 7
Description 

Author

This package can perform operations with values in TOON format.

It can perform several types of manipulation operations with variable values that can be encoded in the Token-Oriented Object Notation (TOON).

Currently it can:

- Create a new value from a variable

- Return the current value or a value with a given key

- Update an entry of the current value with a given key with a new entry value

- Delete an entry of the current value with a given value

- Return a string with the current value in the TOON format

- Validate a string to check if it is in the correct TOON format

In Portuguese:

MGTOON é uma biblioteca para trabalhar com Token-Oriented Object Notation no PHP.

Innovation Award
PHP Programming Innovation award nominee
November 2025
Number 3
The Token-Oriented Object Notation (TOON) is a format used for storing and retrieving variable values in strings.

It is a format that tends to be more compact than other formats like JSON.

This package provides a package that can perform several types of operations on values that can be loaded and saved in the TOON format.

It can work with any type of PHP application, regardless if they use a framework or not.

Manuel Lemos
Picture of Murilo Gomes Julio
  Performance   Level  
Name: Murilo Gomes Julio <contact>
Classes: 5 packages by
Country: Brazil Brazil
Age: 37
All time rank: Not yet ranked
Week rank: Not yet ranked
Innovation award
Innovation award
Nominee: 3x

Instructions

Documentation

MGTOON

MGTOON é uma biblioteca para trabalhar com Token-Oriented Object Notation no PHP.

Installation

composer require mugomes/mgtoon

Example

use MGTOON\MGTOON;

include_once(__DIR__ . '/vendor/autoload.php');

$toon = new MGTOON();

// Load TOON and primary key "name"
$toon->loadFile(__DIR__ . '/users.toon', 'name');

// Load TOON string and primary key "name"
$toon->loadTOON('user[name|email|active]
Maria|maria@localhost|1
Joćo|joao@localhost|0', 'name');

// Added Fields and primary key "name"
$toon->create('user', ['name', 'email', 'active'], 'name');

// Added Items
$toon->add(['name' => 'Maria', 'email' => 'maria@localhost', 'active' => 1]);
$toon->add(['name' => 'Joćo', 'email' => 'joao@localhost', 'active' => 0]);

// Query
echo "\nQuery\n";
print_r($toon->read());

// Update
echo "\n\nUpdate\n";
$toon->update('Maria', ['active' => 0]);

// Read
echo "\n\nRead\n";
print_r($toon->read('Maria'));

// Delete
echo "\n\nDelete\n";
$toon->delete('Joćo');

// TOON
echo "\nTOON\n";
print_r($toon->toString());

// Validate
echo "\n\nValidate\n";
print_r($toon->validate($toon->toString(), 'name'));

// Save File
$toon->saveFile(__DIR__ . '/users.toon');

Support

  • GitHub Sponsors: https://github.com/sponsors/mugomes/
  • More Options: https://www.mugomes.com.br/apoie.html

License

The MGTOON is provided under:

SPDX-License-Identifier: LGPL-2.1-only

Beign under the terms of the GNU Lesser General Public License version 2.1 only.

All contributions to the MGTOON are subject to this license.


  Files folder image Files (5)  
File Role Description
Files folder image.github (1 file)
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (5)  /  .github  
File Role Description
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data

  Files folder image Files (5)  /  src  
File Role Description
  Plain text file MGTOON.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0