• Stars
    star
    101
  • Rank 326,015 (Top 7 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🌎 Geodata API - Get countries, and cities to plug in drop-downs.

Country City API

Build Status Code Climate codecov License

Geodata API to get the list of countries and cities in the world. This can be plugged in country and city picker drop-downs in forms. You can find a select2 implementation here. Code for this implementation is in example directory.

⚡ Installing the CountryCity API

  • Make sure you have PHP 7.4 or newer.
$ php -v
  • Download this API using composer using the command below.
composer global require shivammathur/countrycity "dev-main"
  • Then install the API by executing the command below.
composer create-project shivammathur/countrycity countrycity "dev-main" --prefer-dist
  • You are all set, you can use this API.

#️⃣ API Endpoints

All API responses are in json format.

  • Get all countries
/countries

# Without URL Rewriting
/index.php/countries
  • Get all countries containing a search keyword
/countries/{search_keyword}

# Without URL Rewriting
/index.php/countries/{search_keyword}
  • Get all cities in a country
/cities/{country}

# Without URL Rewriting
/index.php/cities/{country}
  • Get all cities in a country containing a search keyword
/cities/{country}/{search_keyword}

# Without URL Rewriting
/index.php/cities/{country}/{search_keyword}

✨ Rest API Features

  • Built using Slim micro framework.
  • Caching enabled with following headers
    • ETag
    • Expires
    • Last-Modified
  • Fast and lightweight API
  • PSR 7 Complaint
  • CORS Middleware

☁️ Hosting configuration

Here are the Configuration Instructions if you want to host this on your server.

🔧 Error Format

If there is an error in the API, you will get an error in json format as response

{"error":"true", "message": "error message here"}

🚨 Testing

$ vendor/bin/phpunit --configuration phpunit.xml.dist

📜 License

The scripts and documentation in this project are released under the MIT License. This project has multiple dependencies and their licenses can be found in their respective repositories.

👍 Contributions

Contributions are welcome! See Contributor's Guide.

💖 Support this project

  • Please star the project and share it with the community.
  • Support the project by sponsoring my work on GitHub sponsors.

More Repositories

1

setup-php

GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
TypeScript
2,747
star
2

homebrew-php

🍺 Homebrew tap for PHP 5.6 to 8.4. PHP 8.4 is built nightly.
Ruby
2,283
star
3

homebrew-extensions

🍻 Homebrew tap for PHP extensions
Ruby
567
star
4

php-builder

🐘 Build PHP 5.6 and newer
Shell
62
star
5

IPpy

🚀 Ping IP addresses and domains in parallel to find the accessible and inaccessible ones.
Python
56
star
6

php-builder-windows

Build PHP 8.0 and above nightly snaps for Windows.
PowerShell
41
star
7

cache-extensions

📦 Cache PHP extensions in GitHub Actions
Shell
40
star
8

php5-ubuntu

Scripts to install the end-of-life PHP versions on Ubuntu 22.04, 20.04 and 18.04 amd64
Shell
23
star
9

TwitterScraper

Twitter Scraper - Scrape tweets for a user or a #hashtag.
Python
13
star
10

node-docker

Docker images with Node.js and PHP for CI
Shell
10
star
11

php-extensions-windows

Build PHP extensions for windows
PowerShell
7
star
12

ghsvg

GitHub Sponsors SVG
TypeScript
7
star
13

codementor-mentees

Shivam Mathur's Codementor Mentees
JavaScript
6
star
14

php-ubuntu

Cached packages to install PHP on Ubuntu in GitHub Actions
Shell
6
star
15

php-src-backports

Security backports for EOL versions of PHP.
Roff
6
star
16

icu-intl

Compiled versions of icu4c and intl php extension
Shell
5
star
17

composer-cache

Cache composer phars for setup-php.
Shell
5
star
18

test-setup-php

Testing Setup PHP GitHub Action
5
star
19

spc

setup-php-cli (spc) is a command line utility to run setup-php.
Shell
3
star
20

php5-darwin

Install PHP 5 versions on darwin
Shell
3
star
21

flask-chat-app

Chat app using flask and SocketIO in python.
JavaScript
3
star
22

shivammathur

2
star
23

.github

Default config for my GitHub projects.
2
star
24

init.lua

My nvim config
Lua
1
star
25

pacman

Classic pacman game built in python using pygame
Python
1
star
26

homebrew-openssl-deprecated

Formula for [email protected]
Ruby
1
star
27

homebrew-phalcon

Please use shivammathur/extensions tap instead.
Ruby
1
star
28

homebrew-test-bot

🎰 Tests the full lifecycle of a Homebrew change.
Ruby
1
star
29

php-darwin

1
star
30

Computer-Networks-OMNeT-Lab

Assignments of my computer networks lab
C++
1
star