PHPackages                             offshoot/vend-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. offshoot/vend-php

AbandonedArchivedLibrary[API Development](/categories/api)

offshoot/vend-php
=================

Simple Vend API client in PHP

1.0.0(11y ago)53.7k3MITPHPPHP &gt;=5.3.0

Since Feb 1Pushed 5y ago7 watchersCompare

[ Source](https://github.com/TeamOffshoot/vend-php)[ Packagist](https://packagist.org/packages/offshoot/vend-php)[ Docs](https://github.com/TeamOffshoot/vend-php)[ RSS](/packages/offshoot-vend-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (5)Used By (0)

vend-php
========

[](#vend-php)

A simple [Vend API](https://developers.vendhq.com/) client in PHP.

The canoncial repository for this stream of development is

Requirements
------------

[](#requirements)

- PHP 5.3 (or higher)
- ext-curl, ext-json
- offshoot/http

Development Requirements
------------------------

[](#development-requirements)

- phpunit/phpunit 3.7

Getting Started
---------------

[](#getting-started)

Install vend-php via [Composer](http://getcomposer.org/)

Create a `composer.json` file if you don't already have one in your projects root directory and require vend-php:

```
{
  "require": {
    "offshoot/vend-php": "~1.0"
  }
}

```

To learn more about Composer, including the complete installation process, visit

### Using cURL

[](#using-curl)

If you're using a cURL based HttpClient like the `CurlHttpClient`, you will want to include the cacert.pem file that can be found at

You can add this as a dependency in your composer file. Your `composer.json`might look something like this:

```
{
  "require": {
    "offshoot/vend-php": "~1.0",
    "haxx-se/curl": "1.0.0"
  },
  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "haxx-se/curl",
        "version": "1.0.0",
        "dist": {
          "url": "http://curl.haxx.se/ca/cacert.pem",
          "type": "file"
        }
      }
    }
  ]
}

```

You will be able to find the cacert.pem file in `vendor/haxx-se/curl/cacert.pem`

Usage
-----

[](#usage)

### Authentication

[](#authentication)

#### Getting an Access Token

[](#getting-an-access-token)

If you do not already have a Vend API Permanent Access Token, you will need you authenticate with the Vend API first

```
$pathToCertificateFile = 'vendor/haxx-se/curl/cacert.pem';
$httpClient = new \Offshoot\HttpClient\CurlHttpClient($pathToCertificateFile);
$redirector = new \Offshoot\Redirector\HeaderRedirector();

$authenticate = new \Vend\Api\AuthenticationGateway($httpClient, $redirector);

$authenticate->forStoreName('mycoolstore')
    ->usingClientId('XXX1234567890') // get this from your Vend Account
    ->andReturningTo('http://wherever.you/like')
    ->initiateLogin();

```

This will redirect your user to a Vend login screen where they will need to authenticate with their Vend credentials. After doing that, Vend will perform a GET request to your redirect URI, that will look like:

```
GET http://wherever.you/like?code=TEMP_TOKEN&domain_prefix=YOUR_STORE_NAME

```

Your application will need to capture the `code` query param from the request and use that to get the access token from Vend

```
// validate the Vend Request
if ($client->isValidRequest($_GET)) {

    // exchange the token
    $accessToken = $authenticate->forStoreName('mycoolstore')
        ->usingClientId('XXX1234567890') // get this from your Vend Account
        ->usingClientSecret('ABC123XYZ') // get this from your Vend Account
        ->andReturningTo('http://wherever.you/like')
        ->toExchange($_GET['code']);

}

```

#### Refreshing an Access Token

[](#refreshing-an-access-token)

TBD

### Interacting with the Vend API

[](#interacting-with-the-vend-api)

#### Set up the API Client

[](#set-up-the-api-client)

```
$vend = new \Vend\Api\Client($httpClient);
$vend->setStoreName('mycoolstore');
$vend->setAccessToken($accessToken);

```

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

[](#contributing)

Contributions are welcome. Just fork the repository and send a pull request. Please be sure to include test coverage with your pull request. You can learn more about Pull Requests [here](https://help.github.com/articles/creating-a-pull-request)

In order to run the test suite, ensure that the development dependencies have been installed via composer. Then from your command line, simple run:

```
vendor/bin/phpunit --bootstrap tests/bootstrap.php tests/

```

License
-------

[](#license)

This library is released under the [GPL 3.0 License](https://github.com/TeamOffshoot/vend-php/blob/master/LICENSE)

Acknowledgements
----------------

[](#acknowledgements)

Thanks to [Bruce Aldridge](https://github.com/brucealdridge/VendAPI) for his development of the initial code base.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 74.2% 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

4118d ago

### Community

Maintainers

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

---

Top Contributors

[![chriswoodford](https://avatars.githubusercontent.com/u/249055?v=4)](https://github.com/chriswoodford "chriswoodford (49 commits)")[![brucealdridge](https://avatars.githubusercontent.com/u/57298?v=4)](https://github.com/brucealdridge "brucealdridge (16 commits)")[![neilhamilton](https://avatars.githubusercontent.com/u/387817?v=4)](https://github.com/neilhamilton "neilhamilton (1 commits)")

---

Tags

shope-commerceshoppingvend

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/offshoot-vend-php/health.svg)

```
[![Health](https://phpackages.com/badges/offshoot-vend-php/health.svg)](https://phpackages.com/packages/offshoot-vend-php)
```

###  Alternatives

[aimeos/aimeos-laravel

Cloud native, API first Laravel eCommerce package with integrated AI for ultra-fast online shops, marketplaces and complex B2B projects

8.6k214.7k3](/packages/aimeos-aimeos-laravel)[vendapi/vendapi

Vend API class

354.6k1](/packages/vendapi-vendapi)[amsgames/laravel-shop

Package set to provide shop or e-commerce functionality (such as CART, ORDERS, TRANSACTIONS and ITEMS) to Laravel for customizable builds.

4845.9k](/packages/amsgames-laravel-shop)[lukesnowden/google-shopping-feed

Google Shopping Feed API

70281.6k](/packages/lukesnowden-google-shopping-feed)

PHPackages © 2026

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