PHP code example of brtdv / twelvedata-php-sdk

1. Go to this page and download the library: Download brtdv/twelvedata-php-sdk 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/ */

    

brtdv / twelvedata-php-sdk example snippets


use Brtdv\TwelveData\TwelveData;

// Initialize a TwelveData API instance
$twelveDataApi = TwelveData::create('<your api key here>');

// Get a list off Stock Symbols
$response = $twelveDataApi->referenceData()->stocksList([
    'symbol'   => 'AAPL',
    'interval' => '1min'
]);

// Get the 1min candles for the AAPL symbol
$response = $twelveDataApi->coreData()->timeSeries([
    'symbol'   => 'AAPL',
    'interval' => '1min'
]);