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: ^1.10
- phpunit/php-code-coverage: ^9
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.7
- dev-master
- 8.1.30
- 8.1.29
- 8.1.28
- 8.1.27
- 8.1.26
- 8.1.25
- 8.1.24
- 8.1.23
- 8.1.22
- 8.1.21
- 8.1.20
- 8.1.19
- 8.1.18
- 8.1.17
- 8.1.16
- 8.1.15
- 8.1.14
- 8.1.13
- 8.1.12
- 8.1.11
- 8.1.10
- 8.1.9
- 8.1.8
- 8.1.7
- 8.1.6
- 8.1.5
- 8.1.4
- 8.1.3
- 8.1.2
- 8.1.1
- 8.1.0
- 8.0.4
- 8.0.3
- 8.0.2
- 8.0.1
- 8.0.0
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-jamesread-add-badges
- dev-v1-php55
This package is auto-updated.
Last update: 2025-01-07 00:41:33 UTC
README
A set of utilities, helpers and shims. It aims to be pretty modular and lightweight.
This library is published by packagist.org for easy use with composer; https://packagist.org/packages/jwread/lib-allure
API Documentation: http://jamesread.github.io/libAllure/
Compatibiility
Adding with composer
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');