PHPackages                             meritoo/limesurvey-api-client - 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. meritoo/limesurvey-api-client

ActiveLibrary[API Development](/categories/api)

meritoo/limesurvey-api-client
=============================

Client of LimeSurvey API

0.1.1(7y ago)63.4kMITPHP &gt;=5.6

Since Sep 19Compare

[ Source](https://github.com/meritoo/limesurvey-api-client)[ Packagist](https://packagist.org/packages/meritoo/limesurvey-api-client)[ RSS](/packages/meritoo-limesurvey-api-client/feed)WikiDiscussions Synced today

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

Meritoo LimeSurvey API Client
=============================

[](#meritoo-limesurvey-api-client)

Client of the [LimeSurvey's API](https://manual.limesurvey.org/RemoteControl_2_API).

[![Travis](https://camo.githubusercontent.com/c2987083302f60f7aecd01c521be3798bf450b981692c91fa24a91bd31da7169/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f727573742d6c616e672f727573742e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/meritoo/limesurvey-api-client) [![Packagist](https://camo.githubusercontent.com/5bcf0733ddb13fa15d22cb5d0f26f031ad5378311ba273c55566e82757694ca7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d657269746f6f2f6c696d657375727665792d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/meritoo/limesurvey-api-client) [![StyleCI](https://camo.githubusercontent.com/1b15bdabe9630bb393ae396bfd25a2ce5b2e21f75b64d8065bcb9e24acfada7d/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130343131343936302f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/104114960) [![license](https://camo.githubusercontent.com/ecee111446dcfc0ec6e1489e9a6e459de3b5bb3ab297dfba90cd03f755fee199/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d657269746f6f2f6c696d657375727665792d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/meritoo/limesurvey-api-client) [![GitHub commits](https://camo.githubusercontent.com/8a4d52f48b5689679aeab0e47da19473513b0ca6b25157e8c68790e19138d699/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f6d657269746f6f2f6c696d657375727665792d6170692d636c69656e742f302e302e312e7376673f7374796c653d666c61742d737175617265)](https://github.com/meritoo/limesurvey-api-client) [![Coverage Status](https://camo.githubusercontent.com/d9c613e94e60b6866976a178fb31fbb1abf4f71c35cc1f204befd19611051ebc/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d657269746f6f2f6c696d657375727665792d6170692d636c69656e742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/meritoo/limesurvey-api-client?branch=master)

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

[](#installation)

Run [Composer](https://getcomposer.org) to install this package in your project:

```
$ composer require meritoo/limesurvey-api-client
```

> How to install Composer:

Configuration of LimeSurvey
---------------------------

[](#configuration-of-limesurvey)

1. Login to the LimeSurvey administration, e.g. using  address
2. Go to menu: `Configuration` -&gt; `Global settings`
3. Open `Interfaces` tab
4. For `RPC interface enabled` select `JSON-RPC` option
5. Enable `Publish API on /admin/remotecontrol` option

It should look like here: [![Configuration of LimeSurvey](https://camo.githubusercontent.com/a6c1a520bd2ff80ee35636ca791374c63ffa0a728124b61dd9fa2cf26f427f46/687474703a2f2f7777772e6d657269746f6f2e706c2f7061636b616765732f6769746875622f6c696d657375727665792d6170692d636c69656e742f726561646d652f636f6e66696775726174696f6e2d696e74657266616365732e706e67)](https://camo.githubusercontent.com/a6c1a520bd2ff80ee35636ca791374c63ffa0a728124b61dd9fa2cf26f427f46/687474703a2f2f7777772e6d657269746f6f2e706c2f7061636b616765732f6769746875622f6c696d657375727665792d6170692d636c69656e742f726561646d652f636f6e66696775726174696f6e2d696e74657266616365732e706e67)More information: [https://manual.limesurvey.org/RemoteControl\_2\_API#Introduction](https://manual.limesurvey.org/RemoteControl_2_API#Introduction)

Usage
-----

[](#usage)

1. First of all you have to prepare configuration of connection and create instance of a client:

    ```
    use Meritoo\LimeSurvey\ApiClient\Client\Client;
    use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration;
    use Meritoo\LimeSurvey\ApiClient\Type\MethodType;

    /*
     * Prepare configuration of connection and client of the API
     */
    $configuration = new ConnectionConfiguration('http://test.com', 'test', 'test');
    $client = new Client($configuration);
    ```
2. Next run the method which you would like:

    ```
    /*
     * Run required method
     */
    $result = $client->run(MethodType::LIST_SURVEYS);
    ```
3. Finally grab data from result of called method:

    ```
    /*
     * ...and grab data from the result
     */
    $data = $result->getData();
    ```

Full code of this example:

```
use Meritoo\LimeSurvey\ApiClient\Client\Client;
use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration;
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;

/*
 * Prepare configuration of connection and client of the API
 */
$configuration = new ConnectionConfiguration('http://test.com', 'test', 'test');
$client = new Client($configuration);

/*
 * Run required method and grab data from the result
 */
$result = $client->run(MethodType::LIST_SURVEYS);
$data = $result->getData();
```

Available methods
-----------------

[](#available-methods)

All available methods provides `Meritoo\LimeSurvey\ApiClient\Type\MethodType` class as constants of the class. Examples:

```
// Add a response to the survey responses collection
MethodType::ADD_RESPONSE;

// The IDs and properties of token/participants of a survey
MethodType::LIST_PARTICIPANTS;

// List the surveys belonging to a user
MethodType::LIST_SURVEYS;
```

Name of the method, actually constant of the `MethodType` class, you should pass as 1st argument of `\Meritoo\LimeSurvey\ApiClient\Client\Client::run()` method. Example:

```
$client->run(MethodType::GET_PARTICIPANT_PROPERTIES);
```

Debug mode
----------

[](#debug-mode)

In some cases more information may be required to fix bugs. The "debug" mode will help you do this. You can turn it on while preparing configuration of connection by passing `true` as 4th argument of constructor:

```
use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration;
$configuration = new ConnectionConfiguration('http://test.com', 'test', 'test', true);
```

The "debug" mode can be turned on if the instance of configuration exists by using the `\Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration::setDebugMode()` method:

```
$configuration->setDebugMode(true);
```

If you want to verify if if the "debug" mode is turned on simply call the `\Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration::isDebugModeOn()` method:

```
$debugMode = $configuration->isDebugModeOn();
```

Getting data from result
------------------------

[](#getting-data-from-result)

#### Verify if the result is empty

[](#verify-if-the-result-is-empty)

First of all you have to call required method to get result - instance of `\Meritoo\LimeSurvey\ApiClient\Result\Result` class. The result allows you to get information if there is any data by calling the `\Meritoo\LimeSurvey\ApiClient\Result\Result::isEmpty()` method:

```
use Meritoo\LimeSurvey\ApiClient\Result\Result;
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;

$result = new Result(MethodType::LIST_SURVEYS, []);
$isEmpty = $result->isEmpty();

var_dump($isEmpty); // bool(true)
```

#### Prepared/processed vs raw data

[](#preparedprocessed-vs-raw-data)

Result allows you to get data, the essence of calling API's method by calling the `\Meritoo\LimeSurvey\ApiClient\Result\Result::getData()` method. This method accepts 1 bool argument:

- `false` - (default) prepared/processed data provided will be returned
- `true` - raw data will be returned

Prepared/processed data means instances of classes from `Meritoo\LimeSurvey\ApiClient\Result\Item\*` namespace.

> Attention.
>
> 1. The above is true, if result provided by the API *is iterable*. Otherwise - instance of single item is returned.
> 2. Methods that provides iterable result:
>
> - MethodType::LIST\_PARTICIPANTS
> - MethodType::LIST\_QUESTIONS
> - MethodType::LIST\_SURVEYS
> - MethodType::LIST\_USERS
>
> They are defined in `Meritoo\LimeSurvey\ApiClient\Type\MethodType::isResultIterable()` method.

#### Prepared/processed data

[](#preparedprocessed-data)

All instances are returned as elements of collection (instance of `Meritoo\Common\Collection\Collection` class). Example:

```
class Meritoo\Common\Collection\Collection#565 (1) {
  private $elements =>
  array(2) {
    [0] =>
    class Meritoo\LimeSurvey\ApiClient\Result\Item\Survey#564 (5) {
      private $id =>
      int(456)
      private $title =>
      string(12) "Another Test"
      private $expiresAt =>
      NULL
      private $active =>
      bool(true)
    }
    [1] =>
    class Meritoo\LimeSurvey\ApiClient\Result\Item\Survey#564 (5) {
      private $id =>
      int(456)
      private $title =>
      string(12) "Another Test"
      private $expiresAt =>
      NULL
      private $active =>
      bool(true)
    }
  }
}
```

If result provided by the API *is not iterable*, as mentioned above, instance of single item is returned. Example:

```
class Meritoo\LimeSurvey\ApiClient\Result\Item\Participant#701 (17) {
  private $id =>
  int(123)
  private $participantId =>
  int(456)
  private $mpId =>
  NULL
  private $firstName =>
  string(5) "Lorem"
  private $lastName =>
  string(5) "Ipsum"
  (...)
}
```

#### Raw data

[](#raw-data)

An array with scalars or other arrays. Example:

```
array(2) {
  [0] =>
  array(5) {
    'sid' =>
    string(3) "123"
    'surveyls_title' =>
    string(4) "Test"
    'startdate' =>
    NULL
    'expires' =>
    string(19) "2017-09-19 13:02:41"
    'active' =>
    string(1) "N"
  }
  [1] =>
  array(5) {
    'sid' =>
    string(3) "456"
    'surveyls_title' =>
    string(12) "Another Test"
    'startdate' =>
    string(19) "2017-09-19 13:02:41"
    'expires' =>
    NULL
    'active' =>
    string(1) "Y"
  }
}
```

Links
-----

[](#links)

- LimeSurvey:
- Composer:

Enjoy!

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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 ~29 days

Recently: every ~80 days

Total

13

Last Release

2857d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5606316?v=4)[Meritoo.pl](/maintainers/meritoo)[@meritoo](https://github.com/meritoo)

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/meritoo-limesurvey-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/meritoo-limesurvey-api-client/health.svg)](https://phpackages.com/packages/meritoo-limesurvey-api-client)
```

###  Alternatives

[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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