PHP code example of zenstruck / intl

1. Go to this page and download the library: Download zenstruck/intl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zenstruck / intl example snippets


// Provides the locales from the php resource
\Zenstruck\Intl\Locale::getAvailableLocales()

// Provides the locales as an assoc. array with the code as the key and name as the value
// Useful for a dropdown locale selector
\Zenstruck\Intl\Locale::getLocaleNames()

// Provides information for either the provided or default locale
\Zenstruck\Intl\Locale::getLocale('en_US')
\Zenstruck\Intl\Locale::getLocale()

// Provides only locales with both language and region set (ie "en_US", not "en")
\Zenstruck\Intl\Locale::getLocalesWithRegions()

// Provides the regions as an assoc. array with the code as the key and name as the value
\Zenstruck\Intl\Locale::getLocalesWithRegionNames()

// Provides language-only locales (ie "en", not "en_US")
\Zenstruck\Intl\Locale::getLanguages()

// Provides the languages as an assoc. array with the code as the key and name as the value
\Zenstruck\Intl\Locale::getLanguageNames()

// Provide the 3 digit ISO 4217 currency code for either the provided or default locale
\Zenstruck\Intl\Locale::getCurrency('en_US')
\Zenstruck\Intl\Locale::getCurrency()

// Provide the currency symbol for either the provided or default locale
\Zenstruck\Intl\Locale::getCurrencySymbol('en_US')
\Zenstruck\Intl\Locale::getCurrencySymbol()

composer install --dev

php bin/build.php