mattybaer/ebay-sdk-php

An eBay SDK for PHP. Use the eBay API in your PHP projects.

v19.0.0 2021-08-11 14:12 UTC

README

This repository is now actively maintained by Bibliopolis.

This project enables PHP developers to use the eBay API in their PHP code, and build software using services such as Finding, Trading, Shopping, etc. You can get started by installing the SDK via Composer and by following the Basic Usage Guide.

This is a project that has been developed by David T. Sadler. Bibliopolis has forked the code and will keep up to date. It is in no way endorsed, sponsored or maintained by eBay.

Plans

  • Keep up to date with latest PHP version
  • Add latest features required to be an eBay Developer (as of now that is the Notification API)

Features

Resources

  • User Guides - Getting started guide and in-depth information.
  • Examples - Several examples of using the SDK. Plans to fork and add new examples.

Requirements

  • PHP 7.3 or greater with the following extensions:
    • cURL
    • libxml
  • 64 bit version of PHP recommended as there are some issues when using the SDK with 32 bit.
  • SSL enabled on the cURL extension so that https requests can be made.

Installation

The SDK can be installed with Composer. Please see the Installation section of the User Guide to learn about installing through other means.

  1. Install Composer.

    curl -sS https://getcomposer.org/installer | php
    
  2. Install the SDK.

    php composer.phar require mattybaer/ebay-sdk-php
    
  3. Require Composer's autoloader by adding the following line to your code.

    require 'vendor/autoload.php';

Example

Get public key

<?php

require 'vendor/autoload.php';

use \DTS\eBaySDK\Notification\Services;
use \DTS\eBaySDK\Notification\Types;

// Fetch request headers from eBay
$headers = getallheaders();
$key = base64_decode($headers['x-ebay-signature']);

// Create the service object.
$service = new Services\NotificationService([
  'authorization' => <AUTHORIZATION_HERE>
]);

// Create the request object.
$request = new Types\GetPublicKeyRestRequest();
$request->public_key_id = $key;

// Send the request to the service operation.
$response = $service->getPublicKey($request);

// Output the result of calling the service operation.
printf("Your official eBay public key is: %s\n", print_r($response, true));

License

Licensed under the Apache Public License 2.0.

Copyright 2016 David T. Sadler