PHP code example of jwread / lib-allure

1. Go to this page and download the library: Download jwread/lib-allure library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jwread / lib-allure example snippets




libAllure\Database;
use \libAllure\ErrorHandler;
use \libAllure\Form;

// etc


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

use \libAllure\ErrorHandler;

$handler = new ErrorHandler();
$handler->beGreedy();

throw new Exception('This is a test');

use \libAllure\ElementInput;
use \libAllure\Template;

$tpl = new Template('myTemplates'); // 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);

use \libAllure\Template;

$tpl = new Template('myTemplates');
$tpl->display('myTemplate.tpl');