PHP code example of meritoo / limesurvey-api-client
1. Go to this page and download the library: Download meritoo/limesurvey-api-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
meritoo / limesurvey-api-client example snippets
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 lt = $client->run(MethodType::LIST_SURVEYS);
/*
* ...and grab data from the result
*/
$data = $result->getData();
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
// 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;
use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration;
$configuration = new ConnectionConfiguration('http://test.com', 'test', 'test', true);
$configuration->setDebugMode(true);
$debugMode = $configuration->isDebugModeOn();
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)