[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8237":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":15,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":16,"starSnapshotCount":16,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},8237,"php-timer","sebastianbergmann\u002Fphp-timer","sebastianbergmann","Utility class for timing","",null,"PHP",7743,63,19,1,0,3,36.42,"BSD 3-Clause \"New\" or \"Revised\" License",false,"main",[],"2026-06-12 02:01:51","# phpunit\u002Fphp-timer\n\n[![Latest Stable Version](https:\u002F\u002Fposer.pugx.org\u002Fphpunit\u002Fphp-timer\u002Fv)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fphpunit\u002Fphp-timer)\n[![CI Status](https:\u002F\u002Fgithub.com\u002Fsebastianbergmann\u002Fphp-timer\u002Fworkflows\u002FCI\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fsebastianbergmann\u002Fphp-timer\u002Factions)\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fsebastianbergmann\u002Fphp-timer\u002Fbranch\u002Fmain\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fsebastianbergmann\u002Fphp-timer)\n\nUtility class for timing things, factored out of PHPUnit into a stand-alone component.\n\n## Installation\n\nYou can add this library as a local, per-project dependency to your project using [Composer](https:\u002F\u002Fgetcomposer.org\u002F):\n\n```\ncomposer require phpunit\u002Fphp-timer\n```\n\nIf you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:\n\n```\ncomposer require --dev phpunit\u002Fphp-timer\n```\n\n## Usage\n\n### Basic Timing\n\n```php\nrequire __DIR__ . '\u002Fvendor\u002Fautoload.php';\n\nuse SebastianBergmann\\Timer\\Timer;\n\n$timer = new Timer;\n\n$timer->start();\n\nforeach (\\range(0, 100000) as $i) {\n    \u002F\u002F ...\n}\n\n$duration = $timer->stop();\n\nvar_dump(get_class($duration));\nvar_dump($duration->asString());\nvar_dump($duration->asSeconds());\nvar_dump($duration->asMilliseconds());\nvar_dump($duration->asMicroseconds());\nvar_dump($duration->asNanoseconds());\n```\n\nThe code above yields the output below:\n\n```\nstring(32) \"SebastianBergmann\\Timer\\Duration\"\nstring(9) \"00:00.002\"\nfloat(0.002851062)\nfloat(2.851062)\nfloat(2851.062)\nint(2851062)\n```\n\n### Resource Consumption\n\n#### Explicit duration\n\n```php\nrequire __DIR__ . '\u002Fvendor\u002Fautoload.php';\n\nuse SebastianBergmann\\Timer\\ResourceUsageFormatter;\nuse SebastianBergmann\\Timer\\Timer;\n\n$timer = new Timer;\n$timer->start();\n\nforeach (\\range(0, 100000) as $i) {\n    \u002F\u002F ...\n}\n\nprint (new ResourceUsageFormatter)->resourceUsage($timer->stop());\n```\n\nThe code above yields the output below:\n\n```\nTime: 00:00.002, Memory: 6.00 MB\n```\n\n#### Duration since PHP Startup (using unreliable `$_SERVER['REQUEST_TIME_FLOAT']`)\n\n```php\nrequire __DIR__ . '\u002Fvendor\u002Fautoload.php';\n\nuse SebastianBergmann\\Timer\\ResourceUsageFormatter;\n\nforeach (\\range(0, 100000) as $i) {\n    \u002F\u002F ...\n}\n\nprint (new ResourceUsageFormatter)->resourceUsageSinceStartOfRequest();\n```\n\nThe code above yields the output below:\n\n```\nTime: 00:00.002, Memory: 6.00 MB\n```\n","php-timer 是一个用于时间测量的 PHP 工具类。它提供了基本的时间记录功能，包括启动、停止计时器以及获取经过的时间，并支持多种时间单位（秒、毫秒、微秒、纳秒）的转换。此外，还能够报告自 PHP 启动以来或特定代码段执行期间的资源消耗情况，如内存使用量。此项目从 PHPUnit 中独立出来，作为单独组件提供，适用于需要精确度量代码执行时间及资源占用的各种场景，尤其是在进行性能测试和优化时非常有用。",2,"2026-06-11 03:16:54","top_language"]