GithubHelp home page GithubHelp logo

cyber-pride / countrycodepickerapi Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 2.56 MB

A simple restful api with laravel that displays a list of all the countries, country code, iso code name and flag in json format.

Home Page: https://ccpapi.herokuapp.com/

PHP 88.61% HTML 1.03% TSQL 10.37%
php php-framework phpmyadmin json json-api country-codes country-flags country-picker laravel laravel-framework laravel-application

countrycodepickerapi's Introduction

CountryCodePickerApi

A simple restful api with laravel that displays a list of all the countries, country code, iso code name and flag in json format.

Prerequisites

  • Apache
  • PHP
  • Composer

Installation steps

Follow the below steps to install and set up the application.

Step 1: Clone the Application
You can download the ZIP file or git clone from my repo into your project directory.

Step 2: Configure the Application
After you clone the repo in to your project folder the project need to be set up by following commands-

  • In terminal go to your project directory and Run

      composer install 
    
  • Then copy the .env.example file to .env file in the project root folder

  • Edit the .env file and fill all required data for the bellow variables

      APP_URL=http://localhost //your application domain URL go here
    
      DB_HOST=127.0.0.1 // Your DB host IP. Here we are assumed it to be local host
      DB_PORT=3306 //Port if you are using except the default
      DB_DATABASE=ccpapi // Your DB name
      DB_USERNAME=root // Your DB username
      DB_PASSWORD= // Your DB password
    
  • To set the Application key run the bellow command in your terminal.

      php artisan key:generate        
    
  • Create all the necessary tables need for the application by runing the below command

      php artisan migrate
    
  • Then import countries.sql in your phpmyadmin.

Thats all! The application is now configured.

API Endpoints and Routes

The application has the following resources

Get All Country List

GET http://127.0.0.1:8000/api/v1/country

The response will be a JSON containing the country info.

[
{
"id": 1,
"name": "Please select your country...",
"code": "FLAG_TRANSPARENT",
"phonecode": "+"
},
{
"id": 2,
"name": "Afghanistan",
"code": "AF",
"phonecode": "+93"
}
]

Get Single Country

GET http://127.0.0.1:8000/api/v1/country/afghanistan

The response will be a JSON containing the country info.

[
{
"id": 2,
"name": "Afghanistan",
"code": "AF",
"phonecode": "+93"
}
]

References

License

The Laravel framework is open-sourced software licensed under the MIT license

countrycodepickerapi's People

Contributors

cyber-pride avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.