PHP code example of tmarois / polygon-php-sdk

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

    

tmarois / polygon-php-sdk example snippets


use Polygon\Polygon;

$polygon = new Polygon("YOUR_API_KEY");

$response = $polygon->stocks()->getSnapshot('AAPL');

$response = $polygon->stocks()->getDetails('AAPL');

$response = $polygon->stocks()->getNews('AAPL', 1, 20);

$response = $polygon->stocks()->getLastTrade('AAPL');

$response = $polygon->stocks()->getLastQuote('AAPL');

$response = $polygon->stocks()->getTradeHistory('AAPL','2019-09-25',$limit = 100, $timestampOffset = 0);

$response = $polygon->stocks()->getQuoteHistory('AAPL','2019-09-25',$limit = 100, $timestampOffset = 0);