PHP code example of flairuk / laravel-aviationstack
1. Go to this page and download the library: Download flairuk/laravel-aviationstack library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$page = Aviationstack::flights()->from('LHR')->page(2, perPage: 50)->get();
$page->data; // array of rows, exactly as the API returned them
$page->total; // size of the whole result set
$page->offset; // where this page starts
$page->hasMore();
$page->first();
$page->collect(); // Illuminate\Support\Collection
count($page); foreach ($page as $row) { … }
dotenv
AVIATIONSTACK_KEY=…
AVIATIONSTACK_HTTPS=true # false on the free plan, which refuses HTTPS (error 105)
AVIATIONSTACK_MAX_LIMIT=100 # 1000 on Professional and above