e-ghl/exception
最新稳定版本:v1.0.0
Composer 安装命令:
composer require e-ghl/exception
包简介
Exception Handler for eGHL PHP packages
README 文档
README
This exception hanler class is extend from core PHP Exception and can be used in almost simmilar manner. This exception handler is created specifically for handling the exceptions in PHP libraries built for eGHL.
Example Usage
// Require Composer autoloader
require_once '../vendor/autoload.php';
// Invoke namespace
use eGHL\Exception;
class Foo
{
private $var;
function __construct($avalue = NULL) {
$this->var = $avalue;
if(is_null($this->var)){
throw new Exception('Variable must have some value');
}
}
public function get(){
return $this->var;
}
}
// Example 1
try {
$A = new Foo();
}
catch (Exception $e) {
echo "Caught Exception: $e<br/>";
echo "<pre>Trace: ".print_r($e->getTrace(),1)."</pre>";
}
// Example 2
try {
$B = new Foo('B');
}
catch (Exception $e) {
echo "Caught Exception: $e<br/>";
echo "<pre>Trace: ".print_r($e->getTrace(),1)."</pre>";
}
echo "The value of B is: {$B->get()}<br/>";
统计信息
- 总下载量: 1.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2019-01-23