josantonius / notice
此包已被废弃,不再维护。未建议替代包。
用于处理错误和通知的 PHP 库。
1.1.3
2017-09-14 02:44 UTC
Requires
- php: ^5.6 || ^7.0
This package is auto-updated.
Last update: 2020-01-24 16:27:33 UTC
README
用于处理错误和通知的 PHP 库。
安装
安装此扩展的首选方式是通过 composer。
要安装 PHP 通知库,只需
$ composer require Josantonius/Notice
前面的命令只会安装必要的文件,如果您想下载整个源代码(包括测试、供应商文件夹、未使用的异常、文档...),您可以使用
$ composer require Josantonius/Notice --prefer-source
或者您也可以使用 Git 克隆完整的仓库
$ git clone https://github.com/Josantonius/PHP-Notice.git
要求
此库支持 PHP 版本 5.6 或更高版本,并与 HHVM 版本 3.0 或更高版本兼容。
快速入门与示例
要使用此类,只需
require __DIR__ . '/vendor/autoload.php'; use Josantonius\Notice\Notice;
可用方法
此库中可用的方法
Notice::get(); Notice::getAll();
用法
此库的使用示例
<?php require __DIR__ . '/vendor/autoload.php'; use Josantonius\Notice\Notice; echo "<br>[600] · " . Notice::get(600); echo "<br>[600] · " . Notice::get(600, 'es'); /* [600] · This is a test for the error with code 600 in english. [600] · This is a test for the error with code 600 in spanish. */ echo "<br>[800] · " . Notice::get(800); /* [800] · Undefined */ echo '<pre>'; var_dump(Notice::getAll()); echo '</pre>'; /* array(2) { [600]=> string(54) "This is a test for the error with code 600 in english." [601]=> string(54) "This is a test for the error with code 601 in english." } */ echo '<pre>'; var_dump(Notice::getAll('es')); echo '</pre>'; /* array(2) { [600]=> string(58) "Esto es un test para el error con código 600 en español." [601]=> string(58) "Esto es un test para el error con código 601 en español." } */
测试
要使用 测试 类,只需
<?php $loader = require __DIR__ . '/vendor/autoload.php'; $loader->addPsr4('Josantonius\\Notice\\Tests\\', __DIR__ . '/vendor/josantonius/notice/tests'); use Josantonius\Notice\Tests\NoticeTest;
此库中可用的测试方法
NoticeTest::testLoad(); NoticeTest::testLoadES(); NoticeTest::testGetEN(); NoticeTest::testGetES(); NoticeTest::testGetUndefinedEN(); NoticeTest::testGetUndefinedES(); NoticeTest::testGetAllEN(); NoticeTest::testGetAllES();
贡献
- 检查开放的问题或创建一个新问题以开始关于错误或功能的讨论。
- 在 GitHub 上分支仓库以开始进行更改。
- 为新的功能或暴露错误的测试编写一个或多个测试。
- 进行代码更改以实现功能或修复错误。
- 发送拉取请求以合并和发布您的更改。
此功能旨在用于大型且长期存在的对象。
仓库
此仓库中的所有文件都是通过 Reposgit Creator 自动创建和上传的。
许可协议
本项目采用 MIT 许可协议。有关更多信息,请参阅 LICENSE 文件。
版权
2017 Josantonius, josantonius.com
如果您觉得它很有用,请告诉我 😉