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.
- Visa requirements per passport - Page is deleted
You can install the package via composer:
composer require salamwaddah/passport-visa-api
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 []
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.
composer test