Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer Borate:
Using the TOML configuration format in your applications
Aug 01, 2018 @ 17:54:59

In this new post to his site Sameer Borate looks at using the TOML configuration file format in a PHP application.

As any one who has programmed knows about configuration files. Configuration files are mostly text files used to configure the parameters and initial settings for computer programs – mostly user applications, operating system settings.

[...] In this post we will look into parsing TOML files in PHP. TOML is a configuration file format that is intended to be easy to read due to its obvious semantics and is designed to map unambiguously to a dictionary data structure. “TOML”, the name, is an acronym for “Tom’s Obvious, Minimal Language” referring to its creator Tom Preston-Werner.

He starts with an example of a configuration file in the TOML format and, following the installation/used of the yosymfony/toml library, the result of it being parsed. He also includes an example of using the same library to build out a TOML configuration and dump it to a string for output.

tagged: toml configuration file format introduction tutorial package

Link: https://www.codediesel.com/data/using-the-toml-configuration-format-in-your-applications/

Laravel News:
Introduction to TOML Configuration in PHP
Jul 30, 2018 @ 14:37:31

On the Laravel News site today there's a tutorial posted introducing you to TOML configuration, a new configuration file structure that's designed to be easy for humans to read and highly flexible (all while staying relatively simple).

TOML is a configuration file format language that is intended to be minimal and easy to read. TOML stands for “Tom’s Obvious, Minimal Language,” which refers to the creator Tom Preston-Werner.

[...] TOML aims to be a minimal configuration file format that’s easy to read due to obvious semantics. TOML is designed to map unambiguously to a hash table. TOML should be easy to parse into data structures in a wide variety of languages.

In order to work with it in PHP (since there is no native support) they show you how to install the yosymfony/toml package. The tutorial then walks you through an example TOML configuration file and what the result of using the package to parse it looks like. It then takes it a step further an converts one of the database configuration files for a Laravel application to the TOML format. It also shows the reverse - using the package to create a TOML file and the resulting output.

tagged: toml configuration file custom format introduction tutorial

Link: https://laravel-news.com/toml-configuration-in-php


Trending Topics: