Need for country common name
The following code:
$countryCode = 'GB';
$iso = (new ISO3166())
->alpha2($countryCode);
/** @disregard P1013 */
$buyer = (new Person())
->setFirstName($firstName)
->setLastName($lastName)
->setStreet1($street1)
->setStreet2($street2)
->setZip($zip)
->setCity($city)
->setCountry($iso['name'])
->setEmail($email);
will end up with something like this in an invoice:
John Doe
St. Johns Street
SS69DQ RAYLEIGH
United Kingdom of Great Britain and Northern Ireland
This is not convenient for invoices as it will end up making the buyer's address field way too long as shown in this screenshot from a pdf:
It's common practice to use the common name as the Wikipedia article intro explains: The United Kingdom of Great Britain and Northern Ireland, commonly known as the United Kingdom (UK).
So the idea is to add the common name when it differs from the official one to the array.
[
'name' => 'United Kingdom of Great Britain and Northern Ireland',
'common' => 'United Kingdom',
'alpha2' => 'GB',
'alpha3' => 'GBR',
'numeric' => '826',
'currency' => [
'GBP',
],
],
If you agree to this update, I will happily provide a PR.
I'm actually not sure if I want to maintain this library much longer. Packages such as symfony/intl are much more complete.
@alcohol With 28M downloads and counting that would be a shame. I'm happy to help you with maintenance if you want. You can review my github repositories and see if I'm a fit. Please let me know if I should create a PR.
Sorry it took so long to get back to this. A PR is welcome, though it would help if there was a good source for a list of such names. I have not yet been able to find a comprehensive one.
@alcohol Sorry, I switched to symfony/intl since I didn't hear back from you. I had some issues with the symfony library but in the end it works almost as good as yours.
Understandable, glad to hear symfony/intl worked out for you in the end.