2017 © Pedro Peláez
 

library ticketco-php

Simple API wrapper for TicketCo.no

image

hirvi/ticketco-php

Simple API wrapper for TicketCo.no

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 50 % Grown

The README.md

TicketCo API - PHP Client Build Status

Installation

Add the following to your composer.json, (*1)

{
   "require": {
      "hirvi/ticketco-php": "~1.0"
   }
}

Laravel Users

We've added some classes to help Laravel 5 users make use of the library with ease., (*2)

Service Provider

You can register our service provider in your app.php config file., (*3)

// config/app.php
'providers' => [
    ...
    TicketCo\Laravel\TicketCoServiceProvider::class
]

Facade

If you prefer facades, make sure you add this as well:, (*4)

// config/app.php
'aliases' => [
    ...
    'TicketCo' => TicketCo\Laravel\TicketCoFacade::class
]

Configuration

There are only one configuration option you need to fill in. Publish the config by running:, (*5)

php artisan vendor:publish

Now, the config file will be located under config/ticketco.php:, (*6)

<?php
return [
    /*
    |--------------------------------------------------------------------------
    | TicketCo API key
    |--------------------------------------------------------------------------
    |
    | To obtain an API key, contact TicketCo or fill out this form:
    | https://app.pipefy.com/public_form/155824
    |
    */
    'apikey' => ''
];

Usage

Initialize

Unless you are using the Laravel Facade, you need to initialize the client by passing it the API-key., (*7)

<?php

require_once __DIR__ . '/vendor/autoload.php';

$ticketco = new TicketCo\Client('api-key');

Fetch all events

<?php
// Fetch all events
$events = $ticketco->events()->all();

// ... or if you are using the Laravel Facade
$events = TicketCo::events()->all();

// Using the Collection object, you can
// loop through all events using `each(callback)`
$events->each(function($event) {
    echo $event->title;
});

// ... or you can use foreach like with any other object/array
foreach($events as $event) {
    echo $event->title;
}

// ... or if you don't like the Collection object
// you can transform it into an array
$events = $events->toArray();

Get single event

// Fetch single event
$event = $ticketco->events()->get('<id>');
echo $event->title;

Get event status

Check whether the event is available or has ended., (*8)

$status = $ticketco->events()->status('<id>'); // Will return "available" or "ended".

Collection object

Queries will return an instance of the Illuminate\Support\Collection object, which is really easy to work with. If you don't want to use the Collection object however, you can transform it into an array using $result->toArray()., (*9)

Further documentation

TicketCo's API documentation is located here; http://apidoc.ticketco.no/api/v1/public., (*10)

The Versions

30/04 2018

dev-master

9999999-dev https://hirvi.no/

Simple API wrapper for TicketCo.no

  Sources   Download

MIT

The Requires

 

The Development Requires

ticketco ticketco-php

30/04 2018

v1.0.23

1.0.23.0 https://hirvi.no/

Simple API wrapper for TicketCo.no

  Sources   Download

MIT

The Requires

 

The Development Requires

ticketco ticketco-php

19/03 2018

v1.0.22

1.0.22.0 https://hirvi.no/

Simple API wrapper for TicketCo.no

  Sources   Download

MIT

The Requires

 

The Development Requires

ticketco ticketco-php

19/03 2018

dev-patch/upcoming

dev-patch/upcoming https://hirvi.no/

Simple API wrapper for TicketCo.no

  Sources   Download

MIT

The Requires

 

The Development Requires

ticketco ticketco-php

05/05 2017

v1.0.20

1.0.20.0 https://hirvi.no/

Simple API wrapper for TicketCo.no

  Sources   Download

MIT

The Requires

 

The Development Requires

ticketco ticketco-php

05/05 2017

v1.0.21

1.0.21.0 https://hirvi.no/

Simple API wrapper for TicketCo.no

  Sources   Download

MIT

The Requires

 

The Development Requires

ticketco ticketco-php

05/05 2017

v1.0.2

1.0.2.0 https://hirvi.no/

Simple API wrapper for TicketCo.no

  Sources   Download

MIT

The Requires

 

The Development Requires

ticketco ticketco-php

04/05 2017

v1.0.1

1.0.1.0 https://hirvi.no/

Simple API wrapper for TicketCo.no

  Sources   Download

MIT

The Requires

 

The Development Requires

ticketco ticketco-php