Download the PHP package jonasraoni/marc-to-iso without Composer
On this page you can find all versions of the php package jonasraoni/marc-to-iso. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jonasraoni/marc-to-iso
More information about jonasraoni/marc-to-iso
Files in jonasraoni/marc-to-iso
Package marc-to-iso
Short Description PHP mappings from MARC codes/countries to the ISO 3166-1 alpha-2 format and vice-versa.
License MIT
Homepage http://github.com/jonasraoni/marc-to-iso
Informations about the package marc-to-iso
MARC Countries <=> ISO
PHP mappings from MARC codes/countries to the ISO 3166-1 alpha-2 format and vice-versa.
Usage
Install the package:
The package provides 4 separated mappings (just to decrease the amount of bloat data loaded into memory):
- JonasRaoni\MarcToIso\IsoToMarcCode
- JonasRaoni\MarcToIso\IsoToMarcName
- JonasRaoni\MarcToIso\MarcCodeToIso
- JonasRaoni\MarcToIso\MarcNameToIso
Choose the one that fits your needs and call the static method get
, it might return the right mapping or null if it's invalid.
Data Generation
To regenerate the classes, ensure the submodules are updated, then call the generate.php script (contains the class template, manual mappings, etc.) and it will overwrite the existing classes.
The process is simple, a generic list of countries and their respective MARC codes is matched against the complete list of MARC codes, and the remaining items, which didn't match, are manually mapped.
Data Source
-
The generic list of countries was retrieved from this link: https://datahub.io/core/country-codes (the .csv is linked to this repository as a submodule).
- The list of MARC countries/codes was manually retrieved from this link: https://www.loc.gov/marc/countries/countries_code.html. The script below was used to extract a .csv out of the link (it should be executed in a Chromium DevTools console panel), when executed it will copy the data as a CSV to your clipboard.
The deprecated MARC codes were intentionally removed, since some of them might refer to countries that don't exist anymore, and thus not part of the ISO standard.