2017 © Pedro Peláez
 

library skiddle-php-sdk

PHP Wrapper for Skiddle API

image

skiddle/skiddle-php-sdk

PHP Wrapper for Skiddle API

  • Monday, March 12, 2018
  • by skiddlemike
  • Repository
  • 3 Watchers
  • 5 Stars
  • 2,514 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 14 % Grown

The README.md

Skiddle PHP SDK


The purpose of the SDK is to allow for easy access to the Skiddle API. This will allow developers to easily communicate with the Skiddle API to pull through information about events, artists and venues, (*1)


Table of contents

  1. Requirements
  2. Installation
    1. Download the SDK
    2. Get an API Key
    3. Integrate
  3. Examples
    1. Authenticate Yourself
    2. Get the class Ready
    3. Add and Remove conditions
    4. Get results
    5. Get a single result
  4. Things to note
  5. License
  6. Contact

Requirements

The API requires PHP > 5.4.0, due to using autoloading and new array constructs. It also requires cURL to be enabled, which is normally done by default in PHP, but best to double check., (*2)

To connect to the API, TLS v1.2 or above is required. This has been supported by Curl using OpenSSL since version 1.0.1, (*3)


Installation

Download the SDK

There are a couple of ways to get the SDK integrated to your project, the easiest way is probably via composer:, (*4)

"require": {
    "skiddle/skiddle-php-sdk": "1.0.0"
}

You can also clone the git repository, (*5)

git clone https://github.com/Skiddle/skiddle-php-sdk

Or, simply download the zip here and unzip to your project., (*6)

If using either of the last two methods, you will need to include the autoloader.php file in your project to load everything up, (*7)

Get an API Key

Getting an API key is simple and free, simply go to https://www.skiddle.com/api/join.php to get one now, (*8)

Integrate

Once you have the code and an API key, you are ready to get started!!, (*9)


Examples

You can view code samples in the /demo/ directory included in the repo, (*10)

Authenticate yourself

The first step is to simply authenticate yourself - just tell the SDK what your API Key is, (*11)

try {
    $session = new SkiddleSDK\SkiddleSession(['api_key'=>'APIKEYGOESHERE']);
} catch (SkiddleSDK\SkiddleException $e) {
    echo $e->getMessage();
    exit();
}

If you don't want to store this in your code, you can add it to your server environment as SKIDDLE_API_KEY and the SDK will read from there., (*12)


Get the class Ready

After you have successfully authenticated yourself, you then need to pass your credentials to the revelant class that you want to use. This combines your authentication info with the endpoint necessary to make the calls., (*13)

To do this, simply call the setSession() method of the class you wish to use:, (*14)

$events = new SkiddleSDK\Events;
try {
    $events->setSession($session);
} catch (SkiddleSDK\SkiddleException $e) {
    echo $e->getMessage();
    exit();
}

Add and Remove conditions

You are now ready to make calls to the API. You can now technically make a call to return listings, however the Skiddle SDK allows you to easily add or remove conditions to make your query specific to your needs., (*15)

To add a condition, you just need to pass the field and value in the addCond() method:, (*16)

$events->addCond('eventcode','CLUB');
$events->addCond('ticketsavailable','1);

Likewise, to remove conditions, just use the delCond() method, using only the field name:, (*17)

$events->delCond('ticketsavailable');

Get Results

Once you have built up your filter list, you can then get your listings!, (*18)

$listings = $events->getListings();

foreach($listings->results as $result) {...}

For a full list of arguments you can filter by, have a look here, (*19)

Get a single result

If you need to get a single result, you can call getListing(), without having to build an array of arguments - just pass the relevant ID, (*20)

For example:, (*21)

$listing = $events->getListing(12345);

var_dump($listing);

Things to note

  1. When querying eventcodes, try to keeo values uppercase. Passing CLUB will work, whereas passing club may return an error
  2. When using the minDate and maxDate conditions, timestamps need to be in either Y-m-d or Y-m-dTH:i:s format.
  3. Don't like objects? You can get results in array format by passing a boolean in getListings():, (*22)

    $listings = $events->getListings(true);
    
    foreach($listings['results'] as $result) {...}
    
  4. Check back for more

License

This SDK is licensed under the GNU General Public License v3.0. View the license here, (*23)


Contact

Got any questions, or ways to improve the SDK? Feel free to log an issue, or pull and fork as much as you want!, (*24)

The Versions

12/03 2018

dev-master

9999999-dev https://github.com/Skiddle/skiddle-php-sdk

PHP Wrapper for Skiddle API

  Sources   Download

MIT

The Requires

  • php >=5.4.0 || ^7.0
  • ext-curl *

 

The Development Requires

php sdk skiddle

05/09 2017

v1.1.4

1.1.4.0 https://github.com/Skiddle/skiddle-php-sdk

PHP Wrapper for Skiddle API

  Sources   Download

MIT

The Requires

  • php >=5.4.0 || ^7.0
  • ext-curl *

 

The Development Requires

php sdk skiddle

05/01 2017

v1.1.3

1.1.3.0 https://github.com/Skiddle/skiddle-php-sdk

PHP Wrapper for Skiddle API

  Sources   Download

MIT

The Requires

  • php >=5.4.0 || ^7.0
  • ext-curl *

 

The Development Requires

php sdk skiddle

28/12 2016

v1.1.2

1.1.2.0 https://github.com/Skiddle/skiddle-php-sdk

PHP Wrapper for Skiddle API

  Sources   Download

MIT

The Requires

  • php >=5.4.0 || ^7.0
  • ext-curl *

 

The Development Requires

php sdk skiddle

02/12 2016

v1.1.1

1.1.1.0 https://github.com/Skiddle/skiddle-php-sdk

PHP Wrapper for Skiddle API

  Sources   Download

MIT

The Requires

  • php >=5.4.0 || ^7.0
  • ext-curl *

 

The Development Requires

php sdk skiddle

29/11 2016

v1.1

1.1.0.0 https://github.com/Skiddle/skiddle-php-sdk

PHP Wrapper for Skiddle API

  Sources   Download

MIT

The Requires

  • php >=5.4.0 || ^7.0
  • ext-curl *

 

The Development Requires

php sdk skiddle

24/11 2016

v1.0

1.0.0.0 https://github.com/Skiddle/skiddle-php-sdk

PHP Wrapper for Skiddle API

  Sources   Download

MIT

The Requires

  • php >=5.4.0 || ^7.0
  • ext-curl *

 

The Development Requires

php sdk skiddle