This package is abandoned and no longer maintained. No replacement package was suggested.

Quick and dirty Yahoo stock quotes in PHP

dev-master 2016-04-21 16:00 UTC

This package is not auto-updated.

Last update: 2020-01-22 02:15:51 UTC


Yahoo Stock Quotes in PHP

MIT License Build Status HHVM Test Status GitHub Issues GitHub Downloads Packagist Downloads

Code Climate Grade Code Climate Issues Codacy Grade SensioLabsInsight

Code Climate Test Coverage Codacy Test Coverage Test Coverage Coveralls Test Coverage

What it does

This library makes it simple to access any number of stock prices (and their changes) in your code. It limits itself to one update per day to save your server's (and Yahoo's) resources. It consists of one code file and one cache file. No database necessary.

Merely pass an array of your desired stocks' symbols to the YahooStockQuotes constructor and use the three public functions where you need them.



There must be a YahooStockQuotes.json file in the same directory as the YahooStockQuotes.php file.

YahooStockQuotes.json must be WRITABLE by the user who owns the PHP process (apache, www-data, nginx, hhvm, etc.).

If the file does not exist or is not writable, every page view will require a new request to Yahoo's servers, which will slow down all page views drastically and get your server blocked by Yahoo.

Example usage


include 'YahooStockQuotes.php';
$stockSymbols = array('YHOO');
$stockQuotes = new \Aensley\YahooStockQuotes\YahooStockQuotes($stockSymbols);

		<title>Stock Test</title>
		Price: <?php echo $stockQuotes->getPrice('YHOO'); ?>
		Change: <?php echo $stockQuotes->getChange('YHOO'); ?>
		Last updated: <?php echo $stockQuotes->getUpdatedDate(); ?>

Supercharged by