PHPackages                             elminson/yahoo-finance-api - 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. elminson/yahoo-finance-api

ActiveLibrary[API Development](/categories/api)

elminson/yahoo-finance-api
==========================

PHP library for accessing Yahoo Finance data

v4.8.3(2y ago)045MITPHPPHP &gt;=7.1.3

Since Jan 18Pushed 2y agoCompare

[ Source](https://github.com/elminson/yahoo-finance-api)[ Packagist](https://packagist.org/packages/elminson/yahoo-finance-api)[ Docs](https://github.com/elminson/yahoo-finance-api)[ RSS](/packages/elminson-yahoo-finance-api/feed)WikiDiscussions 4.x Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (26)Used By (0)

elminson/yahoo-finance-api
==========================

[](#elminsonyahoo-finance-api)

**This is a PHP client for Yahoo Finance API.**

[![Build Status](https://github.com/elminson/yahoo-finance-api/workflows/CI/badge.svg?branch=4.x)](https://github.com/elminson/yahoo-finance-api/actions?query=workflow%3ACI+branch%3A4.x)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/690e5e44d5bf6575a5310ff74190a0df64a3c00e9afd3a4764293757a64d7c23/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656c6d696e736f6e2f7961686f6f2d66696e616e63652d6170692f6261646765732f7175616c6974792d73636f72652e706e673f623d342e78)](https://scrutinizer-ci.com/g/elminson/yahoo-finance-api/?branch=4.x)[![Code Coverage](https://camo.githubusercontent.com/ff11b8a295ece607c5ae9b7a47ae35f7891a6af0ea3215033e41205581d4b320/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656c6d696e736f6e2f7961686f6f2d66696e616e63652d6170692f6261646765732f636f7665726167652e706e673f623d342e78)](https://scrutinizer-ci.com/g/elminson/yahoo-finance-api/?branch=4.x)[![Latest Stable Version](https://camo.githubusercontent.com/8fa032654b4885b3ca712afda9e5c69f15541d9727055b199689b1893c53f987/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6d696e736f6e2f7961686f6f2d66696e616e63652d617069)](https://packagist.org/packages/elminson/yahoo-finance-api)[![Total Downloads](https://camo.githubusercontent.com/36528cfd53632b86555f79883fd76d60d3d089d00865b9ac7cffb8ec8d8c31fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6d696e736f6e2f7961686f6f2d66696e616e63652d617069)](https://packagist.org/packages/elminson/yahoo-finance-api/stats)[![License](https://camo.githubusercontent.com/3d57e39f1f853e34848c346f533acdd04308f937b1a435542883264566bab990/68747470733a2f2f706f7365722e707567782e6f72672f656c6d696e736f6e2f7961686f6f2d66696e616e63652d6170692f6c6963656e73652e737667)](https://packagist.org/packages/elminson/yahoo-finance-api)

[![Logo](doc/logo.svg)](doc/logo.svg)

Since YQL APIs have been discontinued in November 2017, this client is using non-official API endpoints for quotes, search and historical data.

⚠️ **WARNING:** These non-official APIs cannot be assumed stable and might break any time. Also, you might violate Yahoo's terms of service. So use them at your own risk.

Installation
------------

[](#installation)

Download via Composer:

```
composer require elminson/yahoo-finance-api
```

Alternatively you can also add the package directly to composer.json:

```
{
    "require": {
        "elminson/yahoo-finance-api": "^4.0"
    }
}
```

and then tell Composer to install the package:

```
composer update elminson/yahoo-finance-api
```

Usage
-----

[](#usage)

```
use Elminson\YahooFinanceApi\ApiClient;
use Elminson\YahooFinanceApi\ApiClientFactory;
use GuzzleHttp\Client;

// Create a new client from the factory
$client = ApiClientFactory::createApiClient();

// Or use your own Guzzle client and pass it in
$options = [/* ... */];
$guzzleClient = new Client($options);
$client = ApiClientFactory::createApiClient($guzzleClient);

// Returns an array of Elminson\YahooFinanceApi\Results\SearchResult
$searchResult = $client->search("Apple");

// Returns an array of Elminson\YahooFinanceApi\Results\HistoricalData
$historicalData = $client->getHistoricalQuoteData(
    "AAPL",
    ApiClient::INTERVAL_1_DAY,
    new \DateTime("-14 days"),
    new \DateTime("today")
);

// Retrieve dividends history, returns an array of Elminson\YahooFinanceApi\Results\DividendData
$dividendData = $client->getHistoricalDividendData(
    "AAPL",
    new \DateTime("-5 years"),
    new \DateTime("today")
);

// Retrieve stock split history, returns an array of Elminson\YahooFinanceApi\Results\SplitData
$splitData = $client->getHistoricalSplitData(
    "AAPL",
    new \DateTime("-5 years"),
    new \DateTime("today")
);

// Returns Elminson\YahooFinanceApi\Results\Quote
$exchangeRate = $client->getExchangeRate("USD", "EUR");

// Returns an array of Elminson\YahooFinanceApi\Results\Quote
$exchangeRates = $client->getExchangeRates([
    ["USD", "EUR"],
    ["EUR", "USD"],
]);

// Returns Elminson\YahooFinanceApi\Results\Quote
$quote = $client->getQuote("AAPL");

// Returns an array of Elminson\YahooFinanceApi\Results\Quote
$quotes = $client->getQuotes(["AAPL", "GOOG"]);
```

Version Guidance
----------------

[](#version-guidance)

VersionStatusPHP Version[1.x](https://github.com/elminson/yahoo-finance-api/tree/1.x)EOL&gt;= 5.3.0[2.x](https://github.com/elminson/yahoo-finance-api/tree/2.x)EOL&gt;= 5.6.0[3.x](https://github.com/elminson/yahoo-finance-api/tree/3.x)EOL&gt;= 5.6.0[4.x](https://github.com/elminson/yahoo-finance-api/tree/4.x)Maintained&gt;= 7.1.3License
-------

[](#license)

This library is available under the [MIT license](LICENSE).

Contributing
------------

[](#contributing)

Want to contribute to this project? See [CONTRIBUTING.md](CONTRIBUTING.md).

Support Me
----------

[](#support-me)

I'm developing this library since 2014. I love to hear from people using it, giving me the motivation to keep working on my open source projects.

If you want to let me know you're finding it useful, please consider giving it a star ⭐ on GitHub.

If you love my work and want to say thank you, you can help me out for a beer 🍻️ [via PayPal](https://paypal.me/ChristianScheb).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 89.5% 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 ~167 days

Recently: every ~0 days

Total

23

Last Release

812d ago

Major Versions

1.x-dev → v2.0.02017-08-10

v2.1.0 → v3.0.02017-11-14

2.x-dev → v3.1.02018-04-05

3.x-dev → v4.0.02020-06-18

PHP version history (3 changes)v1.0.0PHP &gt;=5.3.0

v2.0.0PHP &gt;=5.6.0

v4.0.0PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/e399869d29ffb004ec4652fee201a7a794169cfe1218fa4771a520419bfa02b0?d=identicon)[elminson](/maintainers/elminson)

---

Top Contributors

[![scheb](https://avatars.githubusercontent.com/u/1259952?v=4)](https://github.com/scheb "scheb (119 commits)")[![elminson](https://avatars.githubusercontent.com/u/2476286?v=4)](https://github.com/elminson "elminson (6 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (3 commits)")[![hackeresq](https://avatars.githubusercontent.com/u/16628119?v=4)](https://github.com/hackeresq "hackeresq (1 commits)")[![AbramovVyacheslav](https://avatars.githubusercontent.com/u/16228180?v=4)](https://github.com/AbramovVyacheslav "AbramovVyacheslav (1 commits)")[![Spomky](https://avatars.githubusercontent.com/u/1091072?v=4)](https://github.com/Spomky "Spomky (1 commits)")[![BenjaminPaap](https://avatars.githubusercontent.com/u/396685?v=4)](https://github.com/BenjaminPaap "BenjaminPaap (1 commits)")[![clind922](https://avatars.githubusercontent.com/u/3989064?v=4)](https://github.com/clind922 "clind922 (1 commits)")

---

Tags

apifinanceyahoostock

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/elminson-yahoo-finance-api/health.svg)

```
[![Health](https://phpackages.com/badges/elminson-yahoo-finance-api/health.svg)](https://phpackages.com/packages/elminson-yahoo-finance-api)
```

###  Alternatives

[scheb/yahoo-finance-api

PHP library for accessing Yahoo Finance data

318204.8k5](/packages/scheb-yahoo-finance-api)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[bunq/sdk_php

bunq PHP SDK

89222.7k2](/packages/bunq-sdk-php)[jeffreyhyer/alpaca-trade-api-php

PHP SDK for the Alpaca trade API

285.0k](/packages/jeffreyhyer-alpaca-trade-api-php)

PHPackages © 2026

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