PHP code example of kejubayer / kej-stock-market

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

    

kejubayer / kej-stock-market example snippets


// config/app.php
'providers' => [
    Kejubayer\StockMarket\KejStockMarketServiceProvider::class,
];

use Kejubayer\StockMarket\Services\DseService;
use Kejubayer\StockMarket\Services\CseService;

// DSE Data
$dseService = app(DseService::class);
$dseData = $dseService->getLatest();

// CSE Data
$cseService = app(CseService::class);
$cseData = $cseService->getLatest();

// Example output
print_r($dseData);
print_r($cseData);

Array
(
    [0] => Array
        (
            [symbol] => ACI
            [ltp] => 123.50
            [high] => 125.00
            [low] => 122.50
            [closep] => 123.00
            [ycp] => 120.50
            [change] => 3.50
            [trade] => 1000
            [value] => 123500
            [volume] => 1000
        )
)