Project
One spec, every language
Every Malagasy Address package implements the same specification, with data from a published source and shared test vectors, so a function gives the same answer in JavaScript and PHP.
The spec repository holds, for each module, the rules in plain words, the data with its source and the date it was checked, and the test vectors: inputs with the exact output or error code every port must produce.
malagasy-address-spec data, rules, Public API tables, test vectors ├─ malagasy-address-js includes the spec, generates its tables, runs every vector └─ malagasy-address-php includes the spec, generates its tables, runs every vector- Tests are the contract. A port is complete when it passes every vector and provides every function of the Public API table.
- Same error codes.
INVALID_TYPE,INVALID_FORMAT,UNKNOWN_PLACEandOUT_OF_RANGEmean the same thing in every language. - A source for every value. The data comes from the OCHA COD-AB list. See Rules and sources.
Implementations
Section titled “Implementations”- malagasy-address-js: npm package
@mdgascar/places - malagasy-address-php: Composer package
mdgascar/malagasy-address, PHP 8.3+ - malagasy-address-laravel and malagasy-address-symfony: framework packages