https://github.com/cesurapp/gclib
GeoIP & Exchange Rates webservice was developed with PHP Swoole
https://github.com/cesurapp/gclib
ecb-rates exchange-rates geoip geoip2 geolocation php7 swoole
Last synced: 3 months ago
JSON representation
GeoIP & Exchange Rates webservice was developed with PHP Swoole
- Host: GitHub
- URL: https://github.com/cesurapp/gclib
- Owner: cesurapp
- Created: 2019-07-17T13:59:55.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-08T15:34:38.000Z (almost 6 years ago)
- Last Synced: 2024-08-04T09:07:50.616Z (about 1 year ago)
- Topics: ecb-rates, exchange-rates, geoip, geoip2, geolocation, php7, swoole
- Language: PHP
- Homepage:
- Size: 44.9 KB
- Stars: 16
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
* [Swoole](https://github.com/swoole/swoole-src)
* [FastRoute](https://github.com/nikic/FastRoute)
* [Maxmind Reader](https://github.com/maxmind/MaxMind-DB-Reader-php)#### 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.
```yaml
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:
```http request
GET http://127.0.0.1:90/geolocate
```
Custom IP adress:
```http request
GET http://127.0.0.1:90/geolocate/IP
```#### Exhange Rate API
Latest exchange rates:
```http request
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):
```http request
GET http://127.0.0.1:90/exrate/ecb/2019-07-18 #European Central Bank
```
Custom exchange rate range (only ecb):
```http request
GET http://127.0.0.1:90/exrate/ecb/2019-07-02/2019-07-05 #European Central Bank
```
Custom Parameters:
```
Change Base CurrencyGET ?base=USD
GET ?base=EURList Specific Currencies
GET ?symbol=USD,TRY,EUR
GET ?base=EUR&symbol=USD,TRY
```