PHPackages                             tracardi/tracardi-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. tracardi/tracardi-php-sdk

ActiveLibrary[API Development](/categories/api)

tracardi/tracardi-php-sdk
=========================

PHP client to connect with the Tracardi API

11786PHP

Since Apr 30Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Tracardi/tracardi-php-sdk)[ Packagist](https://packagist.org/packages/tracardi/tracardi-php-sdk)[ RSS](/packages/tracardi-tracardi-php-sdk/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Tracardi PHP SDK
================

[](#tracardi-php-sdk)

Getting started
---------------

[](#getting-started)

### 1. Create a Guzzle client

[](#1-create-a-guzzle-client)

```
use GuzzleHttp\Client;

$baseUrl = 'https://';

$client = new Client([
  'base_uri' => $baseUrl
]);
```

### 2. Create the OAuth2 provider &amp; retrieve an access token

[](#2-create-the-oauth2-provider--retrieve-an-access-token)

```
use Tracardi\TracardiPhpSdk\OAuth2\Provider\TracardiProvider;

$provider = new TracardiProvider(['baseUrl' => $baseUrl]);

$accessToken = $provider->getAccessToken('password', [
  'username' => '',
  'password' => ''
]);
```

### 3. Combine the above to get the Tracardi client

[](#3-combine-the-above-to-get-the-tracardi-client)

```
use Http\Adapter\Guzzle6\Client as ClientAdapter;
use Tracardi\TracardiPhpSdk\Http\ApiClient\ApiClient;

$psrClient = new ClientAdapter($client);
$apiClient = ApiClient::withProvider($psrClient, $provider, $accessToken);
```

### 4. Start using the repositories

[](#4-start-using-the-repositories)

```
use Tracardi\TracardiPhpSdk\Tracardi;

$profile = Tracardi::withDefaultSerializer($apiClient)
  ->profiles()
  ->getProfile('');
```

### 5. Using your own HTTP client

[](#5-using-your-own-http-client)

It is not strictly required to use the League OAuth provider, alternatively you can instantiate the API client with an HTTP client only. It is your own responsibility that this HTTP client performs authenticated requests.

This flow requires some PSR-7 request factory to be present, e.g. `composer require nyholm/psr7`. See the [php-http docs](https://docs.php-http.org/en/latest/discovery.html) for more information.

```
use Http\Adapter\Guzzle6\Client as ClientAdapter;
use Tracardi\TracardiPhpSdk\Http\ApiClient\ApiClient;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;

// When using Guzzle you could create your own custom middleware
// that fetches the access token from e.g. the database.
$middleware = function (callable $handler): callable {
  return function (RequestInterface $request, array $options) use ($handler) {
    $request = $request->withHeader('Authorization', 'Bearer ' . fetchToken());

    return $handler($request, $options);
  };
};
$stack = HandlerStack::create();
$stack->push($middleware);

$client = new Client([
  'base_uri' => 'https://',
  'handler' => $stack
]);

$psrClient = new ClientAdapter($client);
$apiClient = ApiClient::withClient($psrClient);
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d94510a74d44a9d5a43110b862bd2a6fd85af13ac70cc4f6fbf2d267556da68f?d=identicon)[tracardi](/maintainers/tracardi)

---

Top Contributors

[![atompie](https://avatars.githubusercontent.com/u/16271564?v=4)](https://github.com/atompie "atompie (11 commits)")[![bceyssens](https://avatars.githubusercontent.com/u/7702573?v=4)](https://github.com/bceyssens "bceyssens (10 commits)")[![mark-gerarts](https://avatars.githubusercontent.com/u/11940560?v=4)](https://github.com/mark-gerarts "mark-gerarts (3 commits)")

### Embed Badge

![Health badge](/badges/tracardi-tracardi-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/tracardi-tracardi-php-sdk/health.svg)](https://phpackages.com/packages/tracardi-tracardi-php-sdk)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M451](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
