Using the C or C ++ API detailed in the documentation , write a small program to convert the libconfig file to JSON or XML (or if you feel adventurous, the PHP serialization format), and then use the PHP libraries to work with this output. If the file has not changed, you can even cache the converted form.
You can call external programs from PHP and get output using exec () .
The best solution would, of course, be to write PHP bindings for the library, but depending on how important this library is for your application, this is probably not worth it.
If you look at the format, I would not recommend using regular expressions to parse a file.
source share