PHPackages                             alexxd/stock-data - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. alexxd/stock-data

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

alexxd/stock-data
=================

This package provide realtime and historical global equity data in 4 different temporal resolutions:(1)daily,(2)weekly,(3)monthly,and(4)intraday.Daily,weekly,and monthly time series contain 20+ years of historical data.

1.0.2(6y ago)36MITPHPCI failing

Since Nov 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/alexxd35/Stock-Data)[ Packagist](https://packagist.org/packages/alexxd/stock-data)[ RSS](/packages/alexxd-stock-data/feed)WikiDiscussions master Synced 5d ago

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

 Stock-Data
============

[](#-stock-data-)

 This package provide realtime and historical global equity data in 4 different temporal resolutions:(1)daily,(2)weekly,(3)monthly,and(4)intraday.Daily,weekly,and monthly time series contain 20+ years of historical data.

[![Build Status](https://camo.githubusercontent.com/3b0e06119270d22a0b1adb1c284338a1a75997877a84921dbb5c1978e59ca2b4/68747470733a2f2f7472617669732d63692e6f72672f616c6578786433352f53746f636b2d446174612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/alexxd35/Stock-Data)[![StyleCI](https://camo.githubusercontent.com/87967dbb9fa29f12a1001f1f043e6c54ed865787c470559c092953db1c3a20af/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3232333134393230342f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/223149204)[![Latest Stable Version](https://camo.githubusercontent.com/6ec35aba8db28e1e61fc4a9b783e1e4553f3f31392e168c589fc7ed012dfd429/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c657878642f73746f636b2d646174612e737667)](https://packagist.org/packages/alexxd/stock-data)[![Total Downloads](https://camo.githubusercontent.com/61a38441008a3c4507b5b9115c2a7fff9f4565912084a1dadcb2e32c18bcc3fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c657878642f73746f636b2d646174612e737667)](https://packagist.org/packages/alexxd/stock-data)

Installing
----------

[](#installing)

```
$ composer require alexxd/stock-data -vvv
```

Configuration
-------------

[](#configuration)

Before using this extension, you need to go to the [Alphavantage](https://www.alphavantage.co/) to register your account, then create an app to get the API Key for your app.

Usage
-----

[](#usage)

```
use Alexxd\StockData\Stock;

$key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';

$stock = new Stock($key);

```

#### Get intraDay stock data

[](#get-intraday-stock-data)

```
$response = $stock->getIntradayStock('AAPL');

```

Example:

```

{
    "Meta Data": {
        "1. Information": "Intraday (5min) open, high, low, close prices and volume",
        "2. Symbol": "AAPL",
        "3. Last Refreshed": "2019-11-20 16:00:00",
        "4. Interval": "5min",
        "5. Output Size": "Compact",
        "6. Time Zone": "US/Eastern"
    },
    "Time Series (5min)": {
        "2019-11-20 16:00:00": {
            "1. open": "262.9000",
            "2. high": "263.0700",
            "3. low": "262.7800",
            "4. close": "262.7900",
            "5. volume": "707185"
        },
        "2019-11-20 15:55:00": {
            "1. open": "262.7200",
            "2. high": "262.8900",
            "3. low": "262.6222",
            "4. close": "262.8900",
            "5. volume": "386239"
        },
        "2019-11-20 15:50:00": {
            "1. open": "262.7100",
            "2. high": "262.9600",
            "3. low": "262.6800",
            "4. close": "262.7250",
            "5. volume": "329007"
        },
        ...
    }
}

```

#### Get daily stock data

[](#get-daily-stock-data)

```
$response = $stock->getDailyStock('AAPL');

```

#### Get weekly stock data

[](#get-weekly-stock-data)

```
$response = $stock->getWeeklyStock('AMZN');

```

#### Get monthly stock data

[](#get-monthly-stock-data)

```
$response = $stock->getMonthlyStock('TSLA');

```

Parameters
----------

[](#parameters)

```
getIntradayStock($symbol, $interval = '5', $format = 'json',$output_size='compact')
getDailyStock($symbol, $format = 'json',$output_size='compact')
getWeeklyStock($symbol, $format = 'json',$output_size='compact')
getMonthlyStock($symbol, $format = 'json',$output_size='compact')

```

**symbol** :The name of the equity of your choice. For example:AAPL

**interval**:(Only intraday required)Time interval between two consecutive data points in the time series. The following values are supported: 1, 5, 15, 30, 60

**format**:By default, format=json. Strings **json** and **csv** are accepted with the following specifications: json returns the intraday time series in JSON format; csv returns the time series as a CSV (comma separated value) file.

**output\_size**:By default, output\_size=compact. Strings **compact** and **full** are accepted with the following specifications: compact returns only the latest 100 data points in the intraday time series; full returns the full-length intraday time series. The "compact" option is recommended if you would like to reduce the data size of each API call.

Used in Laravel
---------------

[](#used-in-laravel)

The same installation is used in Laravel, and the configuration is written in config/services.php:

```
    .
    .
    .
     'stock' => [
        'key' => env('STOCK_API_KEY'),
    ],

```

Then configure STOCK\_API\_KEY in .env :

```
STOCK_API_KEY=xxxxxxxxxxxxxxxxxxxxx

```

There are two ways to get an Alexxd\\StockData\\Stock instance:

#### Method parameter injection

[](#method-parameter-injection)

```
    .
    .
    .
    public function test(Stock $stock)
    {
        $response = $stock->getIntraDayStock('AAPL');
    }
    .
    .
    .

```

#### Service name access

[](#service-name-access)

```
    .
    .
    .
    public function test()
    {
        $response = app('stock')->getIntraDayStock('AAPL');
    }
    .
    .
    .

```

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

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/alexxd/stock-data/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/alexxd/stock-data/issues).
3. Contribute new features or update the wiki.

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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 ~0 days

Total

3

Last Release

2367d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1975106?v=4)[Alexx](/maintainers/alexxd)[@alexxd](https://github.com/alexxd)

---

Top Contributors

[![alexxd35](https://avatars.githubusercontent.com/u/22424013?v=4)](https://github.com/alexxd35 "alexxd35 (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alexxd-stock-data/health.svg)

```
[![Health](https://phpackages.com/badges/alexxd-stock-data/health.svg)](https://phpackages.com/packages/alexxd-stock-data)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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