axy/evil
Composer 安装命令:
composer require axy/evil
包简介
Necessary evil
README 文档
README
- The library does not require any dependencies.
- Tested on PHP 5.4+, PHP 7, HHVM (on Linux), PHP 5.5 (on Windows).
- Install:
composer require axy/evil. - License: MIT.
Documentation
Some language features are not recommended for frequent use.
eval(), exit, global variables, direct access to super-global arrays.
But sometimes it is necessary. If you use static code analyzer, it will swear. We'll have to suppress messages.
/** @SuppressWarnings(PHPMD.Superglobals) */ $x = $_POST['x'];
This library encapsulates the "evil" features. You simply call methods and disclaims any sin.
API
Classes are in the namespace axy\evil.
Evil
It contains calls of "evil" functions.
So how exit, echo and etc is keywords methods have other names.
eval - execCode
Evil::execCode('2 + 2'); // 4
exit - stop
Evil::stop(); // exit Evil::stop(5); // exit with code 5
breakpoint()
breakpoint(mixed $message [, bool $line [, bool $file [, int $status]);
Shows debugging information and terminates the current script (with the status from $status).
If $message is not a scalar then used print_r().
If specified $line: shows the line number of the breakpoint.
For $file shows the file name.
Evil::breakpoint('point'); // point Evil::breakpoint('point', true); // 15: point Evil::breakpoint('point', true, true); // /path/to/script.php:15: point
In CLI mode the $message completes new line.
In HTTP mode the $message enclosed in <pre>.
echo - out
Evil::out($message);
Sends a string to the stdout stream.
Superglobals
Static methods of axy\evil\Superglobals:
getSERVER()getGET()getPOST()getREQUEST()getCOOKIE()getFILES()getSESSION()getENV()
Return the corresponding superglobals arrays. The data is returned by reference.
$session = Superglobals::getSESSION(); $session['var'] = 'value'; // no effect $session = &Supeglobals::getSESSION(); $session['var'] = 'value'; // success
Globals
Static methods:
getGLOBALS(): returns$_GLOBALSby referenceget($name [, $default]): returns the value of a global variable (or$defaultif the variable not found)set($name, $value): setremove($name): unset
axy/evil 适用场景与选型建议
axy/evil 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 435 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 axy/evil 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 axy/evil 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 435
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-10