Download the PHP package devium/toml without Composer
On this page you can find all versions of the php package devium/toml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package toml
Stand With Ukraine 🇺🇦
Devium/Toml
A robust and efficient PHP library for encoding and decoding TOML compatible with v1.0.0
This library tries to support the TOML specification as much as possible.
Overview
This library provides a comprehensive solution for working with TOML in PHP applications
Features
- Encoding PHP arrays and objects to TOML format
- Decoding TOML strings into PHP data structures
- Preserves data types as specified in TOML
- Handles complex nested structures
- Supports TOML datetime formats
- Error handling with informative messages
Installation
You can install this library via composer:
Usage
Decoding:
Encoding:
About TOML datetime formats
This library tries to parse TOML datetime formats into next variants (according to the specification):
Devium\Toml\TomlDateTime
(for the offset date time)Devium\Toml\TomlLocalDatetime
(for the local date time)Devium\Toml\TomlLocalDate
(for the local date)Devium\Toml\TomlLocalTime
(for the local time)
Example:
If you use
TOML will be parsed into array
Each class implements Stringable
interface.
TomlLocal*
classes are marked with TomlDateTimeInterface
for usability. Each class has public properties.
There is TomlDateTime
class to support TOML offset date time format also.
Of course any DateTimeInterface
or TomlDateTimeInterface
are encoded into TOML datetime string.
So
will be encoded into
About informative errors
If there is parsing error, TomlError
has the approximate location of the problem in the message.
Something like:
Else it has message about whole input.
About floating-point values
The decoder returns each floating-point value as a string by default.
You can force it to return a float type by setting the $asFloat argument:
About NULL
TOML does not support null values.
If the array contains a null value, an exception will be thrown.
The only thing possible is a null value for the keys in the tables. Such keys are simply skipped during encoding.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request
License
devium/toml is open-sourced software licensed under the MIT license.
Made with ❤️ in Ukraine
All versions of toml with dependencies
ext-json Version *
php-ds/php-ds Version ^1.5
symfony/polyfill-mbstring Version ^1.30