Skip to content
/ gclib Public

GeoIP & Exchange Rates webservice was developed with PHP Swoole

Notifications You must be signed in to change notification settings

cesurapp/gclib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IP Geolocation & Exchange Rate API

The service is free. Maxmind-DB is used for geographic location determination. The European Central Bank and the Central Bank of the Republic of Turkey used to exchange rates.

Development

Written using Swoole Http Server. It achieves an average "35k/sec" request on a 4-core machine.

PHP Library

Automatic Update

Swool Scheduler is made with continuous update. The update is checked every 24 hours. The database is downloaded 2 times in one month.

Installation

You can run the api with Docker.

version: '3.4'

services:
    gclib:
        image: appaydin/gclib
        ports:
            - 90:9500
        environment:
            - SWOOLE_PORT=9500
            - SWOOLE_WORKER=2
            - DBCITY=https://download.maxmind.com/...

Generate DBCITY URL: https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=LICENSE_KEY&suffix=tar.gz

LICENSE_KEY: You can obtain the license key from your Maxmind account.

Geo Location API

Geo locate client:

GET http://127.0.0.1:90/geolocate

Custom IP adress:

GET http://127.0.0.1:90/geolocate/IP

Exhange Rate API

Latest exchange rates:

GET http://127.0.0.1:90/exrate/ecb/latest #European Central Bank
GET http://127.0.0.1:90/exrate/tcmb/latest #The Central Bank of the Republic of Turkey

Custom exchange rate (only ecb):

GET http://127.0.0.1:90/exrate/ecb/2019-07-18 #European Central Bank

Custom exchange rate range (only ecb):

GET http://127.0.0.1:90/exrate/ecb/2019-07-02/2019-07-05 #European Central Bank

Custom Parameters:

Change Base Currency

GET ?base=USD
GET ?base=EUR

List Specific Currencies

GET ?symbol=USD,TRY,EUR
GET ?base=EUR&symbol=USD,TRY

About

GeoIP & Exchange Rates webservice was developed with PHP Swoole

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published