PHP SDK

Apideck offers a native SDK for PHP. Choose one language below to see our API Reference in your application’s language.

Command Line
composer require "apideck-libraries/sdk-php"

Getting started

The module supports all Apideck API endpoints. For complete information about the API, head to the docs. All endpoints require a valid apiKey so that's the only required parameter to initialize a new Apideck client

PHP
declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->setConsumerId('<insert-consumer-id-here>')
    ->setAppId('<insert-application-id-here>')
    ->build();

$request = new Operations\CrmContactsAllRequest(
    serviceId: 'salesforce',
    filter: new Components\ContactsFilter(
        firstName: 'Elon',
        lastName: 'Musk',
        email: 'elon@tesla.com',
        companyId: '12345',
        ownerId: '12345',
    ),
    sort: new Components\ContactsSort(
        by: Components\ContactsSortBy::CreatedAt,
        direction: Components\SortDirection::Desc,
    ),
    passThrough: [
        'search' => 'San Francisco',
    ],
    fields: 'id,updated_at',
);

$responses = $sdk->crm->contacts->list(
    request: $request
);


foreach ($responses as $response) {
    if ($response->httpMeta->response->getStatusCode() === 200) {
        // handle response
    }
}