PHPackages                             sam-it/ls-interfaces - 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. sam-it/ls-interfaces

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

sam-it/ls-interfaces
====================

Interfaces for Limesurvey entities: Survey, Group, Question, Answer

v0.5.0(9y ago)15.3k11MITPHP

Since Oct 26Pushed 9y ago1 watchersCompare

[ Source](https://github.com/SAM-IT/ls-interfaces)[ Packagist](https://packagist.org/packages/sam-it/ls-interfaces)[ RSS](/packages/sam-it-ls-interfaces/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (12)Used By (1)

ls-interfaces
=============

[](#ls-interfaces)

Interfaces for Limesurvey entities: Survey, Group, Question, Answer

Abstracting from the Limesurvey questions, subquestions and answer scales is done in the following way.

Abstraction from LimeSurvey.
============================

[](#abstraction-from-limesurvey)

\--DRAFT

- Each Question has a number of dimensions (currently limited to: {0, 1, 2}).
- A single choice or text question has 0 dimensions, it has 1 data point.
- A question with 1 dimension has n data points, where n is the number of (sub)questions in the first dimension.
- A question with 2 dimensions has n \* m data points, where n is the number of questions in the first dimension and m is the number of questions in the 2nd dimension.
- Each data point either has a fixed set of answers (LimeSurvey imposes the extra restriction that for each question this fixed set is the same for all subquestions.

Examples:
---------

[](#examples)

```
    public function int getDimensions();

    /**
     * Returns the subquestions for the specified dimension.
     **/
    public function QuestionInterface[] getQuestions(int $i);

```

If `getDimensions()` returns 2 for a question, then all questions returned from `getQuestions()` will have 1 dimension. (Think of it like partial function application)

```
    if ($question->getDimensions() == 2) {

        foreach($question->getQuestions(0) as $i => $subQuestion) {
            assert($subQuestion->getDimensions() == 1);

            foreach($subQuestion->getQuestions(0) as $j => $subSubQuestion) {
                assert($subSubQuestion->getDimensions() == 0);
                assert(
                    $subSubQuestion->getId()
                    == $question->getQuestions(1)[j]->getQuestions(0)[$i]->getId()
                    == $question->getQuestions($i, $j)->getId()
                );

            }
        }
    }

```

Intuitively in most cases you can think of dimension 0 as the Y axis, and dimension 1 as the X axis. How much did you eat?

........YesterdayTodayVegetables\[0, 0\]\[1, 0\]Meat\[0, 1\]\[1, 1\]- Note that unlike LimeSurvey in practice, these interfaces could support different answer options for each data point.

These interfaces require the implementer implements question objects even when LimeSurvey might not have corresponding questions, consider dual scale questions:

...Scale 1Scale 2SQ001{1, 2, 3}{Yes, Maybe, No}SQ002{1, 2, 3}{Yes, Maybe, No}In this example (in LS) scale 1 has answer options 1, 2 and 3, scale 2 has options Yes, Maybe and No. These interfaces do not have the notion of answer scales. Instead only questions with 0 dimensions may have answer options. Further more our interfaces require this to be exposed as a question with 2 dimensions, with 2 questions each. Note that Scale 1 and Scale 2 in this must be exposed as Questions.

Usage
=====

[](#usage)

The goal of these interfaces is to allow developers to program against interfaces without worrying about LimeSurvey internals. An implementer can, for example, create a client that uses the JSON-RPC API available in LS2.x (). Alternatives, could be creating a LimeSurvey plugin that exposes the required data as JSON (this could be more performant since less round trips are requried).

When LimeSurvey internals change there is no need to adapt dependent code and the only thing that needs to be adapted are the implementations of these interfaces.

Notes
=====

[](#notes)

Some random notes that will be moved to appropriate interfaces:

- `QuestionInterface::getId()` must be unique within a LimeSurvey installation, this must also hold for "dummy" objects like the Scale questions.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~22 days

Recently: every ~47 days

Total

11

Last Release

3636d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/18b13c534e3812b66a72645fe215301b54fc4d288f6396fee9385b681e27da18?d=identicon)[SamMousa](/maintainers/SamMousa)

---

Top Contributors

[![SamMousa](https://avatars.githubusercontent.com/u/547021?v=4)](https://github.com/SamMousa "SamMousa (13 commits)")

### Embed Badge

![Health badge](/badges/sam-it-ls-interfaces/health.svg)

```
[![Health](https://phpackages.com/badges/sam-it-ls-interfaces/health.svg)](https://phpackages.com/packages/sam-it-ls-interfaces)
```

###  Alternatives

[thiagomarini/binocular

Doing Event Sourcing without building a spaceship

373.0k](/packages/thiagomarini-binocular)[adigital/gdprdatachecker

Run through the database and pull out any information associated with a specified email address

151.0k](/packages/adigital-gdprdatachecker)

PHPackages © 2026

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