Download the PHP package offshoot/vend-php without Composer

On this page you can find all versions of the php package offshoot/vend-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package vend-php

vend-php

A simple Vend API client in PHP.

The canoncial repository for this stream of development is https://github.com/TeamOffshoot/vend-php

Requirements

Development Requirements

Getting Started

Install vend-php via Composer

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 http://getcomposer.org/

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 http://curl.haxx.se/docs/caextract.html

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

Authentication

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

TBD

Interacting with the Vend API

Set up the API Client

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

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

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

This library is released under the GPL 3.0 License

Acknowledgements

Thanks to Bruce Aldridge for his development of the initial code base.


All versions of vend-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
ext-curl Version *
offshoot/http Version dev-master
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package offshoot/vend-php contains the following files

Loading the files please wait ....