jwread / lib-allure
A set of utilities, helpers and shims. It aims to be pretty modular and lightweight. API Docs are here; http://jamesread.github.io/libAllure/
Requires
- iignatov/lightopenid: ^1.0
- smarty/smarty: ^4.3
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/php-code-coverage: ^9
- phpunit/phpunit: ^9.6
- squizlabs/php_codesniffer: ^3.13
This package is auto-updated.
Last update: 2026-07-13 19:57:36 UTC
README
A set of utilities, helpers and shims. It aims to be pretty modular and lightweight.
packagist.org Package for compose | API Documentation
Compatibility
| Latest | PHP 8.0 | PHP 8.1 | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 | |
|---|---|---|---|---|---|---|---|
| libAllure 8.5.x | 8.5.0 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| libAllure 8.4.x | 8.4.0 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
| libAllure 8.3.x | 8.3.0 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
| libAllure 8.2.x | 8.2.2 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
| libAllure 8.1.x | 8.1.30 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
| libAllure 8.0.x | 8.0.4 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
Unsupported and untested versions
| Approximate PHP support | |
|---|---|
| libAllure 2.x | Approximately PHP 7.3 |
| libAllure 1.x | Approximately PHP 5.5 |
Versions 1.x and 2.x are deprecated and not supported. Compatibility testing covers 8.x only.
Run the full matrix locally with make compat (requires Docker for PHP versions other than your host). The matrix is defined in compat/matrix.json and runs on every push and pull request via .github/workflows/compat.yml.
You can add libAllure to your project quickly, if you're using composer.
composer require jwread/lib-allure
Then to use it, like in test.php;
<?php require_once 'vendor/autoload.php'; use \libAllure\Database; use \libAllure\ErrorHandler; use \libAllure\Form; // etc ?>
Adding with a standard PHP include
Copy the contents of /src/main/php/ to somewhere on your include path, like
/usr/share/php/ on most Linux distributions. So that you have /usr/share/php/libAllure/ErrorHander.php, /usr/share/php/libAllure/Database.php, etc.
API Examples & Quick Reference
Full API Documentation: http://jamesread.github.io/libAllure/
Database
Wrapper around PDO.
use \libAllure\Database; $database = new Database('mysql:dbname=testdb;host=127.0.0.1', 'username', 'password'); $sql = 'SELECT p.id, p.title FROM products p'; $results = $database->prepare($sql)->execute(); var_dump($results->fetchAll());
ErrorHandler
Custom error handler that complains at the slightest thing, makes debugging nice and easy.
use \libAllure\ErrorHandler; $handler = new ErrorHandler(); $handler->beGreedy(); throw new Exception('This is a test');
Form
Custom form handling code.
use \libAllure\ElementInput; use \libAllure\Template; $tpl = new Template('myTemplates'); // requires form.tpl and formElements.tpl in your templates folder class MyForm extends \libAllure\Form { public function __construct() { $this->addElement(new ElementInput('forename', 'Forename', 'My Default Name'); $this->addDefaultButtons(): } public function process() { // do something } } $f = new MyForm(); if ($f->validate()) { $f->process(); } $tpl->displayForm($f);
Template
Just a nice wrapper around Smarty2/3, that adds in a few compatibility functions to easily switch between the versions.
use \libAllure\Template; $tpl = new Template('myTemplates'); $tpl->display('myTemplate.tpl');