PHPackages                             teraxis/etsy-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. teraxis/etsy-php

ActiveLibrary[API Development](/categories/api)

teraxis/etsy-php
================

Simple PHP wrapper for Etsy API via Proxy

0.12.1(7y ago)09MITPHPPHP &gt;=5.3.0

Since Jul 14Pushed 6y agoCompare

[ Source](https://github.com/teraxis/etsy-php)[ Packagist](https://packagist.org/packages/teraxis/etsy-php)[ RSS](/packages/teraxis-etsy-php/feed)WikiDiscussions 0.12.2 Synced 5d ago

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

Etsy PHP SDK [![Build Status](https://camo.githubusercontent.com/7e0024c56d9031b556e0c8d07a45c9ca0dcdb9829af389a8de8def5ac8d33f84/68747470733a2f2f7472617669732d63692e6f72672f696e616b696162742f657473792d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/inakiabt/etsy-php)
===============================================================================================================================================================================================================================================================================================

[](#etsy-php-sdk-)

Based on [Etsy Rest API description](http://www.etsy.com/developers/documentation/reference/apimethod) output, this wrapper provides a simple client with all available methods on Etsy API (thanks to the `__call` magic PHP method!), validating its arguments on each request (Take a look to  for full list of methods and its arguments).

I'm looking for help
--------------------

[](#im-looking-for-help)

Lately, I couldn't dedicate the time I think this repo deserved, so I'm looking for help!

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

[](#requirements)

Note: I will be working on remove this dependencies

- cURL devel:
    - Ubuntu: `sudo apt-get install libcurl4-dev`
    - Fedora/CentOS: `sudo yum install curl-devel`
- OAuth pecl package:
    - `sudo pecl install oauth`
    - And then add the line `extension=oauth.so` to your `php.ini`

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

[](#installation)

The following recommended installation requires [composer](http://getcomposer.org/). If you are unfamiliar with composer see the [composer installation instructions](http://getcomposer.org/doc/01-basic-usage.md#installation).

Add the following to your `composer.json` file:

```
{
  "require": {
    "inakiabt/etsy-php": ">=0.10"
  }
}
```

Usage
-----

[](#usage)

All methods has only one argument, an array with two items (both are optional, depends on the method):

- *params*: an array with all required params to build the endpoint url. > Example: [getSubSubCategory](http://www.etsy.com/developers/documentation/reference/category#method_getsubsubcategory): GET /categories/:tag/:subtag/:subsubtag

```
  # it will request /categories/tag1/subtag1/subsubtag1
  $api->getSubSubCategory(array(
          'params' => array(
                         'tag' => 'tag1',
                         'subtag' => 'subtag1',
                         'subsubtag' => 'subsubtag1'
           )));
```

- *data*: an array with post data required by the method > Example: [createShippingTemplate](http://www.etsy.com/developers/documentation/reference/shippingtemplate#method_createshippingtemplate): POST /shipping/templates

```
  # it will request /shipping/templates sending the "data" array as the post data
  $api->createShippingTemplate(array(
    						'data' => array(
   							    "title" => "First API Template",
   							    "origin_country_id" => 209,
   							    "destination_country_id" => 209,
   							    "primary_cost" => 10.0,
   							    "secondary_cost" => 10.0
           )));
```

OAuth configuration script
--------------------------

[](#oauth-configuration-script)

Etsy API uses OAuth 1.0 authentication, so lets setup our credentials.

The script `scripts/auth-setup.php` will generate an OAuth config file required by the Etsy client to make signed requests. Example:

```
export ETSY_CONSUMER_KEY=qwertyuiop123456dfghj
export ETSY_CONSUMER_SECRET=qwertyuiop12

php scripts/auth-setup.php /path/to/my-oauth-config-destination.php
```

It will show an URL you must open, sign in on Etsy and allow the application. Then copy paste the verification code on the terminal. (On Mac OSX, it will open your default browser automatically)

### Generated OAuth config file

[](#generated-oauth-config-file)

After all, it should looks like this:

```
