PHPackages                             quentn/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. quentn/php-sdk

ActiveLibrary[API Development](/categories/api)

quentn/php-sdk
==============

Official PHP SDK for the Quentn Api

2.0.6(8mo ago)249.2k—5.6%MITPHPPHP &gt;=7.1

Since Jan 16Pushed 8mo agoCompare

[ Source](https://github.com/quentncom/quentn-php)[ Packagist](https://packagist.org/packages/quentn/php-sdk)[ RSS](/packages/quentn-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (11)Used By (0)

quentn-php
==========

[](#quentn-php)

Official Quentn PHP API Client

This is the official PHP library which provides a simple interface to Quentn API. It is easy to use and fully supported by Quentn.com GmbH

Installation
------------

[](#installation)

You need to install [Composer](http://getcomposer.org) to manage dependencies.

Run the following Composer command to install the latest stable version of Quentn PHP SDK.

```
composer require quentn/php-sdk

```

Examples
--------

[](#examples)

We need to add *autoload.php* at the top of each file

```
require __DIR__ . './vendor/autoload.php';

```

Response include three main elements, data, status and rateLimits

**Data:** Data depends on your request, it can be contact details like name, email etc, it can be request success status i.e true/false.

**Status:** HTTP Status Codes

**Rate Limits:** All calls within the Web API are allotted a specific number of requests per refresh period.
Each API response contains limit numbers, remaining and reset time.

### Contact API Example

[](#contact-api-example)

```
require __DIR__ . './vendor/autoload.php';
$quentn = new Quentn\Quentn([
    'api_key' => 'API_KEY',
    'base_url' => 'BASE_URL',
]);

//add additional headers
$headers = [
    'X-sender-source' => 'mybusinessid',
    'X-sender-source-key' => 'cdTHikGOQQuiIqo2VcCmkyIqIPq82oUm7juC9wqnxY',
];
$quentn->setHeaders($headers);

if (!$quentn->test()) {
    echo "key doesn't seem to work";
    exit;
}
//create contact
$data = [
        "first_name" => "Johnn",
        "family_name" => "Doe",
        "mail" => "johndoe@example.com",
    ];
    try {
        $get_response = $quentn->contacts()->createContact($data);
        //get id of newly created contact
        $contact_id = $get_response['data']['id'];
    } catch (Exception $e) {
        echo $e->getMessage();
    }

// Get all terms of a contact
 try {
      $get_response = $quentn->contacts()->getContactTerms($contactId);
      $terms = $get_response['data'];
      foreach ($terms as $term) {
         echo $term['name']."\n";
      }
 } catch (Exception $e) {
        echo $e->getMessage();
 }

```

With Contact Api, you can perform following functions

**GET a Contact by Id**

User can find contact by ID

```
findContactById((int) $contactId, (string)$fields = NULL);

```

**GET a Contact by Mail**

User can find contact by Email

```
findContactByMail((string) $mail, (string)$fields = NULL);

```

**Create Contact**

User can create contact

```
createContact((array)$data);

```

**Create Multiple Contacts**

User can create multiple contacts in one call

```
createContacts((array)$data);

```

**Update Contact**

User can update contact

```
updateContact((int)$contactId, (array)$data);

```

**Delete Contact**

User can delete contact

```
deleteContact((int)$contactId);

```

**GET Contact Terms**

User can Get all terms of a contact

```
getContactTerms((int)$contactId)

```

**SET contact terms** **(DEPRECATED)**

User can **overwrite** all contact terms. By using this POST method you will overwrite the whole terms field.

**Attention:** This will delete all your existing terms. If you want to add terms please use *addContactTerms*.

```
setContactTerms((int)$contactId, (array)$terms);

```

**Add Contact terms**

User can add term to a contact

```
addContactTerms((int) $id, (array)$terms);

```

**Delete a contact term**

User can delete terms of a contact

```
deleteContactTerms((int) $id, (array)$terms);

```

[Click here](https://github.com/quentncom/quentn-php/blob/master/examples/contact-examples.php/) to view full example of usage of contact API

### Term API Example

[](#term-api-example)

```
    require __DIR__ . './vendor/autoload.php';
    $quentn = new Quentn\Quentn([
        'api_key' => 'API_KEY',
        'base_url' => 'BASE_URL',
    ]);

    /*
    * TEST API CREDENTIALS.
    */
    if (!$quentn->test()) {
        echo "key doesn't seem to work";
        exit;
    }

        /*
        * get list of all terms
        */
        try {
            $get_response = $quentn->terms()->getTerms();
            $terms = $get_response['data'];
            foreach ($terms as $term) {
                echo $term['name']."\n";
            }
        } catch (Exception $e) {
            echo $e->getMessage();
        }

    //get term by id
     try {
            $get_response = $quentn->terms()->findTermById($termId);
             echo $get_response['data']['name']."\n";
             echo $get_response['data']['description'];
        } catch (Exception $e) {
            echo $e->getMessage();
        }

```

With Term Api, you can perform following functions

**GET Terms**

User can find a list of all terms

```
getTerms((int)$offset = 0, (int)$limit = 500);

```

**GET Term by ID**

User can find term by Id

```
findTermById((int)$termId);

```

**Get Term by Name**

User can find term by name

```
findTermByName((string)$termName);

```

**Create Term**

User can create terms

```
createTerm((array)$data);

```

**Update Term**

User can update term

```
updateTerm((int)$id, (array)$data);

```

**Delete Term**

User can delelte term

```
deleteTerm((int)$termId);

```

[Click here](https://github.com/quentncom/quentn-php/blob/master/examples/term-examples.php/) to view full example of usage of term API

### Custom Field API Example

[](#custom-field-api-example)

```
    require __DIR__ . './vendor/autoload.php';
    $quentn = new Quentn\Quentn([
        'api_key' => 'API_KEY',
        'base_url' => 'BASE_URL',
    ]);

    /*
    * TEST API CREDENTIALS.
    */
    if (!$quentn->test()) {
        echo "key doesn't seem to work";
        exit;
    }

        /*
        * get list of all custom fields
        */
        try {
              $get_response = $quentn->custom_fields()->getCustomFields();
              $custom_fields = $get_response['data'];
              foreach ($custom_fields as $custom_field) {
                 echo $custom_field['field_name']."\n";
              }
            } catch (Exception $e) {
                echo $e->getMessage();
            }

    //find custom field by ID
     try {
           $get_response = $quentn->custom_fields()->findCustomFieldById($customFieldId);
           echo $get_response['data']['field_name']."\n";
           echo $get_response['data']['label']."\n";
           echo $get_response['data']['description']."\n";
           echo $get_response['data']['type']."\n";
           echo $get_response['data']['required']."\n";
         } catch (Exception $e) {
             echo $e->getMessage();
         }

```

With Contact Field Api, you can perform following functions

**GET Custom Fields**

User can find a list of all custom fields

```
getCustomFields();

```

**GET Cutom Field by ID**

User can find Cutom Field by Id

```
findCustomFieldById((int)$customFieldId);

```

**Get Cutom Field by Name**

User can find Cutom Field by name

```
findCustomFieldByName((string)$cutomFieldName);

```

**Create Cutom Field**

User can create cutom field

```
createCustomField((array)$data);

```

**Update Cutom Field**

User can update cutom field

```
updateCustomField((string)$cutomFieldName, (array)$data);

```

**Delete Cutom Field**

User can delete cutom field

```
deleteCustomField((string)$cutomFieldName);

```

[Click here](https://github.com/quentncom/quentn-php/blob/master/examples/custom-field-examples.php/) to view full example of usage of Cutom Field API

OAuth
-----

[](#oauth)

To start your OAuth process, you need to register your app with the Quentn. After registration your will get Client ID and Client Secret.

**Set OAuth Configuration**

Once you got Client ID and Client Secret, you need to call function *setApp* with the following variables

**client\_id:** The client ID you received when you created your app with Quentn

**client\_secret:** The client ID you received when you created your app with Quentn

**redirect\_url:** Indicates the URI to return the user after authorization. Domain must be one of the domains you already registered with quentn. For example, if you registered *example.com*, then you can use *example.com/my/redirect/url*

```
setApp([
        'client_id' => 'CLIENT_ID',
        'client_secret' => 'CLIENT_SECRET',
        'redirect_uri' => 'REDIRECT_URL',
    ]);

```

**Get Authorization Url**

To get Authorization link to the user, you need to call the *getAuthorizationUrl()*

```
getAuthorizationUrl();

```

In return you will get authorization url, i.e

```
https://my.quentn.com/public/api/v1/oauth/?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=all&state=4a4c2ZD

```

**client\_id:** As mentioned above, the client ID you received when you created your app with Quentn

**redirect\_uri:** As mentioned above, it indicates the URI to return the user after authorization. Domain must be one of the domains you already registered with quentn. For example, if you registered *example.com*, then you can use *example.com/my/redirect/url*

**scope:** It indicates the values which parts of the user's account you want to access, default is 'all'

**response\_type:** It indicates that your server expects to receive an authorization code, default is code

**state:** A random string generated by your application, it will varify later

**Check if User is Successfully Authorized**

To check if user is successfully authorized, you can use following function.

```
authorize()

```

### OAuth example

[](#oauth-example)

```
    require __DIR__ . './vendor/autoload.php';
    $quentn = new Quentn\Quentn();
    $quentn->oauth()->setApp([
        'client_id' => 'CLIENT_ID',
        'client_secret' => 'CLIENT_SECRET',
        'redirect_uri' => 'REDIRECT_URL',
    ]);

    if($quentn->oauth()->authorize()) {
            /*
            do you stuff here
            You can access your App key and base url here
                 echo $quentn->getApiKey()."\n";
                 echo $quentn->getBaseUrl()."\n";
            */
                try {
                    $get_response = $quentn->contacts()->findContactById($contactId, 'first_name, mail');
                } catch (Exception $e) {
                    echo $e->getMessage();
                }
    }

    else {
      //to get the Authorization URL you can use getAuthorizationUrl() function
      echo 'Click here to get authorize';
    }

```

Full Quentn API Documentation
-----------------------------

[](#full-quentn-api-documentation)

[Click here to view our full Quentn documentation.](https://docs.quentn.com/api/requests/)

License
-------

[](#license)

[![MIT](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance58

Moderate activity, may be stable

Popularity30

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 91.2% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~267 days

Recently: every ~310 days

Total

10

Last Release

269d ago

Major Versions

1.0.2 → 2.0.02021-03-10

PHP version history (2 changes)1.0PHP &gt;=5.6

2.0.2PHP &gt;=7.1

### Community

Maintainers

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

---

Top Contributors

[![waqas996](https://avatars.githubusercontent.com/u/19811871?v=4)](https://github.com/waqas996 "waqas996 (31 commits)")[![quentncom](https://avatars.githubusercontent.com/u/46375273?v=4)](https://github.com/quentncom "quentncom (2 commits)")[![waqas-ahmed-1](https://avatars.githubusercontent.com/u/46378253?v=4)](https://github.com/waqas-ahmed-1 "waqas-ahmed-1 (1 commits)")

---

Tags

apiemail marketingMarketing Automationquentn

### Embed Badge

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

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

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)

PHPackages © 2026

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