From e2fdeefe820962e4bcfbb2ca22d3525c98f77540 Mon Sep 17 00:00:00 2001 From: tigran90 <82959227+tigran90@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:20:57 +0300 Subject: [PATCH] New cli console && rename directory (#808) --- .gitignore | 8 +- bin/.env | 1 + bin/Commands/ExportCscNpm.php | 110 ++++++ bin/Commands/ExportCsv.php | 81 ++++ bin/Commands/ExportJson.php | 344 +++++++++++++++++ bin/Commands/ExportXml.php | 95 +++++ bin/Commands/ExportYaml.php | 85 +++++ bin/Support/Config.php | 115 ++++++ bin/Support/Env.php | 57 +++ bin/composer.json | 23 ++ bin/config/app.yaml | 11 + bin/config/phinx.yaml | 35 ++ bin/console | 68 ++++ ...0240708093950_add_languages_in_country.php | 43 +++ {scripts => bin}/export_plist.py | 0 .../add_currency_symbols_to_countries.php | 0 .../scripts}/add_lat_long_to_countries.php | 0 .../scripts}/add_lat_long_to_states.php | 0 .../add_numeric_codes_to_countries.php | 0 .../scripts}/add_region_to_countries.php | 0 .../scripts}/add_timezones_to_countries.php | 0 .../scripts}/add_tld_to_countries.php | 0 .../add_translations_to_countries.php | 0 {scripts/vendor => bin/scripts}/counter.txt | 0 .../vendor => bin/scripts}/fill_cities.php | 0 .../vendor => bin/scripts}/fill_countries.php | 0 .../vendor => bin/scripts}/fill_states.php | 0 .../vendor => bin/scripts}/fix_cities.php | 0 .../vendor => bin/scripts}/fix_duplicates.php | 0 .../vendor => bin/scripts}/fix_states.php | 0 .../scripts}/fixes/fix_iran_cities.php | 0 .../scripts}/fixes/fix_spain_cities.php | 0 .../vendor => bin/scripts}/get_cities.php | 0 .../scripts}/get_cities_by_state_country.php | 0 .../vendor => bin/scripts}/get_countries.php | 0 .../vendor => bin/scripts}/get_states.php | 0 {scripts/vendor => bin/scripts}/readme.md | 0 {scripts/vendor => bin/scripts}/test_api.php | 0 scripts/export.php | 349 ----------------- scripts/export_csc_npm.php | 90 ----- scripts/export_csv.php | 64 ---- scripts/export_xml.php | 78 ---- scripts/export_yaml.php | 71 ---- scripts/vendor/base.php | 34 -- scripts/vendor/composer.json | 10 - scripts/vendor/composer.lock | 351 ------------------ 46 files changed, 1074 insertions(+), 1049 deletions(-) create mode 100644 bin/.env create mode 100644 bin/Commands/ExportCscNpm.php create mode 100644 bin/Commands/ExportCsv.php create mode 100644 bin/Commands/ExportJson.php create mode 100644 bin/Commands/ExportXml.php create mode 100644 bin/Commands/ExportYaml.php create mode 100644 bin/Support/Config.php create mode 100644 bin/Support/Env.php create mode 100644 bin/composer.json create mode 100644 bin/config/app.yaml create mode 100644 bin/config/phinx.yaml create mode 100644 bin/console create mode 100644 bin/db/migrations/20240708093950_add_languages_in_country.php rename {scripts => bin}/export_plist.py (100%) rename {scripts/vendor => bin/scripts}/add_currency_symbols_to_countries.php (100%) rename {scripts/vendor => bin/scripts}/add_lat_long_to_countries.php (100%) rename {scripts/vendor => bin/scripts}/add_lat_long_to_states.php (100%) rename {scripts/vendor => bin/scripts}/add_numeric_codes_to_countries.php (100%) rename {scripts/vendor => bin/scripts}/add_region_to_countries.php (100%) rename {scripts/vendor => bin/scripts}/add_timezones_to_countries.php (100%) rename {scripts/vendor => bin/scripts}/add_tld_to_countries.php (100%) rename {scripts/vendor => bin/scripts}/add_translations_to_countries.php (100%) rename {scripts/vendor => bin/scripts}/counter.txt (100%) rename {scripts/vendor => bin/scripts}/fill_cities.php (100%) rename {scripts/vendor => bin/scripts}/fill_countries.php (100%) rename {scripts/vendor => bin/scripts}/fill_states.php (100%) rename {scripts/vendor => bin/scripts}/fix_cities.php (100%) rename {scripts/vendor => bin/scripts}/fix_duplicates.php (100%) rename {scripts/vendor => bin/scripts}/fix_states.php (100%) rename {scripts/vendor => bin/scripts}/fixes/fix_iran_cities.php (100%) rename {scripts/vendor => bin/scripts}/fixes/fix_spain_cities.php (100%) rename {scripts/vendor => bin/scripts}/get_cities.php (100%) rename {scripts/vendor => bin/scripts}/get_cities_by_state_country.php (100%) rename {scripts/vendor => bin/scripts}/get_countries.php (100%) rename {scripts/vendor => bin/scripts}/get_states.php (100%) rename {scripts/vendor => bin/scripts}/readme.md (100%) rename {scripts/vendor => bin/scripts}/test_api.php (100%) delete mode 100644 scripts/export.php delete mode 100644 scripts/export_csc_npm.php delete mode 100644 scripts/export_csv.php delete mode 100644 scripts/export_xml.php delete mode 100644 scripts/export_yaml.php delete mode 100644 scripts/vendor/base.php delete mode 100644 scripts/vendor/composer.json delete mode 100644 scripts/vendor/composer.lock diff --git a/.gitignore b/.gitignore index 3d7251329..0118161a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ .DS_Store -scripts/vendor/vendor -scripts/vendor/data/* +bin/vendor/vendor +bin/scripts/data/* issues/ csc/ base.php +.idea +/bin/vendor/ +composer.lock + diff --git a/bin/.env b/bin/.env new file mode 100644 index 000000000..34a009884 --- /dev/null +++ b/bin/.env @@ -0,0 +1 @@ +APP_ENVIRONMENT=production \ No newline at end of file diff --git a/bin/Commands/ExportCscNpm.php b/bin/Commands/ExportCscNpm.php new file mode 100644 index 000000000..90f2c09de --- /dev/null +++ b/bin/Commands/ExportCscNpm.php @@ -0,0 +1,110 @@ +getDB(); + $rootDir = PATH_BASE . '../..'; + + $i = 0; + $j = 0; + $k = 0; + + $countriesArray = array(); + $statesArray = array(); + $citiesArray = array(); + + $sql = "SELECT * FROM countries"; + $result = $db->query($sql); + if ($result->num_rows > 0) { + while ($row = $result->fetch_assoc()) { + // Pushing it into Fresh Array + $countriesArray[$i]['isoCode'] = $row['iso2']; + $countriesArray[$i]['name'] = $row['name']; + $countriesArray[$i]['phonecode'] = $row['phonecode']; + $countriesArray[$i]['flag'] = $row['emoji']; + $countriesArray[$i]['currency'] = $row['currency']; + $countriesArray[$i]['latitude'] = $row['latitude']; + $countriesArray[$i]['longitude'] = $row['longitude']; + $countriesArray[$i]['timezones'] = json_decode($row['timezones'], true); + + $i++; + } + } + + + $sql = "SELECT * FROM states"; + $result = $db->query($sql); + if ($result->num_rows > 0) { + while ($row = $result->fetch_assoc()) { + // Pushing it into Fresh Array + $statesArray[$j]['name'] = $row['name']; + $statesArray[$j]['isoCode'] = $row['iso2']; + $statesArray[$j]['countryCode'] = $row['country_code']; + $statesArray[$j]['latitude'] = $row['latitude']; + $statesArray[$j]['longitude'] = $row['longitude']; + + $j++; + } + } + + + $sql = "SELECT * FROM cities"; + $result = $db->query($sql); + if ($result->num_rows > 0) { + while ($row = $result->fetch_assoc()) { + // Pushing it into Fresh Array + $citiesArray[$k]['name'] = $row['name']; + $citiesArray[$k]['countryCode'] = $row['country_code']; + $citiesArray[$k]['stateCode'] = $row['state_code']; + $citiesArray[$k]['latitude'] = $row['latitude']; + $citiesArray[$k]['longitude'] = $row['longitude']; + + $k++; + } + } + + $output->writeln('Total Countries Count : ' . count($countriesArray)); + $output->writeln('Total States Count : ' . count($statesArray)); + $output->writeln('Total Cities Count : ' . count($citiesArray)); + + + $exportTo = $rootDir . '/csc/country.json'; + if(!is_dir($rootDir . '/csc')){ + mkdir($rootDir . '/csc', 777, true); + } + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($countriesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) . PHP_EOL); + $output->writeln('JSON Exported to ' . $exportTo); + fclose($fp); + + + $exportTo = $rootDir . '/csc/state.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($statesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) . PHP_EOL); + $output->writeln('JSON Exported to ' . $exportTo); + fclose($fp); + + + $exportTo = $rootDir . '/csc/city.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($citiesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) . PHP_EOL); + $output->writeln('JSON Exported to ' . $exportTo); + fclose($fp); + + $db->close(); + return 1; + + } +} \ No newline at end of file diff --git a/bin/Commands/ExportCsv.php b/bin/Commands/ExportCsv.php new file mode 100644 index 000000000..bcc79e126 --- /dev/null +++ b/bin/Commands/ExportCsv.php @@ -0,0 +1,81 @@ + array( + 'from' => '/countries.json', + 'to' => '/csv/countries.csv', + ), + 'states' => array( + 'from' => '/states.json', + 'to' => '/csv/states.csv', + ), + 'cities' => array( + 'from' => '/cities.json', + 'to' => '/csv/cities.csv', + ), + 'regions' => array( + 'from' => '/regions.json', + 'to' => '/csv/regions.csv', + ), + 'subregions' => array( + 'from' => '/subregions.json', + 'to' => '/csv/subregions.csv', + ), + ); + + foreach ($files as $root => $v) { + // Gets JSON file + $json = file_get_contents($rootDir . $v['from']); + + $csc = json_decode($json, true); + + $fp = fopen($rootDir . $v['to'], 'w'); // Putting Array to XML + + // Set headings + $headings = $csc[0]; + + // No translations please. + unset($headings['translations']); + fputcsv($fp, array_keys($headings)); + + // Loop through the associative array. + foreach ($csc as $row) { + // Update timezones to make readable + if (!empty($row['timezones'])) { + $row['timezones'] = json_encode($row['timezones']); + $row['timezones'] = preg_replace('/"/', "'", $row['timezones']); + $row['timezones'] = preg_replace("/'([a-zA-Z]+[a-zA-Z0-9_]*)':/", '$1:', $row['timezones']); + } + + // No translations please. + unset($row['translations']); + + // Write the row to the CSV file. + fputcsv($fp, $row); + }; + + fclose($fp); + + $output->writeln( 'CSV Exported to ' . $rootDir . $v['to'] ); + } + + return 1; + } + +} \ No newline at end of file diff --git a/bin/Commands/ExportJson.php b/bin/Commands/ExportJson.php new file mode 100644 index 000000000..294bcf01c --- /dev/null +++ b/bin/Commands/ExportJson.php @@ -0,0 +1,344 @@ +getDB(); + + $rootDir = PATH_BASE . '../..'; + + $r = 0; // regions + $s = 0; // suberegions + $i = 0; // states && states-cities + $j = 0; // cities + $k = 0; // countries-states-cities && countries-states + $l = 0; + $m = 0; // countries + + $countriesArray = array(); + $statesArray = array(); + $citiesArray = array(); + $stateCityArray = array(); + $countryStateArray = array(); + $countryCityArray = array(); + $countryStateCityArray = array(); + $regionsArray = array(); + $subregionsArray = array(); + $stateNamesArray = array(); + $cityNamesArray = array(); + + + // Fetching All Countries + $sql = "SELECT * FROM countries ORDER BY name"; + $result = $db->query($sql); + if ($result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + // Pushing it into Fresh Array + $countriesArray[$m]['id'] = (int)$row['id']; + $countriesArray[$m]['name'] = $row['name']; + $countriesArray[$m]['iso3'] = $row['iso3']; + $countriesArray[$m]['iso2'] = $row['iso2']; + $countriesArray[$m]['numeric_code'] = $row['numeric_code']; + $countriesArray[$m]['phone_code'] = $row['phonecode']; + $countriesArray[$m]['capital'] = $row['capital']; + $countriesArray[$m]['currency'] = $row['currency']; + $countriesArray[$m]['currency_name'] = $row['currency_name']; + $countriesArray[$m]['currency_symbol'] = $row['currency_symbol']; + $countriesArray[$m]['tld'] = $row['tld']; + $countriesArray[$m]['native'] = $row['native']; + $countriesArray[$m]['region'] = $row['region']; + $countriesArray[$m]['region_id'] = $row['region_id']; + $countriesArray[$m]['subregion'] = $row['subregion']; + $countriesArray[$m]['subregion_id'] = $row['subregion_id']; + $countriesArray[$m]['nationality'] = $row['nationality']; + $countriesArray[$m]['timezones'] = json_decode($row['timezones'], true); + $countriesArray[$m]['translations'] = json_decode($row['translations'], true); + $countriesArray[$m]['latitude'] = $row['latitude']; + $countriesArray[$m]['longitude'] = $row['longitude']; + $countriesArray[$m]['emoji'] = $row['emoji']; + $countriesArray[$m]['emojiU'] = $row['emojiU']; + + $m++; + } + } + +// Validating Country Names + foreach($countriesArray as $country) { + + $countryId = (int)$country['id']; + $countryStateCityArray[$k]['id'] = $countryId; + $countryStateCityArray[$k]['name'] = $country['name']; + $countryStateCityArray[$k]['iso3'] = $country['iso3']; + $countryStateCityArray[$k]['iso2'] = $country['iso2']; + $countryStateCityArray[$k]['numeric_code'] = $country['numeric_code']; + $countryStateCityArray[$k]['phone_code'] = $country['phone_code']; + $countryStateCityArray[$k]['capital'] = $country['capital']; + $countryStateCityArray[$k]['currency'] = $country['currency']; + $countryStateCityArray[$k]['currency_name'] = $country['currency_name']; + $countryStateCityArray[$k]['currency_symbol'] = $country['currency_symbol']; + $countryStateCityArray[$k]['tld'] = $country['tld']; + $countryStateCityArray[$k]['native'] = $country['native']; + $countryStateCityArray[$k]['region'] = $country['region']; + $countryStateCityArray[$k]['region_id'] = $country['region_id']; + $countryStateCityArray[$k]['subregion'] = $country['subregion']; + $countryStateCityArray[$k]['subregion_id'] = $country['subregion_id']; + $countryStateCityArray[$k]['nationality'] = $country['nationality']; + $countryStateCityArray[$k]['timezones'] = $country['timezones']; + $countryStateCityArray[$k]['translations'] = $country['translations']; + $countryStateCityArray[$k]['latitude'] = $country['latitude']; + $countryStateCityArray[$k]['longitude'] = $country['longitude']; + $countryStateCityArray[$k]['emoji'] = $country['emoji']; + $countryStateCityArray[$k]['emojiU'] = $country['emojiU']; + + // BREAK:: Sneaking in between to prepare country city array + array_push($countryCityArray, $countryStateCityArray[$k]); + $countryCityArray[$k]['cities'] = array(); + + // CONTINUE:: Filling up CountryStateCity Arry + $countryStateCityArray[$k]['states'] = array(); + + // Fetching All States Based on Country + $sql = "SELECT states.*, countries.name AS country_name FROM states JOIN countries ON states.country_id = countries.id WHERE country_id=$countryId ORDER BY NAME"; + $stateResult = $db->query($sql); + + $stateNamesArray = array(); + if ($stateResult->num_rows > 0) { + while($state = $stateResult->fetch_assoc()) { + + // Only States Array + $stateId = (int)$state['id']; + $stateName = $state['name']; + $countryName = $state['country_name']; + $statesArray[$i]['id'] = $stateId; + $statesArray[$i]['name'] = $stateName; + $statesArray[$i]['country_id'] = $countryId; + $statesArray[$i]['country_code'] = $state['country_code']; + $statesArray[$i]['country_name'] = $state['country_name']; + $statesArray[$i]['state_code'] = $state['iso2']; + $statesArray[$i]['type'] = $state['type']; + $statesArray[$i]['latitude'] = $state['latitude']; + $statesArray[$i]['longitude'] = $state['longitude']; + + // For Country State Array + $stateArr = array( + 'id' => $stateId, + 'name' => $stateName, + 'state_code' => $state['iso2'], + 'latitude' => $state['latitude'], + 'longitude' => $state['longitude'], + 'type' => $state['type'] + ); + + array_push($stateNamesArray, $stateArr); + + // Fetching All Cities Based on Country & State + $sql = "SELECT * FROM cities WHERE country_id=$countryId AND state_id=$stateId ORDER BY NAME"; + $cityResult = $db->query($sql); + + $cityNamesArray = array(); + if ($cityResult->num_rows > 0) { + while($city = $cityResult->fetch_assoc()) { + + // Only Cities Array + $cityId = (int)$city['id']; + $cityName = $city['name']; + $citiesArray[$j]['id'] = $cityId; + $citiesArray[$j]['name'] = $cityName; + $citiesArray[$j]['state_id'] = (int)$stateId; + $citiesArray[$j]['state_code'] = $city['state_code']; + $citiesArray[$j]['state_name'] = $stateName; + $citiesArray[$j]['country_id'] = (int)$countryId; + $citiesArray[$j]['country_code'] = $city['country_code']; + $citiesArray[$j]['country_name'] = $countryName; + $citiesArray[$j]['latitude'] = $city['latitude']; + $citiesArray[$j]['longitude'] = $city['longitude']; + $citiesArray[$j]['wikiDataId'] = $city['wikiDataId']; + + // For State City Array + array_push($cityNamesArray, array( + 'id' => $cityId, + 'name' => $cityName, + 'latitude' => $city['latitude'], + 'longitude' => $city['longitude'] + )); + + $j++; + } + } + + // Completing CountryStateCity Array State by State + $stateArr['cities'] = $cityNamesArray; + array_push($countryStateCityArray[$k]['states'], $stateArr); + + // Completing StateCity Array + $stateCityArray[$i]['id'] = $stateId; + $stateCityArray[$i]['name'] = $stateName; + $stateCityArray[$i]['state_code'] = $state['iso2']; + $stateCityArray[$i]['latitude'] = $state['latitude']; + $stateCityArray[$i]['longitude'] = $state['longitude']; + $stateCityArray[$i]['country_id'] = $countryId; + $stateCityArray[$i]['cities'] = $cityNamesArray; + + $i++; + } + } + + // Completing Country States Array + $countryStateArray[$k]['name'] = $country['name']; + $countryStateArray[$k]['iso3'] = $country['iso3']; + $countryStateArray[$k]['iso2'] = $country['iso2']; + $countryStateArray[$k]['numeric_code'] = $country['numeric_code']; + $countryStateArray[$k]['phone_code'] = $country['phone_code']; + $countryStateArray[$k]['capital'] = $country['capital']; + $countryStateArray[$k]['currency'] = $country['currency']; + $countryStateArray[$k]['currency_name'] = $country['currency_name']; + $countryStateArray[$k]['currency_symbol'] = $country['currency_symbol']; + $countryStateArray[$k]['tld'] = $country['tld']; + $countryStateArray[$k]['native'] = $country['native']; + $countryStateArray[$k]['region'] = $country['region']; + $countryStateArray[$k]['region_id'] = $country['region_id']; + $countryStateArray[$k]['subregion'] = $country['subregion']; + $countryStateArray[$k]['subregion_id'] = $country['subregion_id']; + $countryStateArray[$k]['nationality'] = $country['nationality']; + $countryStateArray[$k]['timezones'] = $country['timezones']; + $countryStateArray[$k]['translations'] = $country['translations']; + $countryStateArray[$k]['latitude'] = $country['latitude']; + $countryStateArray[$k]['longitude'] = $country['longitude']; + $countryStateArray[$k]['emoji'] = $country['emoji']; + $countryStateArray[$k]['emojiU'] = $country['emojiU']; + $countryStateArray[$k]['states'] = $stateNamesArray; + + // Fetching All Cities Based on Country + $sql = "SELECT id, name, latitude, longitude FROM cities WHERE country_id=$countryId ORDER BY NAME"; + $citiesResult = $db->query($sql); + + $citiesNamesArray = array(); + if ($citiesResult->num_rows > 0) { + while($city = $citiesResult->fetch_assoc()) { + // For State City Array + array_push($citiesNamesArray, array( + 'id' => (int)$city['id'], + 'name' => $city['name'], + 'latitude' => $city['latitude'], + 'longitude' => $city['longitude'] + )); + } + } + + $countryCityArray[$k]['cities'] = $citiesNamesArray; + + $k++; + + } + +// Fetching All Regions + $sql = "SELECT * FROM regions ORDER BY name"; + $result = $db->query($sql); + if ($result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + // Pushing it into Fresh Array + $regionsArray[$r]['id'] = (int)$row['id']; + $regionsArray[$r]['name'] = $row['name']; + $regionsArray[$r]['translations'] = json_decode($row['translations'], true); + $regionsArray[$r]['wikiDataId'] = $row['wikiDataId']; + + $r++; + } + } + + + $sql = "SELECT * FROM subregions ORDER BY name"; + $result = $db->query($sql); + if ($result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + // Pushing it into Fresh Array + $subregionsArray[$s]['id'] = (int)$row['id']; + $subregionsArray[$s]['name'] = $row['name']; + $subregionsArray[$s]['region_id'] = $row['region_id']; + $subregionsArray[$s]['translations'] = json_decode($row['translations'], true); + $subregionsArray[$s]['wikiDataId'] = $row['wikiDataId']; + $s++; + } + } + + $output->writeln('Total Regions Count : '.count($regionsArray) ); + $output->writeln('Total Subregions Count : '.count($subregionsArray)); + $output->writeln('Total Countries Count : '.count($countriesArray)); + $output->writeln('Total States Count : '.count($statesArray)); + $output->writeln('Total Cities Count : '.count($citiesArray)); + + $exportTo = $rootDir . '/countries.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($countriesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); + $output->writeln('JSON Exported to ' .$exportTo ); + fclose($fp); + + + $exportTo = $rootDir . '/states.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($statesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); + $output->writeln( 'JSON Exported to ' .$exportTo ); + fclose($fp); + + $exportTo = $rootDir . '/cities.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($citiesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); + $output->writeln( 'JSON Exported to ' .$exportTo ); + fclose($fp); + + $exportTo = $rootDir . '/states+cities.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($stateCityArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); + $output->writeln( 'JSON Exported to ' .$exportTo ); + fclose($fp); + + $exportTo = $rootDir . '/countries+states.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($countryStateArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); + $output->writeln( 'JSON Exported to ' .$exportTo ); + fclose($fp); + + $exportTo = $rootDir . '/countries+cities.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($countryCityArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); + $output->writeln( 'JSON Exported to ' .$exportTo ); + fclose($fp); + + $exportTo = $rootDir . '/countries+states+cities.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($countryStateCityArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); + $output->writeln( 'JSON Exported to ' .$exportTo ); + fclose($fp); + + $exportTo = $rootDir . '/regions.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($regionsArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); + $output->writeln( 'JSON Exported to ' .$exportTo ); + fclose($fp); + + $exportTo = $rootDir . '/subregions.json'; + $fp = fopen($exportTo, 'w'); // Putting Array to JSON + fwrite($fp, json_encode($subregionsArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); + $output->writeln( 'JSON Exported to ' .$exportTo ); + fclose($fp); + + + $db->close(); + + + return 1; + } + + +} \ No newline at end of file diff --git a/bin/Commands/ExportXml.php b/bin/Commands/ExportXml.php new file mode 100644 index 000000000..97208611b --- /dev/null +++ b/bin/Commands/ExportXml.php @@ -0,0 +1,95 @@ + array( + 'from' => '/regions.json', + 'to' => '/xml/regions.xml', + 'singular' => 'region', + ), + 'subregions' => array( + 'from' => '/subregions.json', + 'to' => '/xml/subregions.xml', + 'singular' => 'subregion', + ), + 'countries' => array( + 'from' => '/countries.json', + 'to' => '/xml/countries.xml', + 'singular' => 'country', + ), + 'states' => array( + 'from' => '/states.json', + 'to' => '/xml/states.xml', + 'singular' => 'state', + ), + 'cities' => array( + 'from' => '/cities.json', + 'to' => '/xml/cities.xml', + 'singular' => 'city', + ), + 'states_cities' => array( + 'from' => '/states+cities.json', + 'to' => '/xml/states+cities.xml', + 'singular' => 'state_city', + ), + 'countries_states' => array( + 'from' => '/countries+states.json', + 'to' => '/xml/countries+states.xml', + 'singular' => 'country_state', + ), + 'countries_cities' => array( + 'from' => '/countries+cities.json', + 'to' => '/xml/countries+cities.xml', + 'singular' => 'country_city', + ), + 'countries_states_cities' => array( + 'from' => '/countries+states+cities.json', + 'to' => '/xml/countries+states+cities.xml', + 'singular' => 'country_state_city', + ), + ); + + foreach ($files as $root => $v) { + // Gets JSON file + $json = file_get_contents($rootDir . $v['from']); + + $csc = array($v['singular'] => json_decode($json, true)); + + // Converts PHP Array to XML with the root element being 'root-element-here' + $xml = ArrayToXml::convert( + $csc, + $root, + false, + 'UTF-8', + '1.0', + ['formatOutput' => true] + ); + + $fp = fopen($rootDir . $v['to'], 'w'); // Writing XML to File + fwrite($fp, $xml); + fclose($fp); + + $output->writeln('XML Exported to ' . $rootDir . $v['to'] ) ; + } + + return 1; + + } + + +} \ No newline at end of file diff --git a/bin/Commands/ExportYaml.php b/bin/Commands/ExportYaml.php new file mode 100644 index 000000000..368079a2d --- /dev/null +++ b/bin/Commands/ExportYaml.php @@ -0,0 +1,85 @@ + array( + 'from' => '/regions.json', + 'to' => '/yml/regions.yml', + 'singular' => 'region', + ), + 'subregions' => array( + 'from' => '/subregions.json', + 'to' => '/yml/subregions.yml', + 'singular' => 'subregion', + ), + 'countries' => array( + 'from' => '/countries.json', + 'to' => '/yml/countries.yml', + 'singular' => 'country', + ), + 'states' => array( + 'from' => '/states.json', + 'to' => '/yml/states.yml', + 'singular' => 'state', + ), + 'cities' => array( + 'from' => '/cities.json', + 'to' => '/yml/cities.yml', + 'singular' => 'city', + ), + 'states_cities' => array( + 'from' => '/states+cities.json', + 'to' => '/yml/states+cities.yml', + 'singular' => 'state_city', + ), + 'countries_states' => array( + 'from' => '/countries+states.json', + 'to' => '/yml/countries+states.yml', + 'singular' => 'country_state', + ), + 'countries_cities' => array( + 'from' => '/countries+cities.json', + 'to' => '/yml/countries+cities.yml', + 'singular' => 'country_city', + ), + 'countries_states_cities' => array( + 'from' => '/countries+states+cities.json', + 'to' => '/yml/countries+states+cities.yml', + 'singular' => 'country_state_city', + ), + ); + + foreach ($files as $root => $v) { + $json = file_get_contents($rootDir . $v['from']); + + $csc = array($v['singular'] => json_decode($json)); + + // Converts PHP Array to YAML + $yml = Yaml::dump($csc, 7, 2, Yaml::DUMP_OBJECT_AS_MAP); + + $fp = fopen($rootDir . $v['to'], 'w'); // Writing YAML to File + fwrite($fp, $yml); + fclose($fp); + + $output->writeln( 'YAML Exported to ' . $rootDir . $v['to'] ); + } + + return 1; + } +} \ No newline at end of file diff --git a/bin/Support/Config.php b/bin/Support/Config.php new file mode 100644 index 000000000..e61312609 --- /dev/null +++ b/bin/Support/Config.php @@ -0,0 +1,115 @@ +env = new Env(PATH_BASE . '/'); + + $_ENV["PHINX_DBHOST"] = $this->getSettings()->get('database.mysql.hostname'); + $_ENV["PHINX_DBNAME"] = $this->getSettings()->get('database.mysql.database'); + $_ENV["PHINX_DBUSER"] = $this->getSettings()->get('database.mysql.username'); + $_ENV["PHINX_DBPASS"] = $this->getSettings()->get('database.mysql.password'); + $_ENV["PHINX_DBPORT"] = $this->getSettings()->get('database.mysql.port'); + $_ENV["PHINX_APPENVIRONMENT"] = $this->getEnv()->get('APP_ENVIRONMENT'); + $_ENV["PHINX_PATH_MIGRATIONS"] = PATH_BASE.'/db'; + } + + /** + * @return Env + */ + public function getEnv(): Env + { + return $this->env; + } + + /** + * @param string $name + * @param $level + * @return Logger + */ + public function getLogger(string $name = "app_logger", $level = Level::Debug): Logger + { + if (isset($this->logger[$name])) { + return $this->logger[$name]; + } + + $path = $this->getConfig()->get('application.path_log'); + + $stream = new StreamHandler(PATH_BASE . $path . '/' . $level . '.log', $level); + $firephp = new FirePHPHandler(); + + $logger = new Logger($name); + $logger->pushHandler($stream); + + return $this->logger[$name] = $logger; + } + + public function getSettings(): YamlConfig + { + if (!empty($this->yamlConfig)) { + return $this->yamlConfig; + } + $config = new YamlConfig(PATH_BASE . '/config/app.yaml'); + $config->set('path_base', PATH_BASE); + $config->set('env', $this->env); + + return $this->yamlConfig = $config; + } + + + public function getDB() + { + $conn = new mysqli( + $this->getSettings()->get('database.mysql.hostname'), + $this->getSettings()->get('database.mysql.username'), + $this->getSettings()->get('database.mysql.password'), + $this->getSettings()->get('database.mysql.database'), + $this->getSettings()->get('database.mysql.port') + ); + + if ($conn->connect_error) { + throw new Exception("Connection failed: " . $conn->connect_error); + } + if (!$conn->set_charset("utf8mb4")) { + throw new Exception("Error loading character set utf8: %s\n", $conn->error); + } + return $conn; + } + + +} \ No newline at end of file diff --git a/bin/Support/Env.php b/bin/Support/Env.php new file mode 100644 index 000000000..7614d4a97 --- /dev/null +++ b/bin/Support/Env.php @@ -0,0 +1,57 @@ +repository = $repository ?? RepositoryBuilder::createWithDefaultAdapters()->immutable()->make(); + $this->dotenv = Dotenv::create($this->repository, $paths, $names); + $this->dotenv->load(); + } + + /* + * Get the value of the environment variable, returning $default if it is not defined. + */ + public function get(string $key, $default = null): ?string + { + return $this->repository->get($key) ?? $default; + } + + /* + * Get the value of the environment variable as a boolean, returning $default if it is not defined. + * + * Note, that this method maps the string value of "false" (of whatever case) to the PHP boolean type false + * + */ + public function getBool(string $key, bool $default = false): bool + { + $value = $this->get($key); + if ($value === null) { + return $default; + } + + if (strtolower($value) === 'false') { + return false; + } + + return (bool)$value; + } +} \ No newline at end of file diff --git a/bin/composer.json b/bin/composer.json new file mode 100644 index 000000000..5f38ecb75 --- /dev/null +++ b/bin/composer.json @@ -0,0 +1,23 @@ +{ + "name": "dr5hn/csc-db", + "description": "Full Database of city state country available in JSON and SQL Format All Countries, States & Cities are Covered and Populated with Different Combinations & Versions.", + "version": "v0.2", + "config": { + "vendor-dir": "vendor" + }, + "minimum-stability": "stable", + "require": { + "mashape/unirest-php": "^3.0", + "spatie/array-to-xml": "^3.3.0", + "symfony/yaml": "^6.0", + "nesbot/carbon": "^3.6", + "symfony/console": "^6.4", + "hassankhan/config": "^3.1", + "monolog/monolog": "^3.7", + "vlucas/phpdotenv": "^5.6", + "robmorgan/phinx": "^0.16.1" + }, + "autoload": { + "psr-4": { "bin\\": ["../bin"] } + } +} diff --git a/bin/config/app.yaml b/bin/config/app.yaml new file mode 100644 index 000000000..f279f78aa --- /dev/null +++ b/bin/config/app.yaml @@ -0,0 +1,11 @@ +application: + name: ady_microservices_users + path_log: "/logs" + +database: + mysql: + hostname: "127.0.0.1" + port: "3306" + username: "root" + password: "asdf1234#" + database: "countries-states-cities-database" \ No newline at end of file diff --git a/bin/config/phinx.yaml b/bin/config/phinx.yaml new file mode 100644 index 000000000..3965c1710 --- /dev/null +++ b/bin/config/phinx.yaml @@ -0,0 +1,35 @@ +paths: + migrations: '%%PHINX_PATH_MIGRATIONS%%/migrations' + seeds: '%%PHINX_PATH_MIGRATIONS%%/seeds' +environments: + default_migration_table: migrations + default_environment: '%%PHINX_APPENVIRONMENT%%' + production: + adapter: mysql + host: '%%PHINX_DBHOST%%' + name: '%%PHINX_DBNAME%%' + user: '%%PHINX_DBUSER%%' + pass: '%%PHINX_DBPASS%%' + port: '%%PHINX_DBPORT%%' + charset: utf8 + collation: utf8mb4_general_ci + + development: + adapter: mysql + host: '%%PHINX_DBHOST%%' + name: '%%PHINX_DBNAME%%' + user: '%%PHINX_DBUSER%%' + pass: '%%PHINX_DBPASS%%' + port: '%%PHINX_DBPORT%%' + charset: utf8 + collation: utf8mb4_general_ci + testing: + adapter: mysql + host: '%%PHINX_DBHOST%%' + name: '%%PHINX_DBNAME%%' + user: '%%PHINX_DBUSER%%' + pass: '%%PHINX_DBPASS%%' + port: '%%PHINX_DBPORT%%' + charset: utf8 + collation: utf8mb4_general_ci +version_order: creation diff --git a/bin/console b/bin/console new file mode 100644 index 000000000..db88446c2 --- /dev/null +++ b/bin/console @@ -0,0 +1,68 @@ +#!/usr/bin/env php +addCommands($classes); + $this->addCommands([ + (new Create())->setName('manage:create'), + (new Migrate())->setName('manage:migrate'), + (new Rollback())->setName('manage:rollback'), + (new Status())->setName('manage:status'), + (new Breakpoint())->setName('manage:breakpoint'), + (new SeedCreate())->setName('seed:create'), + (new SeedRun())->setName('seed:run'), + ]); + } + + public function doRun(InputInterface $input, OutputInterface $output) + { + if (($input->hasParameterOption(['--help', '-h']) !== false) || ($input->getFirstArgument() !== null && $input->getFirstArgument() !== 'list')) { + $output->writeln($this->getLongVersion(). ' start at ' . Carbon::now() ); + $output->writeln(''); + } + return parent::doRun($input, $output); + } +} + +$application = new ConsoleApplication(); +$application->run(); \ No newline at end of file diff --git a/bin/db/migrations/20240708093950_add_languages_in_country.php b/bin/db/migrations/20240708093950_add_languages_in_country.php new file mode 100644 index 000000000..566a8096c --- /dev/null +++ b/bin/db/migrations/20240708093950_add_languages_in_country.php @@ -0,0 +1,43 @@ +table('countries'); + if (!$table->hasColumn('language')) { + $table->addColumn( + 'language', + 'string', + ['limit' => 5, 'default' => null, 'null' => true, 'after' => 'currency_symbol'] + ) + ->update(); + } + + $sql1=" + UPDATE countries SET language = 'hy-AM' WHERE iso3 ='ARM'; + UPDATE countries SET language = 'ru-RU' WHERE iso3 ='RUS'; + UPDATE countries SET language = 'en-US' WHERE iso3 ='USA'; + UPDATE countries SET language = 'en-GB' WHERE iso3 ='GBR'; + UPDATE countries SET language = 'it-IT' WHERE iso3 ='ITA'; + UPDATE countries SET language = 'fr-FR' WHERE iso3 ='FRA'; + "; + + $this->execute($sql1); + } +} diff --git a/scripts/export_plist.py b/bin/export_plist.py similarity index 100% rename from scripts/export_plist.py rename to bin/export_plist.py diff --git a/scripts/vendor/add_currency_symbols_to_countries.php b/bin/scripts/add_currency_symbols_to_countries.php similarity index 100% rename from scripts/vendor/add_currency_symbols_to_countries.php rename to bin/scripts/add_currency_symbols_to_countries.php diff --git a/scripts/vendor/add_lat_long_to_countries.php b/bin/scripts/add_lat_long_to_countries.php similarity index 100% rename from scripts/vendor/add_lat_long_to_countries.php rename to bin/scripts/add_lat_long_to_countries.php diff --git a/scripts/vendor/add_lat_long_to_states.php b/bin/scripts/add_lat_long_to_states.php similarity index 100% rename from scripts/vendor/add_lat_long_to_states.php rename to bin/scripts/add_lat_long_to_states.php diff --git a/scripts/vendor/add_numeric_codes_to_countries.php b/bin/scripts/add_numeric_codes_to_countries.php similarity index 100% rename from scripts/vendor/add_numeric_codes_to_countries.php rename to bin/scripts/add_numeric_codes_to_countries.php diff --git a/scripts/vendor/add_region_to_countries.php b/bin/scripts/add_region_to_countries.php similarity index 100% rename from scripts/vendor/add_region_to_countries.php rename to bin/scripts/add_region_to_countries.php diff --git a/scripts/vendor/add_timezones_to_countries.php b/bin/scripts/add_timezones_to_countries.php similarity index 100% rename from scripts/vendor/add_timezones_to_countries.php rename to bin/scripts/add_timezones_to_countries.php diff --git a/scripts/vendor/add_tld_to_countries.php b/bin/scripts/add_tld_to_countries.php similarity index 100% rename from scripts/vendor/add_tld_to_countries.php rename to bin/scripts/add_tld_to_countries.php diff --git a/scripts/vendor/add_translations_to_countries.php b/bin/scripts/add_translations_to_countries.php similarity index 100% rename from scripts/vendor/add_translations_to_countries.php rename to bin/scripts/add_translations_to_countries.php diff --git a/scripts/vendor/counter.txt b/bin/scripts/counter.txt similarity index 100% rename from scripts/vendor/counter.txt rename to bin/scripts/counter.txt diff --git a/scripts/vendor/fill_cities.php b/bin/scripts/fill_cities.php similarity index 100% rename from scripts/vendor/fill_cities.php rename to bin/scripts/fill_cities.php diff --git a/scripts/vendor/fill_countries.php b/bin/scripts/fill_countries.php similarity index 100% rename from scripts/vendor/fill_countries.php rename to bin/scripts/fill_countries.php diff --git a/scripts/vendor/fill_states.php b/bin/scripts/fill_states.php similarity index 100% rename from scripts/vendor/fill_states.php rename to bin/scripts/fill_states.php diff --git a/scripts/vendor/fix_cities.php b/bin/scripts/fix_cities.php similarity index 100% rename from scripts/vendor/fix_cities.php rename to bin/scripts/fix_cities.php diff --git a/scripts/vendor/fix_duplicates.php b/bin/scripts/fix_duplicates.php similarity index 100% rename from scripts/vendor/fix_duplicates.php rename to bin/scripts/fix_duplicates.php diff --git a/scripts/vendor/fix_states.php b/bin/scripts/fix_states.php similarity index 100% rename from scripts/vendor/fix_states.php rename to bin/scripts/fix_states.php diff --git a/scripts/vendor/fixes/fix_iran_cities.php b/bin/scripts/fixes/fix_iran_cities.php similarity index 100% rename from scripts/vendor/fixes/fix_iran_cities.php rename to bin/scripts/fixes/fix_iran_cities.php diff --git a/scripts/vendor/fixes/fix_spain_cities.php b/bin/scripts/fixes/fix_spain_cities.php similarity index 100% rename from scripts/vendor/fixes/fix_spain_cities.php rename to bin/scripts/fixes/fix_spain_cities.php diff --git a/scripts/vendor/get_cities.php b/bin/scripts/get_cities.php similarity index 100% rename from scripts/vendor/get_cities.php rename to bin/scripts/get_cities.php diff --git a/scripts/vendor/get_cities_by_state_country.php b/bin/scripts/get_cities_by_state_country.php similarity index 100% rename from scripts/vendor/get_cities_by_state_country.php rename to bin/scripts/get_cities_by_state_country.php diff --git a/scripts/vendor/get_countries.php b/bin/scripts/get_countries.php similarity index 100% rename from scripts/vendor/get_countries.php rename to bin/scripts/get_countries.php diff --git a/scripts/vendor/get_states.php b/bin/scripts/get_states.php similarity index 100% rename from scripts/vendor/get_states.php rename to bin/scripts/get_states.php diff --git a/scripts/vendor/readme.md b/bin/scripts/readme.md similarity index 100% rename from scripts/vendor/readme.md rename to bin/scripts/readme.md diff --git a/scripts/vendor/test_api.php b/bin/scripts/test_api.php similarity index 100% rename from scripts/vendor/test_api.php rename to bin/scripts/test_api.php diff --git a/scripts/export.php b/scripts/export.php deleted file mode 100644 index ed14e4bae..000000000 --- a/scripts/export.php +++ /dev/null @@ -1,349 +0,0 @@ -query($sql); -if ($result->num_rows > 0) { - while($row = $result->fetch_assoc()) { - // Pushing it into Fresh Array - $countriesArray[$m]['id'] = (int)$row['id']; - $countriesArray[$m]['name'] = $row['name']; - $countriesArray[$m]['iso3'] = $row['iso3']; - $countriesArray[$m]['iso2'] = $row['iso2']; - $countriesArray[$m]['numeric_code'] = $row['numeric_code']; - $countriesArray[$m]['phone_code'] = $row['phonecode']; - $countriesArray[$m]['capital'] = $row['capital']; - $countriesArray[$m]['currency'] = $row['currency']; - $countriesArray[$m]['currency_name'] = $row['currency_name']; - $countriesArray[$m]['currency_symbol'] = $row['currency_symbol']; - $countriesArray[$m]['tld'] = $row['tld']; - $countriesArray[$m]['native'] = $row['native']; - $countriesArray[$m]['region'] = $row['region']; - $countriesArray[$m]['region_id'] = $row['region_id']; - $countriesArray[$m]['subregion'] = $row['subregion']; - $countriesArray[$m]['subregion_id'] = $row['subregion_id']; - $countriesArray[$m]['nationality'] = $row['nationality']; - $countriesArray[$m]['timezones'] = json_decode($row['timezones'], true); - $countriesArray[$m]['translations'] = json_decode($row['translations'], true); - $countriesArray[$m]['latitude'] = $row['latitude']; - $countriesArray[$m]['longitude'] = $row['longitude']; - $countriesArray[$m]['emoji'] = $row['emoji']; - $countriesArray[$m]['emojiU'] = $row['emojiU']; - - $m++; - } -} - -// Validating Country Names -foreach($countriesArray as $country) { - - $countryId = (int)$country['id']; - $countryStateCityArray[$k]['id'] = $countryId; - $countryStateCityArray[$k]['name'] = $country['name']; - $countryStateCityArray[$k]['iso3'] = $country['iso3']; - $countryStateCityArray[$k]['iso2'] = $country['iso2']; - $countryStateCityArray[$k]['numeric_code'] = $country['numeric_code']; - $countryStateCityArray[$k]['phone_code'] = $country['phone_code']; - $countryStateCityArray[$k]['capital'] = $country['capital']; - $countryStateCityArray[$k]['currency'] = $country['currency']; - $countryStateCityArray[$k]['currency_name'] = $country['currency_name']; - $countryStateCityArray[$k]['currency_symbol'] = $country['currency_symbol']; - $countryStateCityArray[$k]['tld'] = $country['tld']; - $countryStateCityArray[$k]['native'] = $country['native']; - $countryStateCityArray[$k]['region'] = $country['region']; - $countryStateCityArray[$k]['region_id'] = $country['region_id']; - $countryStateCityArray[$k]['subregion'] = $country['subregion']; - $countryStateCityArray[$k]['subregion_id'] = $country['subregion_id']; - $countryStateCityArray[$k]['nationality'] = $country['nationality']; - $countryStateCityArray[$k]['timezones'] = $country['timezones']; - $countryStateCityArray[$k]['translations'] = $country['translations']; - $countryStateCityArray[$k]['latitude'] = $country['latitude']; - $countryStateCityArray[$k]['longitude'] = $country['longitude']; - $countryStateCityArray[$k]['emoji'] = $country['emoji']; - $countryStateCityArray[$k]['emojiU'] = $country['emojiU']; - - // BREAK:: Sneaking in between to prepare country city array - array_push($countryCityArray, $countryStateCityArray[$k]); - $countryCityArray[$k]['cities'] = array(); - - // CONTINUE:: Filling up CountryStateCity Arry - $countryStateCityArray[$k]['states'] = array(); - - // Fetching All States Based on Country - $sql = "SELECT states.*, countries.name AS country_name FROM states JOIN countries ON states.country_id = countries.id WHERE country_id=$countryId ORDER BY NAME"; - $stateResult = $conn->query($sql); - - $stateNamesArray = array(); - if ($stateResult->num_rows > 0) { - while($state = $stateResult->fetch_assoc()) { - - // Only States Array - $stateId = (int)$state['id']; - $stateName = $state['name']; - $countryName = $state['country_name']; - $statesArray[$i]['id'] = $stateId; - $statesArray[$i]['name'] = $stateName; - $statesArray[$i]['country_id'] = $countryId; - $statesArray[$i]['country_code'] = $state['country_code']; - $statesArray[$i]['country_name'] = $state['country_name']; - $statesArray[$i]['state_code'] = $state['iso2']; - $statesArray[$i]['type'] = $state['type']; - $statesArray[$i]['latitude'] = $state['latitude']; - $statesArray[$i]['longitude'] = $state['longitude']; - - // For Country State Array - $stateArr = array( - 'id' => $stateId, - 'name' => $stateName, - 'state_code' => $state['iso2'], - 'latitude' => $state['latitude'], - 'longitude' => $state['longitude'], - 'type' => $state['type'] - ); - - array_push($stateNamesArray, $stateArr); - - // Fetching All Cities Based on Country & State - $sql = "SELECT * FROM cities WHERE country_id=$countryId AND state_id=$stateId ORDER BY NAME"; - $cityResult = $conn->query($sql); - - $cityNamesArray = array(); - if ($cityResult->num_rows > 0) { - while($city = $cityResult->fetch_assoc()) { - - // Only Cities Array - $cityId = (int)$city['id']; - $cityName = $city['name']; - $citiesArray[$j]['id'] = $cityId; - $citiesArray[$j]['name'] = $cityName; - $citiesArray[$j]['state_id'] = (int)$stateId; - $citiesArray[$j]['state_code'] = $city['state_code']; - $citiesArray[$j]['state_name'] = $stateName; - $citiesArray[$j]['country_id'] = (int)$countryId; - $citiesArray[$j]['country_code'] = $city['country_code']; - $citiesArray[$j]['country_name'] = $countryName; - $citiesArray[$j]['latitude'] = $city['latitude']; - $citiesArray[$j]['longitude'] = $city['longitude']; - $citiesArray[$j]['wikiDataId'] = $city['wikiDataId']; - - // For State City Array - array_push($cityNamesArray, array( - 'id' => $cityId, - 'name' => $cityName, - 'latitude' => $city['latitude'], - 'longitude' => $city['longitude'] - )); - - $j++; - } - } - - // Completing CountryStateCity Array State by State - $stateArr['cities'] = $cityNamesArray; - array_push($countryStateCityArray[$k]['states'], $stateArr); - - // Completing StateCity Array - $stateCityArray[$i]['id'] = $stateId; - $stateCityArray[$i]['name'] = $stateName; - $stateCityArray[$i]['state_code'] = $state['iso2']; - $stateCityArray[$i]['latitude'] = $state['latitude']; - $stateCityArray[$i]['longitude'] = $state['longitude']; - $stateCityArray[$i]['country_id'] = $countryId; - $stateCityArray[$i]['cities'] = $cityNamesArray; - - $i++; - } - } - - // Completing Country States Array - $countryStateArray[$k]['name'] = $country['name']; - $countryStateArray[$k]['iso3'] = $country['iso3']; - $countryStateArray[$k]['iso2'] = $country['iso2']; - $countryStateArray[$k]['numeric_code'] = $country['numeric_code']; - $countryStateArray[$k]['phone_code'] = $country['phone_code']; - $countryStateArray[$k]['capital'] = $country['capital']; - $countryStateArray[$k]['currency'] = $country['currency']; - $countryStateArray[$k]['currency_name'] = $country['currency_name']; - $countryStateArray[$k]['currency_symbol'] = $country['currency_symbol']; - $countryStateArray[$k]['tld'] = $country['tld']; - $countryStateArray[$k]['native'] = $country['native']; - $countryStateArray[$k]['region'] = $country['region']; - $countryStateArray[$k]['region_id'] = $country['region_id']; - $countryStateArray[$k]['subregion'] = $country['subregion']; - $countryStateArray[$k]['subregion_id'] = $country['subregion_id']; - $countryStateArray[$k]['nationality'] = $country['nationality']; - $countryStateArray[$k]['timezones'] = $country['timezones']; - $countryStateArray[$k]['translations'] = $country['translations']; - $countryStateArray[$k]['latitude'] = $country['latitude']; - $countryStateArray[$k]['longitude'] = $country['longitude']; - $countryStateArray[$k]['emoji'] = $country['emoji']; - $countryStateArray[$k]['emojiU'] = $country['emojiU']; - $countryStateArray[$k]['states'] = $stateNamesArray; - - // Fetching All Cities Based on Country - $sql = "SELECT id, name, latitude, longitude FROM cities WHERE country_id=$countryId ORDER BY NAME"; - $citiesResult = $conn->query($sql); - - $citiesNamesArray = array(); - if ($citiesResult->num_rows > 0) { - while($city = $citiesResult->fetch_assoc()) { - // For State City Array - array_push($citiesNamesArray, array( - 'id' => (int)$city['id'], - 'name' => $city['name'], - 'latitude' => $city['latitude'], - 'longitude' => $city['longitude'] - )); - } - } - - $countryCityArray[$k]['cities'] = $citiesNamesArray; - - $k++; - -} - -// Fetching All Regions -$sql = "SELECT * FROM regions ORDER BY name"; -$result = $conn->query($sql); -if ($result->num_rows > 0) { - while($row = $result->fetch_assoc()) { - // Pushing it into Fresh Array - $regionsArray[$r]['id'] = (int)$row['id']; - $regionsArray[$r]['name'] = $row['name']; - $regionsArray[$r]['translations'] = json_decode($row['translations'], true); - $regionsArray[$r]['wikiDataId'] = $row['wikiDataId']; - - $r++; - } -} - -// Fetching All Subregions -$sql = "SELECT * FROM subregions ORDER BY name"; -$result = $conn->query($sql); -if ($result->num_rows > 0) { - while($row = $result->fetch_assoc()) { - // Pushing it into Fresh Array - $subregionsArray[$s]['id'] = (int)$row['id']; - $subregionsArray[$s]['name'] = $row['name']; - $subregionsArray[$s]['region_id'] = $row['region_id']; - $subregionsArray[$s]['translations'] = json_decode($row['translations'], true); - $subregionsArray[$s]['wikiDataId'] = $row['wikiDataId']; - $s++; - } -} - - - -echo 'Total Regions Count : '.count($regionsArray).PHP_EOL; -echo 'Total Subregions Count : '.count($subregionsArray).PHP_EOL; -echo 'Total Countries Count : '.count($countriesArray).PHP_EOL; -echo 'Total States Count : '.count($statesArray).PHP_EOL; -echo 'Total Cities Count : '.count($citiesArray).PHP_EOL; - -// print_r($countriesArray); -$exportTo = $rootDir . '/countries.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($countriesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($statesArray); -$exportTo = $rootDir . '/states.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($statesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($citiesArray); -$exportTo = $rootDir . '/cities.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($citiesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($stateCityArray); -$exportTo = $rootDir . '/states+cities.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($stateCityArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($countryStateArray); -$exportTo = $rootDir . '/countries+states.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($countryStateArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($countryCityArray); -$exportTo = $rootDir . '/countries+cities.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($countryCityArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($countryStateCityArray); -$exportTo = $rootDir . '/countries+states+cities.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($countryStateCityArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($regionsArray); -$exportTo = $rootDir . '/regions.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($regionsArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($subregionsArray); -$exportTo = $rootDir . '/subregions.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($subregionsArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// | JSON_ERROR_UTF8|JSON_ERROR_UTF16|JSON_THROW_ON_ERROR|JSON_ERROR_DEPTH - -$conn->close(); - -// function _toIso($value) { -// if (mb_detect_encoding($value) === 'UTF-8'): -// echo 'old '.$value.PHP_EOL; -// echo 'UTF-8'.PHP_EOL; -// $value = iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $value); -// echo 'omg '.$value.PHP_EOL; -// echo gettype($value).PHP_EOL; -// $char = "�"; -// echo var_dump(strpos($value, $char)).PHP_EOL; -// if (strpos($value, strval('�')) !== false) { -// $value = mb_convert_encoding($value, 'ISO-8859-15', 'UTF-8'); -// echo 'after '.$value.PHP_EOL; -// } -// endif; -// return $value; -// } diff --git a/scripts/export_csc_npm.php b/scripts/export_csc_npm.php deleted file mode 100644 index 3d44c82c0..000000000 --- a/scripts/export_csc_npm.php +++ /dev/null @@ -1,90 +0,0 @@ -query($sql); -if ($result->num_rows > 0) { - while($row = $result->fetch_assoc()) { - // Pushing it into Fresh Array - $countriesArray[$i]['isoCode'] = $row['iso2']; - $countriesArray[$i]['name'] = $row['name']; - $countriesArray[$i]['phonecode'] = $row['phonecode']; - $countriesArray[$i]['flag'] = $row['emoji']; - $countriesArray[$i]['currency'] = $row['currency']; - $countriesArray[$i]['latitude'] = $row['latitude']; - $countriesArray[$i]['longitude'] = $row['longitude']; - $countriesArray[$i]['timezones'] = json_decode($row['timezones'], true); - - $i++; - } -} - -// Fetching all States -$sql = "SELECT * FROM states"; -$result = $conn->query($sql); -if ($result->num_rows > 0) { - while($row = $result->fetch_assoc()) { - // Pushing it into Fresh Array - $statesArray[$j]['name'] = $row['name']; - $statesArray[$j]['isoCode'] = $row['iso2']; - $statesArray[$j]['countryCode'] = $row['country_code']; - $statesArray[$j]['latitude'] = $row['latitude']; - $statesArray[$j]['longitude'] = $row['longitude']; - - $j++; - } -} - -// Fetching all Cities -$sql = "SELECT * FROM cities"; -$result = $conn->query($sql); -if ($result->num_rows > 0) { - while($row = $result->fetch_assoc()) { - // Pushing it into Fresh Array - $citiesArray[$k]['name'] = $row['name']; - $citiesArray[$k]['countryCode'] = $row['country_code']; - $citiesArray[$k]['stateCode'] = $row['state_code']; - $citiesArray[$k]['latitude'] = $row['latitude']; - $citiesArray[$k]['longitude'] = $row['longitude']; - - $k++; - } -} - -echo 'Total Countries Count : '.count($countriesArray).PHP_EOL; -echo 'Total States Count : '.count($statesArray).PHP_EOL; -echo 'Total Cities Count : '.count($citiesArray).PHP_EOL; - -// print_r($countriesArray); -$exportTo = $rootDir . '/csc/country.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($countriesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($statesArray); -$exportTo = $rootDir . '/csc/state.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($statesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -// print_r($citiesArray); -$exportTo = $rootDir . '/csc/city.json'; -$fp = fopen($exportTo, 'w'); // Putting Array to JSON -fwrite($fp, json_encode($citiesArray, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT).PHP_EOL); -echo 'JSON Exported to ' .$exportTo . PHP_EOL; -fclose($fp); - -$conn->close(); diff --git a/scripts/export_csv.php b/scripts/export_csv.php deleted file mode 100644 index e94a84f93..000000000 --- a/scripts/export_csv.php +++ /dev/null @@ -1,64 +0,0 @@ - array( - 'from' => '/countries.json', - 'to' => '/csv/countries.csv', - ), - 'states' => array( - 'from' => '/states.json', - 'to' => '/csv/states.csv', - ), - 'cities' => array( - 'from' => '/cities.json', - 'to' => '/csv/cities.csv', - ), - 'regions' => array( - 'from' => '/regions.json', - 'to' => '/csv/regions.csv', - ), - 'subregions' => array( - 'from' => '/subregions.json', - 'to' => '/csv/subregions.csv', - ), -); - -foreach ($files as $root => $v) : - // Gets JSON file - $json = file_get_contents($rootDir . $v['from']); - - $csc = json_decode($json, true); - - $fp = fopen($rootDir . $v['to'], 'w'); // Putting Array to XML - - // Set headings - $headings = $csc[0]; - - // No translations please. - unset($headings['translations']); - fputcsv($fp, array_keys($headings)); - - // Loop through the associative array. - foreach ($csc as $row) : - // Update timezones to make readable - if(!empty($row['timezones'])) { - $row['timezones'] = json_encode($row['timezones']); - $row['timezones'] = preg_replace('/"/', "'", $row['timezones']); - $row['timezones'] = preg_replace("/'([a-zA-Z]+[a-zA-Z0-9_]*)':/", '$1:', $row['timezones']); - } - - // No translations please. - unset($row['translations']); - - // Write the row to the CSV file. - fputcsv($fp, $row); - endforeach; - - fclose($fp); - - echo 'CSV Exported to ' . $rootDir . $v['to'] . PHP_EOL; -endforeach; diff --git a/scripts/export_xml.php b/scripts/export_xml.php deleted file mode 100644 index bd2b748ed..000000000 --- a/scripts/export_xml.php +++ /dev/null @@ -1,78 +0,0 @@ - array( - 'from' => '/regions.json', - 'to' => '/xml/regions.xml', - 'singular' => 'region', - ), - 'subregions' => array( - 'from' => '/subregions.json', - 'to' => '/xml/subregions.xml', - 'singular' => 'subregion', - ), - 'countries' => array( - 'from' => '/countries.json', - 'to' => '/xml/countries.xml', - 'singular' => 'country', - ), - 'states' => array( - 'from' => '/states.json', - 'to' => '/xml/states.xml', - 'singular' => 'state', - ), - 'cities' => array( - 'from' => '/cities.json', - 'to' => '/xml/cities.xml', - 'singular' => 'city', - ), - 'states_cities' => array( - 'from' => '/states+cities.json', - 'to' => '/xml/states+cities.xml', - 'singular' => 'state_city', - ), - 'countries_states' => array( - 'from' => '/countries+states.json', - 'to' => '/xml/countries+states.xml', - 'singular' => 'country_state', - ), - 'countries_cities' => array( - 'from' => '/countries+cities.json', - 'to' => '/xml/countries+cities.xml', - 'singular' => 'country_city', - ), - 'countries_states_cities' => array( - 'from' => '/countries+states+cities.json', - 'to' => '/xml/countries+states+cities.xml', - 'singular' => 'country_state_city', - ), -); - -foreach ($files as $root => $v) : - // Gets JSON file - $json = file_get_contents($rootDir . $v['from']); - - $csc = array($v['singular'] => json_decode($json, true)); - - // Converts PHP Array to XML with the root element being 'root-element-here' - $xml = ArrayToXml::convert( - $csc, - $root, - false, - 'UTF-8', - '1.0', - ['formatOutput' => true] - ); - - $fp = fopen($rootDir . $v['to'], 'w'); // Writing XML to File - fwrite($fp, $xml); - fclose($fp); - - echo 'XML Exported to ' . $rootDir . $v['to'] . PHP_EOL; -endforeach; diff --git a/scripts/export_yaml.php b/scripts/export_yaml.php deleted file mode 100644 index 3dcbed099..000000000 --- a/scripts/export_yaml.php +++ /dev/null @@ -1,71 +0,0 @@ - array( - 'from' => '/regions.json', - 'to' => '/yml/regions.yml', - 'singular' => 'region', - ), - 'subregions' => array( - 'from' => '/subregions.json', - 'to' => '/yml/subregions.yml', - 'singular' => 'subregion', - ), - 'countries' => array( - 'from' => '/countries.json', - 'to' => '/yml/countries.yml', - 'singular' => 'country', - ), - 'states' => array( - 'from' => '/states.json', - 'to' => '/yml/states.yml', - 'singular' => 'state', - ), - 'cities' => array( - 'from' => '/cities.json', - 'to' => '/yml/cities.yml', - 'singular' => 'city', - ), - 'states_cities' => array( - 'from' => '/states+cities.json', - 'to' => '/yml/states+cities.yml', - 'singular' => 'state_city', - ), - 'countries_states' => array( - 'from' => '/countries+states.json', - 'to' => '/yml/countries+states.yml', - 'singular' => 'country_state', - ), - 'countries_cities' => array( - 'from' => '/countries+cities.json', - 'to' => '/yml/countries+cities.yml', - 'singular' => 'country_city', - ), - 'countries_states_cities' => array( - 'from' => '/countries+states+cities.json', - 'to' => '/yml/countries+states+cities.yml', - 'singular' => 'country_state_city', - ), -); - -foreach ($files as $root => $v) : - // Gets JSON file - $json = file_get_contents($rootDir . $v['from']); - - $csc = array($v['singular'] => json_decode($json)); - - // Converts PHP Array to YAML - $yml = Yaml::dump($csc, 7, 2, Yaml::DUMP_OBJECT_AS_MAP); - - $fp = fopen($rootDir . $v['to'], 'w'); // Writing YAML to File - fwrite($fp, $yml); - fclose($fp); - - echo 'YAML Exported to ' . $rootDir . $v['to'] . PHP_EOL; -endforeach; diff --git a/scripts/vendor/base.php b/scripts/vendor/base.php deleted file mode 100644 index c505fbd7b..000000000 --- a/scripts/vendor/base.php +++ /dev/null @@ -1,34 +0,0 @@ -connect_error) { - die("Connection failed: " . $conn->connect_error); -} - -// change character set to utf8 -if (!$conn->set_charset("utf8mb4")) { - printf("Error loading character set utf8: %s\n", $conn->error); -} else { - printf("Current character set: %s\n", $conn->character_set_name()); -} diff --git a/scripts/vendor/composer.json b/scripts/vendor/composer.json deleted file mode 100644 index 448c92a70..000000000 --- a/scripts/vendor/composer.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "dr5hn/csc-db", - "description": "Full Database of city state country available in JSON and SQL Format All Countries, States & Cities are Covered and Populated with Different Combinations & Versions.", - "version": "v0.2", - "require": { - "mashape/unirest-php": "^3.0", - "spatie/array-to-xml": "^3.0", - "symfony/yaml": "^6.0" - } -} diff --git a/scripts/vendor/composer.lock b/scripts/vendor/composer.lock deleted file mode 100644 index b454d008a..000000000 --- a/scripts/vendor/composer.lock +++ /dev/null @@ -1,351 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "fa7e510575cd357626c3ad42407158b3", - "packages": [ - { - "name": "mashape/unirest-php", - "version": "v3.0.4", - "source": { - "type": "git", - "url": "https://github.com/Mashape/unirest-php.git", - "reference": "842c0f242dfaaf85f16b72e217bf7f7c19ab12cb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Mashape/unirest-php/zipball/842c0f242dfaaf85f16b72e217bf7f7c19ab12cb", - "reference": "842c0f242dfaaf85f16b72e217bf7f7c19ab12cb", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "codeclimate/php-test-reporter": "0.1.*", - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-json": "Allows using JSON Bodies for sending and parsing requests" - }, - "type": "library", - "autoload": { - "psr-0": { - "Unirest\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Unirest PHP", - "homepage": "https://github.com/Mashape/unirest-php", - "keywords": [ - "client", - "curl", - "http", - "https", - "rest" - ], - "support": { - "email": "opensource@mashape.com", - "issues": "https://github.com/Mashape/unirest-php/issues", - "source": "https://github.com/Mashape/unirest-php/tree/master" - }, - "time": "2016-08-11T17:49:21+00:00" - }, - { - "name": "spatie/array-to-xml", - "version": "3.2.3", - "source": { - "type": "git", - "url": "https://github.com/spatie/array-to-xml.git", - "reference": "c95fd4db94ec199f798d4b5b4a81757bd20d88ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/c95fd4db94ec199f798d4b5b4a81757bd20d88ab", - "reference": "c95fd4db94ec199f798d4b5b4a81757bd20d88ab", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "php": "^8.0" - }, - "require-dev": { - "mockery/mockery": "^1.2", - "pestphp/pest": "^1.21", - "spatie/pest-plugin-snapshots": "^1.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Spatie\\ArrayToXml\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Freek Van der Herten", - "email": "freek@spatie.be", - "homepage": "https://freek.dev", - "role": "Developer" - } - ], - "description": "Convert an array to xml", - "homepage": "https://github.com/spatie/array-to-xml", - "keywords": [ - "array", - "convert", - "xml" - ], - "support": { - "source": "https://github.com/spatie/array-to-xml/tree/3.2.3" - }, - "funding": [ - { - "url": "https://spatie.be/open-source/support-us", - "type": "custom" - }, - { - "url": "https://github.com/spatie", - "type": "github" - } - ], - "time": "2024-02-07T10:39:02+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-05-23T14:45:45+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/yaml", - "version": "v6.4.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "d75715985f0f94f978e3a8fa42533e10db921b90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d75715985f0f94f978e3a8fa42533e10db921b90", - "reference": "d75715985f0f94f978e3a8fa42533e10db921b90", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "symfony/console": "<5.4" - }, - "require-dev": { - "symfony/console": "^5.4|^6.0|^7.0" - }, - "bin": [ - "Resources/bin/yaml-lint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Loads and dumps YAML files", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.3" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-23T14:51:35+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.3.0" -}