@@ -179,6 +179,41 @@ You may convert codes between two-letter alpha2 and three-letter alpha3 codes::
179
179
180
180
$alpha2Code = Countries::getAlpha2Code($alpha3Code);
181
181
182
+ Numeric Country Codes
183
+ ~~~~~~~~~~~~~~~~~~~~~
184
+
185
+ The `ISO 3166-1 numeric `_ standard defines three-digit country codes to represent
186
+ countries, dependent territories, and special areas of geographical interest.
187
+
188
+ The main advantage over the ISO 3166-1 alphabetic codes (alpha-2 and alpha-3) is
189
+ that these numeric codes are independent from the writing system. The alphabetic
190
+ codes use the 26-letter English alphabet, which might be unavailable or difficult
191
+ to use for people and systems using non-Latin scripts (e.g. Arabic or Japanese).
192
+
193
+ The :class: `Symfony\\ Component\\ Intl\\ Countries ` class provides access to these
194
+ numeric country codes::
195
+
196
+ use Symfony\Component\Intl\Countries;
197
+
198
+ \Locale::setDefault('en');
199
+
200
+ $numericCodes = Countries::getNumericCodes();
201
+ // ('alpha2Code' => 'numericCode')
202
+ // => ['AA' => '958', 'AD' => '020', ...]
203
+
204
+ $numericCode = Countries::getNumericCode('FR');
205
+ // => '250'
206
+
207
+ $alpha2 = Countries::getAlpha2FromNumeric('250');
208
+ // => 'FR'
209
+
210
+ $exists = Countries::numericCodeExists('250');
211
+ // => true
212
+
213
+ .. versionadded :: 6.4
214
+
215
+ The support for numeric country codes was introduced in Symfony 6.4.
216
+
182
217
Locales
183
218
~~~~~~~
184
219
@@ -435,6 +470,7 @@ Learn more
435
470
.. _`Unicode ISO 15924 Registry` : https://www.unicode.org/iso15924/iso15924-codes.html
436
471
.. _`ISO 3166-1 alpha-2` : https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
437
472
.. _`ISO 3166-1 alpha-3` : https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
473
+ .. _`ISO 3166-1 numeric` : https://en.wikipedia.org/wiki/ISO_3166-1_numeric
438
474
.. _`UTC/GMT time offsets` : https://en.wikipedia.org/wiki/List_of_UTC_time_offsets
439
475
.. _`daylight saving time (DST)` : https://en.wikipedia.org/wiki/Daylight_saving_time
440
476
.. _`ISO 639-1 alpha-2` : https://en.wikipedia.org/wiki/ISO_639-1
0 commit comments