PHP code example of alexxd / stock-data

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

    

alexxd / stock-data example snippets


$response = $stock->getIntradayStock('AAPL');

$response = $stock->getDailyStock('AAPL');

$response = $stock->getWeeklyStock('AMZN');

$response = $stock->getMonthlyStock('TSLA');

getIntradayStock($symbol, $interval = '5', $format = 'json',$output_size='compact')
getDailyStock($symbol, $format = 'json',$output_size='compact')
getWeeklyStock($symbol, $format = 'json',$output_size='compact')
getMonthlyStock($symbol, $format = 'json',$output_size='compact')

    .
    .
    .
    public function test(Stock $stock) 
    {
        $response = $stock->getIntraDayStock('AAPL');
    }
    .
    .
    .

    .
    .
    .
    public function test() 
    {
        $response = app('stock')->getIntraDayStock('AAPL');
    }
    .
    .
    .