jwread/lib-allure 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jwread/lib-allure

最新稳定版本:8.3.0

Composer 安装命令:

composer require 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/

README 文档

README

A set of utilities, helpers and shims. It aims to be pretty modular and lightweight.

packagist.org Package for compose | API Documentation

Maturity Badge Release Pipeline

Compatibiility

Up to PHP 5.5.x Up tp PHP 7.3 PHP 8
libAllure 1.x supported not supported not supported
libAllure 2.x not supported supported not supported
libAllure 8.x not supported not supported supported

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');

统计信息

  • 总下载量: 1.04k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-only
  • 更新时间: 2015-10-30