Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aensley/yahoostockquotes
Quick and dirty Yahoo stock quotes in PHP
https://github.com/aensley/yahoostockquotes
composer packagist php stock stock-market yahoo
Last synced: about 1 month ago
JSON representation
Quick and dirty Yahoo stock quotes in PHP
- Host: GitHub
- URL: https://github.com/aensley/yahoostockquotes
- Owner: aensley
- License: mit
- Archived: true
- Created: 2016-03-09T18:16:26.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-21T16:00:31.000Z (over 8 years ago)
- Last Synced: 2024-09-30T15:17:31.386Z (about 1 month ago)
- Topics: composer, packagist, php, stock, stock-market, yahoo
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YahooStockQuotes
Yahoo Stock Quotes in PHP
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/aensley/YahooStockQuotes/blob/master/LICENSE) [![Build Status](https://travis-ci.org/aensley/YahooStockQuotes.svg)](https://travis-ci.org/aensley/YahooStockQuotes) [![HHVM Test Status](https://img.shields.io/hhvm/aensley/yahoo-stock-quotes.svg)](http://hhvm.h4cc.de/package/aensley/yahoo-stock-quotes) [![GitHub Issues](https://img.shields.io/github/issues-raw/aensley/YahooStockQuotes.svg)](https://github.com/aensley/YahooStockQuotes/issues) [![GitHub Downloads](https://img.shields.io/github/downloads/aensley/YahooStockQuotes/total.svg)](https://github.com/aensley/YahooStockQuotes/releases) [![Packagist Downloads](https://img.shields.io/packagist/dt/aensley/yahoo-stock-quotes.svg)](https://packagist.org/packages/aensley/yahoo-stock-quotes)
[![Code Climate Grade](https://codeclimate.com/github/aensley/YahooStockQuotes/badges/gpa.svg)](https://codeclimate.com/github/aensley/YahooStockQuotes) [![Code Climate Issues](https://img.shields.io/codeclimate/issues/github/aensley/YahooStockQuotes.svg)](https://codeclimate.com/github/aensley/YahooStockQuotes) [![Codacy Grade](https://api.codacy.com/project/badge/grade/753efb995ff64b9087cf2e4952e91038)](https://www.codacy.com/app/awensley/YahooStockQuotes) [![SensioLabsInsight](https://img.shields.io/sensiolabs/i/bc0dd7ac-b413-44a3-bcb4-55e2ab1808d9.svg)](https://insight.sensiolabs.com/projects/bc0dd7ac-b413-44a3-bcb4-55e2ab1808d9)
[![Code Climate Test Coverage](https://codeclimate.com/github/aensley/YahooStockQuotes/badges/coverage.svg)](https://codeclimate.com/github/aensley/YahooStockQuotes/coverage) [![Codacy Test Coverage](https://api.codacy.com/project/badge/coverage/753efb995ff64b9087cf2e4952e91038)](https://www.codacy.com/app/awensley/YahooStockQuotes) [![Codecov.io Test Coverage](https://codecov.io/github/aensley/YahooStockQuotes/coverage.svg?branch=master)](https://codecov.io/github/aensley/YahooStockQuotes?branch=master) [![Coveralls Test Coverage](https://coveralls.io/repos/github/aensley/YahooStockQuotes/badge.svg?branch=master)](https://coveralls.io/github/aensley/YahooStockQuotes?branch=master)
## 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](https://github.com/aensley/YahooStockQuotes/blob/master/src/Aensley/YahooStockQuotes/YahooStockQuotes.php) and [one cache file](https://github.com/aensley/YahooStockQuotes/blob/master/src/Aensley/YahooStockQuotes/YahooStockQuotes.json). No database necessary.
Merely pass an array of your desired stocks' symbols to the `YahooStockQuotes` constructor and use the [three public functions](#example-usage) where you need them.
Simple.
## Requirements
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
```php
Stock Test
Price: getPrice('YHOO'); ?>
Change: getChange('YHOO'); ?>
Last updated: getUpdatedDate(); ?>
```
----
[![Supercharged by ZenHub.io](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io)