This package is abandoned and no longer maintained. No replacement package was suggested.

A PHP wrapper for the Close.io Api

v0.7.1 2018-08-17 06:29 UTC


License Build Status Coverage Status

Packagist Packagist Packagist Packagist

The CloseIo API Wrapper is a package that allows you to access in an object oriented way the Close.io REST APIs and fetch or create data.


Unfortunately as most of the original developers on this project are no longer with Loopline, or dealing with close.io we've taken the decision to archive it. This way it should be clear that the repository is not being maintained. For anyone who is interested in maintaining it please fork away and we wish you good luck!

If you want a bit more info on the decision to archive it you can see https://github.com/loopline-systems/closeio-api-wrapper/issues/122


To install the library you will need to be using Composer in your project. To install it please see the official docs. CloseIo Api Wrapper uses Httplug to not be tied to any specific library that sends HTTP messages. This means that users are free to choose whichever PSR-7 implementation and HTTP client they want, be it Guzzle or a simple cURL client.

If you just want to get started quickly you should run the following command:

composer require loopline-systems/closeio-api-wrapper php-http/curl-client nyholm/psr7

This will install the library itself along with an HTTP client adapter for Httplug that uses cURL and a PSR-7 implementation needed to create the messages. You do not need to use those packages if you don't want to: you may use any package that provides php-http/async-client-implementation and http-message-implementation.


To get started you just need to create an instance of the client and then use its method to query the REST APIs of Close.io.

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

use LooplineSystems\CloseIoApiWrapper\Client;
use LooplineSystems\CloseIoApiWrapper\CloseIoApiWrapper;
use LooplineSystems\CloseIoApiWrapper\Configuration;

$configuration = new Configuration('{api-key}');
$client = new Client($configuration);
$closeIoApiWrapper = new CloseIoApiWrapper($client);

$leadsApi = $closeIoApiWrapper->getLeadApi();

// create lead
$lead = new Lead();
$lead->setName('Test Company');
$lead->setDescription('Company description');

// address
$address = new Address();
$address->setAddress1('Main Street');

// contacts
$contact = new Contact();
$contact->setName('Testy Testersson');
$contact->setTitle('Chief Tester');

// emails
$email = new Email();

// phones
$phone = new Phone();


$response = $leadsApi->addLead($lead);

Adding Opportunities

$opportunity = new Opportunity();
$opportunity->setNote('My note on this opportunity');

// you can use the leadApi to get ID for leads

$opportunityApi = $this->apiWrapper->getOpportunityApi();
$result = $opportunityApi->addOpportunity($opportunity);


$activityApi = $this->apiWrapper->getActivityApi();
// SMS
$sms = new SmsActivity();
$sms->setText('first sms');

// EMails
$email = new EmailActivity();
$email->setSubject('RE: Support');
$email->setSender('Support <support@nowhere.net>');
$email->setTo('Customer <customer@nowhere.net>');


Updating custom fields

$customField = new CustomField();
$customField->setId('Custom field id')
$customField->addChoice('Value for choices list');

$customFieldApi = $this->apiWrapper->getCustomFieldApi();
$result = $customFieldApi->updateCustomField($customField);


Right now just a few APIs are implemented, because the main need was to create leads. Feel free to add requests and create pull requests or go on forking the repository.

We use https://github.com/btford/adj-noun for our release names, so don't worry they have no special meaning :)


Michael Devery - michaeldevery@gmail.com
Marco Roßdeutscher - marco.rossdeutscher@loopline-systems.com
Marc Zahn - marc.zahn@loopline-systems.com

See also the list of contributors who participated in this project.


The Close.io API Wrapper is licensed under the MIT License: see the LICENSE file for more information.

! We are not affiliated with Close.io itself.