PHPackages                             jeffreyhyer/alpaca-trade-api-php - 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. jeffreyhyer/alpaca-trade-api-php

ActiveLibrary[API Development](/categories/api)

jeffreyhyer/alpaca-trade-api-php
================================

PHP SDK for the Alpaca trade API

3.0.1(4y ago)285.0k↓30.3%15[1 issues](https://github.com/JeffreyHyer/alpaca-trade-api-php/issues)MITPHPPHP &gt;=7.2.5

Since Mar 7Pushed 2y ago2 watchersCompare

[ Source](https://github.com/JeffreyHyer/alpaca-trade-api-php)[ Packagist](https://packagist.org/packages/jeffreyhyer/alpaca-trade-api-php)[ Docs](https://github.com/jeffreyhyer/alpaca-trade-api-php)[ RSS](/packages/jeffreyhyer-alpaca-trade-api-php/feed)WikiDiscussions master Synced 1mo ago

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

Alpaca PHP SDK
==============

[](#alpaca-php-sdk)

[![Packagist Version](https://camo.githubusercontent.com/9a057ba0f9940b8ed7795e77e838e12b37453e38ee421b974b136f82ef12820d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a656666726579687965722f616c706163612d74726164652d6170692d7068703f6c6162656c3d5061636b6167697374)](https://camo.githubusercontent.com/9a057ba0f9940b8ed7795e77e838e12b37453e38ee421b974b136f82ef12820d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a656666726579687965722f616c706163612d74726164652d6170692d7068703f6c6162656c3d5061636b6167697374)[![Packagist](https://camo.githubusercontent.com/f00abfd7db2fc54e1b3237db09dd92e78af4a397807bb913d883e09d4bbd2280/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a656666726579687965722f616c706163612d74726164652d6170692d7068703f636f6c6f723d626c7565266c6162656c3d446f776e6c6f616473)](https://camo.githubusercontent.com/f00abfd7db2fc54e1b3237db09dd92e78af4a397807bb913d883e09d4bbd2280/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a656666726579687965722f616c706163612d74726164652d6170692d7068703f636f6c6f723d626c7565266c6162656c3d446f776e6c6f616473)

This repository contains a PHP SDK for use with the [Alpaca](https://alpaca.markets?ref_by=858915e73e) API.

**DISCLAIMER:** This is **NOT** an official SDK, it is not affiliated with nor endorsed by Alpaca in any way.

Release Notes
-------------

[](#release-notes)

#### v3.0.0

[](#v300)

With the release of `v3.0.0` of this library we use the Alpaca Data API v2. The `getLastTrade` and `getLastQuote` methods are backwards compatible and require no changes to your codebase.

⚠️ The `getBars` method is NOT backwards compatible so you will need to update your codebase to use the new method signature found in the Market Data section below.

#### v2.0.0

[](#v200)

With the release of `v2.0.0` of this library we use v2 of the Alpaca API. However, the methods are all backwards compatible with v1.0.0 of this library and v1 of the Alpaca API so upgrading should be as simple as updating the package version in your `composer.json` file and installing. Everything should work as it did before but now you'll have access to the new methods and new method parameters.

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

[](#installation)

**NOTE**: This package currently requires PHP &gt;= 7.2.5

```
$ composer require jeffreyhyer/alpaca-trade-api-php
```

Usage
-----

[](#usage)

From within your PHP application you can access the Alpaca API with just a couple of lines:

```
