connectholland/tulip-api-client

PHP client library for communicating with the Tulip API.

1.1.1 2018-02-21 14:18 UTC

This package is auto-updated.

Last update: 2024-03-24 03:21:58 UTC


README

Latest version on Packagist Software License Scrutinizer Code Quality Build Status Code Coverage

PHP client library for communicating with the Tulip API.

Installation using Composer

Run the following command to add the package to the composer.json of your project:

$ composer require connectholland/tulip-api-client

Versioning

This library uses Semantic Versioning 2 for new versions.

Usage

Below are some common usage examples for the API client. For more information, please see the Tulip API documentation that is supplied when you want to integrate with the Tulip CRM software.

<?php

$client = new ConnectHolland\TulipAPI\Client('https://api.example.com', '1.1');

// Calls https://api.example.com/api/1.1/contact/detail with id=1
$response = $client->callService('contact', 'detail', array('id' => 1));

Inserting an object

<?php

$client = new ConnectHolland\TulipAPI\Client('https://api.example.com', '1.1');

// Calls https://api.example.com/api/1.1/contact/save
$response = $client->callService('contact', 'save', array(
    'firstname' => 'John',
    'lastname' => 'Doe',
    'email' => 'johndoe@gmail.com',
));

Updating an object

<?php

$client = new ConnectHolland\TulipAPI\Client('https://api.example.com', '1.1');

// Calls https://api.example.com/api/1.1/contact/save
$response = $client->callService('contact', 'save', array(
    'id' => 1,
    'firstname' => 'Jane',
    'lastname' => 'Doe',
    'email' => 'janedoe@gmail.com',
));

Uploading a file when inserting / updating an object

<?php

$client = new ConnectHolland\TulipAPI\Client('https://api.example.com', '1.1');

// Calls https://api.example.com/api/1.1/contact/save
$response = $client->callService('contact', 'save',
    array(
        'id' => 1,
        'firstname' => 'Jane',
        'lastname' => 'Doe',
        'email' => 'janedoe@gmail.com',
    ),
    array(
        'photo' => fopen('/path/to/files/photo.jpg', 'r'),
    )
);

Credits

Also see the list of contributors who participated in this project.

License

This library is licensed under the MIT License. Please see the LICENSE file for details.