PHP code example of dominservice / data_locale_parser

1. Go to this page and download the library: Download dominservice/data_locale_parser 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/ */

    

dominservice / data_locale_parser example snippets


use \Dominservice\DataLocaleParser\DataParser;

private $dataParser;

public function __construct() {
    $this->dataParser = new DataParser();
}

$this->dataParser->getListCountries('en');

$this->dataParser->getListCurrencies('en');

$this->dataParser->getListLanguages('en');

$this->dataParser->getCountry('PL', 'en');

$this->dataParser->getCurrency('PLN', 'en');

$this->dataParser->geLanguage('pl_PL', 'en');

 $this->dataParser->parseAllDataPerCountry('pl_PL');

Illuminate\Support\Collection {▼
  #items: [
    0 => {#1992 ▼
      +"so": "PL"
      +"iso3": "POL"
      +"iso_nr": "616"
      +"fips": "PL"
      +"continent": "EU"
      +"tld": ".pl"
      +"phone": "48"
      +"postal_code_format": "##-###"
      +"postal_code_regex": "^\d{2}-\d{3}$"
      +"currency": {#1991 ▼
        +"name": "złoty polski"
        +"code": "PLN"
        +"symbol": "zł"
      }
      +"languages": array:1 [▼
        "pl" => "polski"
      ]
      +"country": "Polska"
      +"subdivision_iso3166": Illuminate\Support\Collection {#2275 ▼
        #items: array:16 [▼
          "PL-02" => array:2 [▼
            "name" => "Dolnośląskie"
            "name_ascii" => "Dolnoslaskie"
          ]
          "PL-04" => array:2 [▼
            "name" => "Kujawsko-pomorskie"
            "name_ascii" => "Kujawsko-pomorskie"
          ]
          "PL-06" => array:2 [▼
            "name" => "Lubelskie"
            "name_ascii" => "Lubelskie"
          ]
          "PL-08" => array:2 [▼
            "name" => "Lubuskie"
            "name_ascii" => "Lubuskie"
          ]
          "PL-10" => array:2 [▼
            "name" => "Łódzkie"
            "name_ascii" => "Lodzkie"
          ]
          "PL-12" => array:2 [▼
            "name" => "Małopolskie"
            "name_ascii" => "Malopolskie"
          ]
          "PL-14" => array:2 [▼
            "name" => "Mazowieckie"
            "name_ascii" => "Mazowieckie"
          ]
          "PL-16" => array:2 [▼
            "name" => "Opolskie"
            "name_ascii" => "Opolskie"
          ]
          "PL-18" => array:2 [▼
            "name" => "Podkarpackie"
            "name_ascii" => "Podkarpackie"
          ]
          "PL-20" => array:2 [▼
            "name" => "Podlaskie"
            "name_ascii" => "Podlaskie"
          ]
          "PL-22" => array:2 [▼
            "name" => "Pomorskie"
            "name_ascii" => "Pomorskie"
          ]
          "PL-24" => array:2 [▼
            "name" => "Śląskie"
            "name_ascii" => "Slaskie"
          ]
          "PL-26" => array:2 [▶]
          "PL-28" => array:2 [▼
            "name" => "Warmińsko-mazurskie"
            "name_ascii" => "Warminsko-mazurskie"
          ]
          "PL-30" => array:2 [▼
            "name" => "Wielkopolskie"
            "name_ascii" => "Wielkopolskie"
          ]
          "PL-32" => array:2 [▼
            "name" => "Zachodniopomorskie"
            "name_ascii" => "Zachodniopomorskie"
          ]
        ]
      }
    }

    ...
}


 $this->dataParser->parseAllDataPerCountry('pl_PL', 'PL');