josantonius/loadtime
最新稳定版本:1.1.8
Composer 安装命令:
composer require josantonius/loadtime
包简介
Calculate load time of pages or scripts.
README 文档
README
Calculate load time of pages or scripts.
Requirements
This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.
Installation
The preferred way to install this extension is through Composer.
To install PHP LoadTime library, simply:
composer require Josantonius/LoadTime
The previous command will only install the necessary files, if you prefer to download the entire source code you can use:
composer require Josantonius/LoadTime --prefer-source
You can also clone the complete repository with Git:
$ git clone https://github.com/Josantonius/php-Load-time.git
Or install it manually:
wget https://raw.githubusercontent.com/Josantonius/php-Load-time/master/src/LoadTime.php
Available Methods
Available methods in this library:
- Set initial time
LoadTime::start();
# Return (float) → microtime
- Set end time
LoadTime::end();
# Return (float) → seconds
- Check if the timer has been started
LoadTime::isActive();
# Return (boolean)
Quick Start
To use this library with Composer:
require __DIR__ . '/vendor/autoload.php'; use Josantonius\LoadTime\LoadTime;
Or If you installed it manually, use it:
require_once __DIR__ . '/LoadTime.php'; use Josantonius\LoadTime\LoadTime;
Usage
Example of use for this library:
<?php require __DIR__ . '/vendor/autoload.php'; use Josantonius\LoadTime\LoadTime; LoadTime::start(); for ($i=0; $i < 100000; $i++) { // print_r($i . ' '); } print_r('Script executed in: ' . LoadTime::end() . ' seconds.'); /* Script executed in: 0.0012 seconds. */
Tests
To run tests you just need composer and to execute the following:
git clone https://github.com/Josantonius/php-Load-time.git
cd php-Load-time
composer install
Run unit tests with PHPUnit:
composer phpunit
Run PSR2 code standard tests with PHPCS:
composer phpcs
Run PHP Mess Detector tests to detect inconsistencies in code style:
composer phpmd
Run all previous tests:
composer tests
Sponsor
If this project helps you to reduce your development time, you can sponsor me to support my open source work 😊
License
This repository is licensed under the MIT License.
Copyright © 2017-2022, Josantonius
josantonius/loadtime 适用场景与选型建议
josantonius/loadtime 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 489 次下载、GitHub Stars 达 6, 最近一次更新时间为 2017 年 01 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「hhvm」 「Page load time」 「Script load time」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 josantonius/loadtime 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 josantonius/loadtime 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 josantonius/loadtime 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table.
Testing object factory for PHP
Testing object factory for PHP
Plug-ins for DataTables
PSR-15 like HTTP Server Request Handler Interface
This package helps you use bitwise enums in PHP and Laravel.
统计信息
- 总下载量: 489
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 20
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-16