salamwaddah / passport-visa-api
This package is abandoned and no longer maintained.
No replacement package was suggested.
Passport Visa API - an unofficial passportindex.org API
1.1.1
2024-06-08 07:23 UTC
Requires
- php: >=7.1
- ext-json: *
- guzzlehttp/guzzle: ^7.8
Requires (Dev)
- pestphp/pest: ^2.33
README
An unofficial passportindex.org API - supports 199 passports
ABANDONED: You may inspect the code but it's no longer maintained, passportindex.org making it more difficult to scrape.
Showcase website
- Visa requirements per passport - Page is deleted
Installation
You can install the package via composer:
composer require salamwaddah/passport-visa-api
Usage
You can get all the visa requirements for a passport by using the get()
method.
require_once __DIR__ . '/../vendor/autoload.php'; $passport = \SalamWaddah\PassportVisa\Passport::make('ma'); $passport->get(); // [ // "visa-free" => ["tr", etc...], // "visa-on-arrival" => ["lb", etc...], // "electronic-travel-authorization" => ["kr", etc...], // "e-visa" => ["jo", etc...], // "visa-required" => ["gb", etc...], // "not-admitted" => [], // "covid-ban" => [], // ]
Alternatively you can get the visa requirements for a passport by using the methods:
listVisaFree()
listVisaOnArrival()
listEta()
listEVisa()
listVisaRequired()
listNotAdmitted()
listCovidBan()
// list of visa free countries for your $passport $passport->listVisaFree(); // returns ["tr", etc...] // list of countries which do not admit your $passport $passport->listNotAdmitted(); // returns []
Caching
This library does not cache the results, you can use your own caching mechanism to avoid unnecessarily calling passportindex.org everytime. A recommended TTL for your cache is 1 day.
Testing
composer test