Closed robinc-e closed 3 weeks ago
Hi @robinc-e, thanks for reaching out! I think this should be possible and quite doable. I am travelling the next few weeks but I might have some time to implement this!
What use case do you have for this? Because the specs are quite large and diverse, I am thinking of splitting it up into multiple classes. I don't know if it would be better to have one enum:
src/country/SubDivision.php
One enum per country:
src/Country/Subdivsion/Netherlands/Country.php
Or one enum per subdivision type per country:
src/Country/Subdivsion/Netherlands/Country.php
src/Country/Subdivsion/Netherlands/Provice.php
src/Country/Subdivsion/Netherlands/SpecialMunicipality.php
What do you think makes sense? And would you have any use at all in knowing the country a region belongs to?
For our use case one enum per country would be the most useful, but I can see use cases other people might have for the distinction.
Can your system handle both?
src/Country/Subdivsion/Netherlands/County.php
src/Country/Subdivsion/Netherlands/Provice.php
src/Country/Subdivsion/Netherlands/SpecialMunicipality.php
src/Country/Subdivsion/Netherlands/SubDivisions.php
Also should it be County.php
or Country.php
?
thanks a million!
There is more functionality coming to get more information about the subdivisions and to add a relation between countries and subdivisions, so this shouldn't have been closed. I'll keep you updated!
@robinc-e I was looking into creating a seperate enum per country/type etc, but that resulted in a lot of classes, which as a consequence then resulted in issues when determining what enum a string belonged to when converting strings to enum cases, so I decided on file instead. What do you think?
I've added some relationships between the countries, their subdivisions, and also some countries have subcountries which are also available right now. Would this work for your use case? I'm writing some documentation and will then create a release with these changes. Do you see any use for subdivision types? Those are currently not implemented. Let me know if you're missing functionality!
This has just been released in https://github.com/PrinsFrank/standards/releases/tag/v3.9.0!
Problem
My org needs more localised areas than countries and would like to use this library.
Solution Add ISO_3166-2 to this project to include country subdivisions.