A number of reasons:
- It allows us to use composer (more on this later)
- JSON is faster than XML
- Simplistic and Lighweight
- Easily readable/writeable by human and machine
- JSON Encode & Decode have been in PHP since 5.2 and JSON Last Error has been in PHP since 5.3
- Doesn't require much learning/adaptation
Composer, in a nutshell is a PHP package manager. It was designed by Nils Adermann (naderman) and Jordi Boggiano (seldaek).
Why is composer being used for PHP?
Because its a popular commonly used system used by a high volume of developers and it suits phpBB's needs. At this time it will just use the extension.json file based on composer.json but the plan is eventually to fully integrate composer into phpBB.
Because it can no longer perform actions tools such as the Generator, Editor etc. will most likely be abandonded when MODX is.
However some new tools will be added:
- JSON Generator - This will allow you to, on a UI enter the information and it will then generate the file for you
- JSON Validator - This will check for syntax errors etc. with your JSON file. This will most likely be added to titania. This will be built on JSON Lint
- JSON Schema Validator - This will check the file against the schema to ensure that only the correct items are used, that they match and all required elements have been completed. Again this will be added to titania. It will use something similar to the code here
- No multi-language support - XML supports multiple fields for descriptions etc. in different languages. The new JSON file does not.
- No nice browser UI - While it can be opened in all modern browsers (IE8, FF 3.5, Opera 10, Chrome, Safari 4), it does not have a nice UI quite like XML does. However, the file is designed to be ready by validators (code reviewers), authors and phpBB. phpBB then shows all the information on the details page when it is uploaded.
You can see the (currently slightly out-of-date) specification here:
Extensions Meta-Data File Specification.pdf
Extensions Meta-Data File Specification.docx
An HTML version of the specification is coming soon.
The example is in the post below