richtoms / spot
简单的PHP对象追踪器
v0.1
2021-02-22 04:56 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-22 12:30:03 UTC
README
SPOT是一个小型库,用于跟踪PHP函数和类方法的执行时间和内存使用情况。
安装
您可以通过composer安装此包
composer require richtoms/spot
使用方法
为一个类使用类追踪器。
use RichToms\Spot\ClassTracker; $tracker = new ClassTracker(new Foo('Bar')); $tracker->methodOnFoo() ->anotherMethod() ->andAnother(); // Result of fluently calling methods on the `Foo` class. $result = $tracker->getResult(); // List of events tracked while calling many methods on the `Foo` class. $events = $tracker->getEvents();
使用闭包追踪器。
$tracker = new ClosureTracker(function ($array) { return array_map(function ($item) { return $x += 1; }, $array); }, [[1, 2, 3, 4]]); // Result of the Closure. $result = $tracker->getResult(); // List of events tracked when calling the Closure. $result->getEvents();
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志。
贡献
有关详细信息,请参阅贡献指南。
安全性
如果您发现任何与安全性相关的问题,请通过电子邮件richard.toms@hotmail.com联系,而不是使用问题跟踪器。
鸣谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。