PHPackages                             swar8080/fast-stock-quotes - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. swar8080/fast-stock-quotes

ActiveLibrary[API Development](/categories/api)

swar8080/fast-stock-quotes
==========================

Fast, free, global stock quote API wrapper and caching solution for Alpha Vantage and IEX Trading.

1.0.4(7y ago)71092[2 issues](https://github.com/swar8080/FastStockQuotes/issues)MITPHP

Since Apr 17Pushed 7y ago3 watchersCompare

[ Source](https://github.com/swar8080/FastStockQuotes)[ Packagist](https://packagist.org/packages/swar8080/fast-stock-quotes)[ Docs](https://github.com/swar8080/FastStockQuotes)[ RSS](/packages/swar8080-fast-stock-quotes/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (4)Versions (8)Used By (0)

FastStockQuotes Overview
========================

[](#faststockquotes-overview)

This library provides efficient access to two free stock quote APIs: [Alpha Vantage](https://www.alphavantage.co/) and [IEX](https://iextrading.com/developer). IEX is fast but limited to US stocks only. Alpha Vantage supports most stocks in the world but requires a separate request for each quote and is limited to ~1 request per second. To make Alpha Vantage usable for a moderate number of stocks, caching using [redis](https://redis.io/) can optionally be enabled to limit API requests.

Installation
============

[](#installation)

Install with the composer command: `composer require swar8080/fast-stock-quotes`

Prerequisites
-------------

[](#prerequisites)

- PHP Version 5.6+
- Claim your free [Alpha Vantage API key](https://www.alphavantage.co/support/#api-key) for access to non-US quotes
- Optionally [download and run a redis server](https://redis.io/) to enable caching of stock quotes. Review the [Predis library](https://github.com/nrk/predis#connecting-to-redis) for options when connecting to your redis server from PHP.

Stock Exchange Support
======================

[](#stock-exchange-support)

The APIs used by this library support most stock exchanges in this world, however, **stock exchanges must be configured before use**.

*Currently Configured Stock Exchanges:*

- Australia
- Amsterdam
- Canada
- Germany
- Hong Kong
- Tokyo
- London
- New Zealand
- Norway
- France
- Shanghai (China)
- Shenzhen (China)
- Stockholm
- United States

Configuring support for a stock exchange is easy: add its exchange code to [ExchangeCodes.php](https://github.com/swar8080/FastStockQuotes/blob/master/src/Markets/ExchangeCodes.php) and an entry to the `Exchanges` array in [StockExchange.php](https://github.com/swar8080/FastStockQuotes/blob/master/src/Markets/StockExchange.php#L149). If you run into problems, feel free to open an issue on github.

Benefits of Using Caching
=========================

[](#benefits-of-using-caching)

- If the quote is cached, a network call to the API can be avoided
- You can configure the number of seconds before the cached quote expires and is removed
- If the stock exchange is closed, the quote will be cached until it re-opens

The following table shows time spent making requests (in seconds) from different sources. The biggest time savings can come from caching non-US Alpha Vantage quotes.

Number of StocksIEXAlpha VantageFrom Cache (redis)1 Stock0.280.820.0025 Stocks0.351.890.00310 Stocks0.5610.160.003Demo
====

[](#demo)

```
require "vendor/autoload.php";

use FastStockQuotes\FastQuoteServiceBuilder;
use FastStockQuotes\StockSymbol;
use FastStockQuotes\markets\ExchangeCodes;
use FastStockQuotes\quoteAPIs\USQuote;

$quoteService = FastQuoteServiceBuilder::builder()
	->withAlphaVantageGlobalQuoteAPI("your API key")
	->withRedisCaching(new \Predis\Client(), $minCachingLengthSeconds=300)
	->build();

//For US stocks, just pass the symbol
$usSymbol = new StockSymbol("MSFT");

//For non-us stocks, an exchange code must be added to the stock symbol to identify the stock exchange it belongs to.
//If you're unsure of the exchange code, use the built-in ExchangeCodes constant or check Yahoo Finance
$canadianSymbol = new StockSymbol("SHOP", $exchangeCode=ExchangeCodes::CANADA);
$australianSymbol = new StockSymbol("WBC.AX"); //equivalent to: new StockSymbol("WBC", ExchangeCodes::AUSTRALIA)

//request the quotes from the appropriate APIs
$quotes = $quoteService->quotes(array($usSymbol, $canadianSymbol, $australianSymbol));

//this is equivalent
$quotes = $quoteService->quotes(StockSymbol::Symbols("MSFT", "SHOP.TO", "WBC.AX"));

foreach ($quotes as $symbol => $quote){
	echo "--" . $quote->symbol() . "--" . PHP_EOL;
	echo $quote->price() . PHP_EOL;
	echo $quote->open() . PHP_EOL;
	echo $quote->previousDayClose() . PHP_EOL;
	echo $quote->high() . PHP_EOL;
	echo $quote->low() . PHP_EOL;
	echo $quote->volume() . PHP_EOL;
	echo $quote->lastUpdated() . PHP_EOL;

	if ($quote instanceof USQuote){
		echo $quote->marketCap . PHP_EOL;
		echo $quote->week52High . PHP_EOL;
		echo $quote->peRatio . PHP_EOL;
		//full list of fields available for US quotes: https://iextrading.com/developer/docs/#quote
	}
	echo PHP_EOL;
}
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Total

7

Last Release

2863d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17691679?v=4)[Steven Swartz](/maintainers/swar8080)[@swar8080](https://github.com/swar8080)

---

Top Contributors

[![swar8080](https://avatars.githubusercontent.com/u/17691679?v=4)](https://github.com/swar8080 "swar8080 (29 commits)")

---

Tags

stocksstock pricestock quoteAlpha VantageIEX

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/swar8080-fast-stock-quotes/health.svg)

```
[![Health](https://phpackages.com/badges/swar8080-fast-stock-quotes/health.svg)](https://phpackages.com/packages/swar8080-fast-stock-quotes)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M932](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[unopim/unopim

UnoPim Laravel PIM

10.5k2.2k](/packages/unopim-unopim)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k34](/packages/neuron-core-neuron-ai)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
