PHPackages                             esatisfaction/esat-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. esatisfaction/esat-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

esatisfaction/esat-php
======================

E-satisfaction PHP Library

v1.1.0(7y ago)11MITPHPPHP ^7.0CI failing

Since May 4Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/esatisfaction/esat-php)[ Packagist](https://packagist.org/packages/esatisfaction/esat-php)[ RSS](/packages/esatisfaction-esat-php/feed)WikiDiscussions v1.1 Synced 2d ago

READMEChangelogDependencies (9)Versions (5)Used By (0)

e-satisfaction Http Package
===========================

[](#e-satisfaction-http-package)

[![Build Status](https://camo.githubusercontent.com/f762e85fbf8f78fb362d82a7f94cae36e1a4013ab9eb361865339398a1a39f3d/68747470733a2f2f7472617669732d63692e6f72672f65736174697366616374696f6e2f657361742d7068702e7376673f6272616e63683d76312e30)](https://travis-ci.org/esatisfaction/esat-php)[![Latest Stable Version](https://camo.githubusercontent.com/97081fc19eeccdeede6e99ea4f683b97101fa475e3e2f4b481a242ae17cce12a/68747470733a2f2f706f7365722e707567782e6f72672f65736174697366616374696f6e2f657361742d7068702f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/esatisfaction/esat-php)[![Total Downloads](https://camo.githubusercontent.com/e45baa2d4b04621a994aad025046975cf73bdfbc8c4c285ee3b13a57b567dfbd/68747470733a2f2f706f7365722e707567782e6f72672f65736174697366616374696f6e2f657361742d7068702f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/esatisfaction/esat-php)[![License](https://camo.githubusercontent.com/7a98d21193ed41681987c29720ff9da511d0b55c02723e3414dde2f16ed30c7d/68747470733a2f2f706f7365722e707567782e6f72672f65736174697366616374696f6e2f657361742d7068702f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/esatisfaction/esat-php)

PHP library for the e-satisfaction API

Requirements
------------

[](#requirements)

PHP 7.1.0 and later.

Composer
--------

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). Run the following command:

```
composer require esatisfaction/esat-php
```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
require_once('vendor/autoload.php');
```

Manual Installation
-------------------

[](#manual-installation)

If you do not wish to use Composer, you can download the [latest release](https://github.com/esatisfaction/esat-php/releases). Then, to use the bindings, include the `init.php` file.

```
require_once('/path/to/esatisfaction-php/init.php');
```

Dependencies
------------

[](#dependencies)

This library require the following extensions and packages in order to work properly:

- [`panda/config`](https://packagist.org/packages/panda/config)
- [`panda/helpers`](https://packagist.org/packages/panda/helpers)
- [`ramsey/uuid`](https://packagist.org/packages/ramsey/uuid)
- [`symfony/http-foundation`](https://packagist.org/packages/symfony/http-foundation)
- [`monolog/monolog`](https://packagist.org/packages/monolog/monolog)
- [`php-http/guzzle6-adapter`](https://packagist.org/packages/php-http/guzzle6-adapter)
- [`esatisfaction/http`](https://packagist.org/packages/esatisfaction/http)
- [`symfony/cache`](https://packagist.org/packages/symfony/cache)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available and loaded.

How do I start working with services?
-------------------------------------

[](#how-do-i-start-working-with-services)

To start working with the SDK, you have to initialize the following:

- Setup the main Esat Registry
- Set the Authorization Scheme to be used by each service's HttpClient

Example:

```
use \Esat\Esat;
use \Esat\Auth\TokenAuthProvider;
use \Esat\Http\AuthClient;
use \Monolog\Logger;

// Initialize Authentication
$tokenAuthProvider = new TokenAuthProvider('YOUR_TOKEN', 'YOUR_DOMAIN');
$httpClient = new AuthClient($tokenAuthProvider);

// Initialize main Esatisfaction Registry
$esatRegistry = new Esat();
```

### Questionnaires

[](#questionnaires)

Read your questionnaires:

```
use \Esat\Services\Questionnaires\Questionnaire;
use \Esat\Support\Model\Propel\FilterCriteria;
use \Esat\Support\Model\Propel\Pagination;
use \Monolog\Logger;

// Create Questionnaire Service
$questionnaire = new Questionnaire($esatRegistry, new Logger(), $httpClient);

// Load all questionnaires for my application
$applicationId = '123';
$filterCriteria = (new FilterCriteria())->equal('OwnerApplicationId', $applicationId);
$pagination = (new Pagination())->setMaxPerPage(25)->setPage(1);
$questionnairePager = $questionnaire->getList($filterCriteria, null, $pagination);

// Read all questionnaires
foreach ($questionnairePager->getQuestionnaires() as $questionnaireItem) {
    // Get questionnaire display name
    echo $questionnaireItem->getDisplayName();
}

// Load a questionnaire by id
if ($questionnaire->load('456sdfa')) {
    // Access questionnaire data
    $questionnaireModel = $questionnaire->getQuestionnaire();
    echo $questionnaireModel->getDisplayName();
}
```

### Questionnaire Instances

[](#questionnaire-instances)

Create a questionnaire instance and send the link to your customers:

```
use \Esat\Services\Questionnaires\Instances\Questionnaire;
use \Monolog\Logger;

// Create Questionnaire Service
$questionnaire = new Questionnaire($esatRegistry, new Logger(), $httpClient);

// Create questionnaire instance, with metadata
$responderMetadata = [
    'email' => 'john@doe.com',
    'gender' => 'male'
];
$questionnaireMetadata = [
    'transaction_id' => '12345asd',
    'transaction_date' => '2019-05-03 14:12'
];
if ($questionnaire->create('YOUR_QUESTIONNAIRE_ID', [], $questionnaireMetadata, $responderMetadata)) {
    // Get questionnaire collection url
    $collectionUrl = $questionnaire->getQuestionnaire()->getCollectionUrl();

    // Send your email with the above url
}
```

Read, Update or Delete Questionnaire Instances:

**NOTICE**: This will cause data deletion and might alter your data. It will not affect your credits as the credits are reduced on questionnaire submit.

```
use \Esat\Services\Questionnaires\Instances\Questionnaire;
use \Monolog\Logger;

// Create Questionnaire Service
$questionnaire = new Questionnaire($esatRegistry, new Logger(), $httpClient);

// Load a questionnaire instance
// We always have to load the instance before performing an update or delete operation
$instanceId = 'sadfewf2134d';
if (!$questionnaire->load($instanceId)) {
    // Handle error
    echo 'Questionnaire instance Not Found';
    die;
}

// Update the questionnaire instance
$questionnaire->getQuestionnaire()->setLocale('el');
$questionnaire->getQuestionnaire()->setValidDayes(50);
if (!$questionnaire->update()) {
    // Handle error
    echo 'Questionnaire instance failed to be updated';
    die;
}

// Load another questionnaire instance to delete
// We always have to load the instance before performing an update or delete operation
$instanceId = '23rteg34';
if (!$questionnaire->load($instanceId)) {
    // Handle error
    echo 'Questionnaire instance Not Found';
    die;
}

// Delete the questionnaire instance
if (!$questionnaire->delete()) {
    // Handle error
    echo 'Questionnaire instance failed to be deleted';
    die;
}
```

### Pipelines

[](#pipelines)

Read your pipelines:

```
use \Esat\Services\Questionnaires\Pipeline;
use \Monolog\Logger;

// Create Pipeline Service
$pipeline = new Pipeline($esatRegistry, new Logger(), $httpClient);

// Get all pipelines for a given questionnaire id
$questionnaireId = 'asdf34rtefdfwe';
$pipelines = $pipeline->getList($questionnaireId);

// Read all pipelines
foreach ($pipelines as $pipelineItem) {
    // Get pipeline title
    echo $pipelineItem->getTitle();
}

// Load a pipeline by id
if ($pipeline->load('345uyjhg')) {
    // Access pipeline data
    $pipelineModel = $pipeline->getPipeline();
    echo $pipelineModel->getTitle();
}
```

### Queue Items

[](#queue-items)

Add a queue item to allow e-satisfaction to send a survey:

```
use \Esat\Services\Questionnaires\Pipelines\Queue;
use \Monolog\Logger;

// Create Queue Service
$queue = new Queue($esatRegistry, new Logger(), $httpClient);

// Prepare queue item parameters
$questionnaireId = 'asdf34rtefdfwe';
$pipelineId = 'a09uherwgfd';
$parameters = [
    'responder_channel_identifier' => 'john@doe.com',
    'send_time' => '2019-05-02 12:32',
];

// Create queue item
if (!$queue->create($questionnaireId, $pipelineId, $parameters)) {
    // Handle error
    echo 'Queue item failed to be created. Error: ' . $queue->getErrorFromLastResponse();
    die;
}
```

Read, Update or Delete Queue Items:

```
use \Esat\Services\Questionnaires\Pipelines\Queue;
use \Monolog\Logger;

// Create Queue Service
$queue = new Queue($esatRegistry, new Logger(), $httpClient);

// Load a queue item
// We always have to load the item before performing an update or delete operation
$itemId = '9867w4wqrefd';
if (!$queue->load($itemId)) {
    // Handle error
    echo 'Queue item Not Found';
    die;
}

// Update the queue item
$queue->getQueueItem()->setLocale('el');
$queue->getQueueItem()->setSendTime('2019-06-03 14:32');
if (!$queue->update()) {
    // Handle error
    echo 'Queue item failed to be updated';
    die;
}

// Load another queue item to delete
// We always have to load the item before performing an update or delete operation
$itemId = '234rweg34';
if (!$queue->load($itemId)) {
    // Handle error
    echo 'Queue item Not Found';
    die;
}

// Delete the queue item
if (!$queue->delete()) {
    // Handle error
    echo 'Queue item failed to be deleted';
    die;
}
```

### Handling Errors

[](#handling-errors)

Each request stores the last response so that you can access it and get messages in case of errors.

```
use \Esat\Services\Questionnaires\Questionnaire;
use \Monolog\Logger;

// Create Questionnaire Service
$questionnaire = new Questionnaire($esatRegistry, new Logger(), $httpClient);

// Load a questionnaire by id
if ($questionnaire->load('456sdfa')) {
    // Access questionnaire data
    $questionnaireModel = $questionnaire->getQuestionnaire();
} else {
    // Handle the error, get the http response code and error message, if any
    $error = '';
    switch ($questionnaire->getLastResponse()->getStatusCode()) {
        case 500:
            $error = 'An unexpected error occurred';
            break;
        case 404:
            $error = 'Questionnaire Not Found';
            break;
        default:
            $error = $questionnaire->getErrorFromLastResponse();
    }

    // Display error
    echo $error;
}
```

### Caching

[](#caching)

This library is using a default runtime caching mechanism that reduces API calls during runtime.

The caching mechanism is on service level and works only on READ requests and is being reset when a POST or PATCH method is called on the same service.

If you are trying to READ the same resource twice without any updates in between, the service will hit the cache and get the same result. You can override the cache by calling `setCacheEnabled(false)` on the service before calling the method.

Examples:

```
use \Esat\Services\Questionnaires\Questionnaire;
use \Monolog\Logger;

// Create Questionnaire Service
$questionnaire = new Questionnaire($esat, new Logger(), $httpClient);

// DOES NOT hit cache
if ($questionnaire->load('456sdfa')) {
    // Access questionnaire data
    $questionnaireModel = $questionnaire->getQuestionnaire();
}

// DOES hit cache
if ($questionnaire->load('456sdfa')) {
    // Access questionnaire data
    $questionnaireModel = $questionnaire->getQuestionnaire();
}

// SKIP cache. From now on, all requests will skip cache.
$questionnaire->setCacheEnabled(false);
if ($questionnaire->load('456sdfa')) {
    // Access questionnaire data
    $questionnaireModel = $questionnaire->getQuestionnaire();
}

// Enable cache again to restore initial behavior. The following will DO hit cache
$questionnaire->setCacheEnabled(true);
if ($questionnaire->load('456sdfa')) {
    // Access questionnaire data
    $questionnaireModel = $questionnaire->getQuestionnaire();
}
```

Feedback
--------

[](#feedback)

This is an open-source library for calling e-satisfaction API.

Feel free to open Issues and Pull Requests to update it or fix bugs that you might find.

Code of Conduct Guidelines
--------------------------

[](#code-of-conduct-guidelines)

Take a look at the [Code of Conduct](CODE_OF_CONDUCT.md) document.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance46

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~99 days

Total

4

Last Release

2317d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2780884?v=4)[Ioannis Papikas](/maintainers/ioannis-papikas)[@ioannis-papikas](https://github.com/ioannis-papikas)

---

Top Contributors

[![ioannis-papikas](https://avatars.githubusercontent.com/u/2780884?v=4)](https://github.com/ioannis-papikas "ioannis-papikas (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/esatisfaction-esat-php/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.5k](/packages/laravel-framework)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k246.0M11.1k](/packages/symfony-framework-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M528](/packages/shopware-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)

PHPackages © 2026

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