jbml_decode (string data) ⇒ map
Parses a string in the JBML format to a map. The resulting map may contain additional maps inside it representing groups of values. For more information see https://github.com/jamiebalfour04/JBML-Formal-Specification/.
Notes
The JBML format is available to read on my GitHub.
JBML is similar to TOML and INI, making its implementation quick and easy. It does however feature additional data types such as the map ({ x : y }) and like TOML it also features the array/list data type. JBML also supports inline concatenation that allows you to concatenate two string values.
# Basic settings [General] app_name = "MyApp" version = "1.0.0" supported_languages = {"en" : "English", "es" : "Spanish", "fr" : "French"} [UserSettings] theme = "dark" font_size = 12 [Network] ips = ["192.168.1.1", "192.168.1.2", "192.168.1.254"] connection_max = 5000 enabled = true port = 8080 hosts = [ "alpha", "omega" ] # Database settings [Database] host = "localhost" port = 5432 [Database.credentials] username = "admin" password = "secret"
With the above, we can run some code like below to get data out:
$contents = file_get_contents("network.jbml") $jbml = jbml_decode($contents) print($jbml["General"]["supported_languages"]["en"])