PHP code example of hirvi / ticketco-php

1. Go to this page and download the library: Download hirvi/ticketco-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hirvi / ticketco-php example snippets


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

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


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



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


// 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();

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

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