PHP code example of nick-smit / openf1-api

1. Go to this page and download the library: Download nick-smit/openf1-api 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/ */

    

nick-smit / openf1-api example snippets


$factory = new NickSmit\OpenF1Api\Factory\OpenF1ApiClientFactory();
$apiClient = $factory->create();

// Retrieve the drivers who participated in the latest session.
$drivers = $apiClient->drivers(sessionKey: NickSmit\OpenF1Api\Filter\IdFilter::latest());

foreach ($drivers as $driver) {
    echo $driver->fullName . "\n";
}