2017 © Pedro Peláez
 

project pims-api-client-php

Simple PHP client for the Pims API

image

pimssas/pims-api-client-php

Simple PHP client for the Pims API

  • Wednesday, July 25, 2018
  • by pimssas-packagist
  • Repository
  • 2 Watchers
  • 0 Stars
  • 34 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 113 % Grown

The README.md

Pims PHP API client

Simple PHP client for the Pims API (documentation here)., (*1)

Requirement

php >= 7.0

Installation

Use Composer to install. Simply add this line to your composer.json file:, (*2)

"require": {
    "pimssas/pims-api-client-php": "dev-master"
}

and then run:, (*3)

$ composer update

Or install directly from the command line:, (*4)

$ composer require pimssas/pims-api-client-php:"dev-master"

Usage

First step, you have to create a Client instance:, (*5)

use Pims\Api\Client;
use Pims\Api\Exception\ClientException;

try {
    // Minimal setup...
    $client = new Client(
            'https://demo.pims.io/api',
            'username',
            'password');

    // ... or full setup, with language and version
    $client = new Client(
            'https://demo.pims.io/api',
            'username',
            'password',
            'fr',
            'v1');
} catch (ClientException $e) {
    echo $e->getMessage();
}

Then you can call it on various endpoints, like this:, (*6)

use Pims\Api\Endpoint;

try {
    // Get the label of the event by ID 2127
    $event = $client->getOne(
            Endpoint::EVENTS,
            2127);
    $label = $event->getProperty('label');

    // Get all events occuring in April 2018
    $results = $client->getAll(
            Endpoint::EVENTS,
            [
                    'from_date' => '2018-04-01',
                    'to_date'   => '2018-04-30'
            ]);
    $events = $results->getResource('events');
    while ($results->hasLink('next')) {
        $results = $client->getNext($results);
        $events = array_merge(
                $events,
                $results->getResource('events'));
    }

    // Get the first 3 channels applied to the event by ID 2127
    $promotions = $client->getAll(
            Endpoint::EVENTS_CHANNELS,
            [
                    ':event_id' => 2127,
                    'page_size' => 3
            ]);

    // Create a new streams group
    $client->postOne(
            Endpoint::STREAMS_GROUP,
            ['label' => 'Streams group test']);

    // Update the status of the promotion by ID 1437
    $client->patchOne(
            Endpoint::PROMOTIONS,
            1437,
            ['status_id' => 'ENG']);

    // Delete the venue by ID 234
    $client->deleteOne(
            Endpoint::VENUES,
            234);
} catch (ClientException $e) {
    echo $e->getMessage();
}

License

Copyright (c) 2010-2019 Pims SAS. Released under the MIT License., (*7)

The Versions

25/07 2018

dev-master

9999999-dev

Simple PHP client for the Pims API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pims
by Pims SAS

api-wrapper pims

25/07 2018

dev-dev/fix/unitTest

dev-dev/fix/unitTest

Simple PHP client for the Pims API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pims SAS

api-wrapper pims

18/04 2018

dev-dev

dev-dev

Simple php client for Pims-Api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pims

api-wrapper pims

17/04 2018

1.0.0

1.0.0.0

Simple php client for Pims-Api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pims

api-wrapper pims