PHP code example of kenzal / metals-api

1. Go to this page and download the library: Download kenzal/metals-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/ */

    

kenzal / metals-api example snippets


return [
    'access_key' => env('METALS_API_ACCESS_KEY'),
    'host'       => env('METALS_API_HOST', 'https://metals-api.com'),
    'port'       => env('METALS_API_PORT', null),
    'base'       => env('METALS_API_BASE', 'USD'),
    'symbols'    => env('METALS_API_SYMBOLS', null),
];

$metalsApi = new Kenzal\MetalsApi($config);
echo $metalsApi->latest(symbols:['XAG','XAU'], base:'USD');
bash
php artisan vendor:publish --tag="metals-api-config"