PHPackages                             tonisormisson/limesurvey-relevance-imex - 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. tonisormisson/limesurvey-relevance-imex

ActiveLimesurvey-plugin[Utility &amp; Helpers](/categories/utility)

tonisormisson/limesurvey-relevance-imex
=======================================

A LimeSurvey Plugin to allow Import &amp; Export of survey Relevance equations

2.1.13(2w ago)021[6 issues](https://github.com/TonisOrmisson/limesurvey-structure-imex/issues)[4 PRs](https://github.com/TonisOrmisson/limesurvey-structure-imex/pulls)MITPHPPHP &gt;=8.3.0 &lt;8.6CI passing

Since Dec 21Pushed 2w ago2 watchersCompare

[ Source](https://github.com/TonisOrmisson/limesurvey-structure-imex)[ Packagist](https://packagist.org/packages/tonisormisson/limesurvey-relevance-imex)[ Docs](https://github.com/TonisOrmisson/limesurvey-relevance-imex)[ RSS](/packages/tonisormisson-limesurvey-relevance-imex/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (8)Versions (35)Used By (0)

LimeSurvey Structure Import/Export Plugin
=========================================

[](#limesurvey-structure-importexport-plugin)

[![Tests](https://github.com/TonisOrmisson/limesurvey-structure-imex/workflows/Tests/badge.svg)](https://github.com/TonisOrmisson/limesurvey-structure-imex/actions)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![PHP Version](https://camo.githubusercontent.com/7535257ca228724c93658bd52583d4e47a9bab02c356abf6e54c1d575f2151e6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c75652e737667)](https://php.net)

A LimeSurvey plugin for importing and exporting survey structure, relevance logic, and quotas via Excel files.

Installation &amp; set-up
=========================

[](#installation--set-up)

Install to plugins folder
-------------------------

[](#install-to-plugins-folder)

```
cd /LimeSurveyFolder/plugins

```

```
git clone https://github.com/TonisOrmisson/limesurvey-structure-imex.git  StructureImEx

```

```
cd StructureImEx && composer install

```

Activate plugin from Plugin manager

Find the plugin Import / Export buttons from survey tools menu.

[![menu](images/menu.png)](images/menu.png)

Features
--------

[](#features)

- **Questions**: Export/import survey question structure with attributes
- **Relevance Logic**: Export/import conditional logic and expressions
- **Quotas**: Export/import survey quotas and participation limits
- **RemoteControl API (optional)**: Exposes plugin actions discoverable via `list_plugin_api` and callable via `call_plugin_api` (requires global `rpc_plugin_api` to be enabled)

See [docs/](docs/) folder for detailed format specifications. RemoteControl API usage is documented in [docs/REMOTE\_CONTROL\_API.md](docs/REMOTE_CONTROL_API.md).

Updating
========

[](#updating)

go to plugin folder

```
cd /LimeSurveyFolder/plugins/StructureImEx

```

Get updates via git. `git pull` or `git fetch --all && git checkout my-version-tag`

Run install command to make sure dependencies are updated if necessary.

```
composer install --no-dev && composer dump-autoload

```

Development &amp; Testing
=========================

[](#development--testing)

Testing Overview
----------------

[](#testing-overview)

This plugin includes both unit tests (using mocks) and functional tests (using real database interaction) to ensure reliability and catch regressions early.

### Test Suites

[](#test-suites)

1. **Unit Tests**: Fast tests using mock data, no database required
2. **Functional Tests**: Integration tests with real LimeSurvey database interaction
3. **Code Quality**: PHPStan static analysis

Quick Start - Local Development
-------------------------------

[](#quick-start---local-development)

### Prerequisites

[](#prerequisites)

- PHP 8.1+
- MySQL/MariaDB
- Composer

### 1. Install Development Dependencies

[](#1-install-development-dependencies)

```
composer install
```

### 2. Setup Test Database

[](#2-setup-test-database)

Copy the environment configuration:

```
cp .env.example .env
```

Edit `.env` with your database settings:

```
DB_HOST=localhost
DB_PORT=3306
DB_NAME=limesurvey_test
DB_USER=root
DB_PASSWORD=root
```

Run the database setup script:

```
composer test-setup
```

This will:

- Create the test database
- Import LimeSurvey schema
- Verify the setup

### 3. Run Tests

[](#3-run-tests)

```
vendor/bin/phpunit
```

Coverage. We only can run codecoverage on local env right now. There is an issue that on GH actions, in order to have a LimeSurvey instance for testing we duplicate the plugin code inside the LS isside vendor, so we have something like ./vendor/limesurvey/limesurvey/upload/plugins/StructireImex ... while the root itself is the plugin source. This will create an autoload conflict for the codecoverage process that I have not been able to solve for gh actions. So fir now, run codecoverage on your local env:

```
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html tests/runtime/coverage
```

CI/CD (GitHub Actions)
----------------------

[](#cicd-github-actions)

The project includes GitHub Actions workflows for:

- **Unit Tests**: Run on every push/PR
- **Functional Tests**: Run with MySQL service container
- **Code Quality**: PHPStan analysis

### Environment Variables for CI

[](#environment-variables-for-ci)

The functional tests automatically detect CI environment and use appropriate database settings:

```
env:
  DB_HOST: 127.0.0.1
  DB_PORT: 3306
  DB_NAME: limesurvey_test
  DB_USER: root
  DB_PASSWORD: ''
  CI: true
```

Test Structure
--------------

[](#test-structure)

### Unit Tests (`tests/ExportQuestionsTest.php`)

[](#unit-tests-testsexportquestionstestphp)

- Uses mock data via `MockSurveyHelper`
- Tests export functionality without database
- Fast execution (~1 second)
- Validates file structure and content

### Functional Tests (`tests/ExportImportFunctionalTest.php`)

[](#functional-tests-testsexportimportfunctionaltestphp)

- Tests complete export/import cycle
- Uses real LimeSurvey database
- Validates data persistence and integrity
- Tests warning system and validation

### Test Database (`tests/DatabaseTestCase.php`)

[](#test-database-testsdatabasetestcasephp)

- Base class for database-driven tests
- Automatic cleanup between tests
- Survey import/export utilities
- Database connection management

Writing Tests
-------------

[](#writing-tests)

### Adding Unit Tests

[](#adding-unit-tests)

Use `MockSurveyHelper` for consistent mock data:

```
use tonisormisson\ls\structureimex\Tests\MockSurveyHelper;

class MyNewTest extends TestCase
{
    public function testSomething()
    {
        $mockData = MockSurveyHelper::createMockSurveyData();
        // Test your functionality...
    }
}
```

### Adding Functional Tests

[](#adding-functional-tests)

Extend `DatabaseTestCase` for database tests:

```
use tonisormisson\ls\structureimex\Tests\DatabaseTestCase;

class MyFunctionalTest extends DatabaseTestCase
{
    public function testDatabaseFunction()
    {
        $surveyId = $this->createTestSurveyWithQuestions();
        // Test with real database...
    }
}
```

Debugging Tests
---------------

[](#debugging-tests)

### Failed Database Connection

[](#failed-database-connection)

If functional tests fail with database errors:

1. Check database is running: `mysql -u root -p`
2. Verify connection settings in `.env`
3. Run setup script: `composer test-setup`
4. Check LimeSurvey schema exists

### Test Isolation Issues

[](#test-isolation-issues)

Each test cleans up after itself, but if you see data pollution:

1. Check `tearDown()` methods are called
2. Verify `$this->createdSurveyIds` is populated
3. Manual cleanup: `DROP DATABASE limesurvey_test; CREATE DATABASE limesurvey_test;`

Manual Testing
--------------

[](#manual-testing)

For manual verification of export/import functionality:

1. Create test survey with various question types
2. Add question attributes (some default, some custom)
3. Export via plugin interface
4. Import to new survey
5. Verify data integrity and attribute filtering

Contributing
------------

[](#contributing)

When contributing:

1. Write tests for new functionality
2. Ensure all tests pass: `composer test`
3. Run static analysis: `composer phpstan`
4. Follow existing code style
5. Update documentation as needed

The test suite helps maintain code quality and prevents regressions, ensuring the plugin works reliably across different LimeSurvey versions.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance97

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 98.5% 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 ~92 days

Recently: every ~34 days

Total

30

Last Release

16d ago

Major Versions

0.8.0 → 1.0.02022-07-25

1.3.x-dev → 2.0.12025-09-29

PHP version history (5 changes)0.8.0PHP &gt;=7.3.0

1.1.0PHP &gt;=8.0.4

2.0.1PHP &gt;=8.0.4 &lt;8.4

2.1.0PHP &gt;=8.3.0 &lt;8.4

2.1.13PHP &gt;=8.3.0 &lt;8.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6357451?v=4)[Tõnis Ormisson](/maintainers/TonisOrmisson)[@TonisOrmisson](https://github.com/TonisOrmisson)

---

Top Contributors

[![TonisOrmisson](https://avatars.githubusercontent.com/u/6357451?v=4)](https://github.com/TonisOrmisson "TonisOrmisson (259 commits)")[![buildingsurveysdevgit](https://avatars.githubusercontent.com/u/101662541?v=4)](https://github.com/buildingsurveysdevgit "buildingsurveysdevgit (2 commits)")[![lapiudevgit](https://avatars.githubusercontent.com/u/114943459?v=4)](https://github.com/lapiudevgit "lapiudevgit (1 commits)")[![sseven83](https://avatars.githubusercontent.com/u/29766241?v=4)](https://github.com/sseven83 "sseven83 (1 commits)")

---

Tags

limesurvey

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tonisormisson-limesurvey-relevance-imex/health.svg)

```
[![Health](https://phpackages.com/badges/tonisormisson-limesurvey-relevance-imex/health.svg)](https://phpackages.com/packages/tonisormisson-limesurvey-relevance-imex)
```

###  Alternatives

[phing/phing

PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.

1.2k21.7M876](/packages/phing-phing)[laravel-enso/tables

Data Table library with server-side processing and a VueJS component

63153.4k49](/packages/laravel-enso-tables)[glhd/conveyor-belt

14797.0k](/packages/glhd-conveyor-belt)[instride/data-definitions

Data Definitions allows you to define your DataObject Imports and Exports using a nice GUI and re-run the definitions as often you like.

8117.7k](/packages/instride-data-definitions)[laravel-enso/data-import

Excel Importer dependency for Laravel Enso

2042.6k3](/packages/laravel-enso-data-import)

PHPackages © 2026

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