{"id":17061939,"url":"https://github.com/phlak/chronometer","last_synced_at":"2025-04-12T18:12:40.018Z","repository":{"id":45198369,"uuid":"150507758","full_name":"PHLAK/Chronometer","owner":"PHLAK","description":"Measure the passing of time.","archived":false,"fork":false,"pushed_at":"2025-01-01T11:01:32.000Z","size":104,"stargazers_count":7,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T18:12:34.218Z","etag":null,"topics":["library","php","php-library","timer"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PHLAK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"PHLAK","patreon":"PHLAK","custom":"https://paypal.me/ChrisKankiewicz"}},"created_at":"2018-09-27T00:51:03.000Z","updated_at":"2024-12-11T02:43:20.000Z","dependencies_parsed_at":"2024-12-11T03:22:33.659Z","dependency_job_id":"4e6701d2-bf5f-47ec-b30a-ae3392117df2","html_url":"https://github.com/PHLAK/Chronometer","commit_stats":{"total_commits":45,"total_committers":4,"mean_commits":11.25,"dds":0.06666666666666665,"last_synced_commit":"8fccc169aff028c79b8caa1423788cfe9d403070"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHLAK%2FChronometer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHLAK%2FChronometer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHLAK%2FChronometer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHLAK%2FChronometer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHLAK","download_url":"https://codeload.github.com/PHLAK/Chronometer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610341,"owners_count":21132919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","php","php-library","timer"],"created_at":"2024-10-14T10:48:45.162Z","updated_at":"2025-04-12T18:12:39.995Z","avatar_url":"https://github.com/PHLAK.png","language":"PHP","funding_links":["https://github.com/sponsors/PHLAK","https://patreon.com/PHLAK","https://paypal.me/ChrisKankiewicz"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"chronometer.png\" alt=\"Chronometer\" width=\"500\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/PHLAK/Chronometer/discussions\"\u003e\u003cimg src=\"https://img.shields.io/badge/Join_the-Community-7b16ff.svg?style=for-the-badge\" alt=\"Join our Community\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/users/PHLAK/sponsorship\"\u003e\u003cimg src=\"https://img.shields.io/badge/Become_a-Sponsor-cc4195.svg?style=for-the-badge\" alt=\"Become a Sponsor\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://paypal.me/ChrisKankiewicz\"\u003e\u003cimg src=\"https://img.shields.io/badge/Make_a-Donation-006bb6.svg?style=for-the-badge\" alt=\"One-time Donation\"\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://packagist.org/packages/PHLAK/Chronometer\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/PHLAK/Chronometer.svg?style=flat-square\" title=\"Latest Stable Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/PHLAK/Chronometer\"\u003e\u003cimg src=\"https://img.shields.io/packagist/dt/PHLAK/Chronometer.svg?style=flat-square\" title=\"Total Downloads\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/PHLAK/Chronometer\"\u003e\u003cimg src=\"https://img.shields.io/packagist/l/PHLAK/Chronometer.svg?style=flat-square\" title=\"License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/PHLAK/Chronometer/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/PHLAK/Chronometer/test-suite.yaml?style=flat-square\u0026label=tests\" alt=\"Tests Status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    Measure the passing of time --\n    by, \u003ca href=\"https://www.ChrisKankiewicz.com\"\u003eChris Kankiewicz\u003c/a\u003e (\u003ca href=\"https://bsky.app/profile/phlak.dev\"\u003e@phlak.dev\u003c/a\u003e),\n    logo by \u003ca href=\"https://www.twitter.com/Caneco\"\u003eCaneco\u003c/a\u003e\n\u003c/p\u003e\n\nIntroduction\n------------\n\nChronometer is a library for statically measuring the passing of time in your code.\nIt's intended to be used for benchmarking code execution time.\n\nRequirements\n------------\n\n  - [PHP](https://php.net) \u003e= 8.2\n\nInstall with Composer\n---------------------\n\n```bash\ncomposer require phlak/chronometer\n```\n\nUsing Chronometer\n-----------------\n\nFirst, import Chronometer.\n\n```php\nuse PHLAK\\Chronometer\\Timer;\n```\n\nThen start your timer, run your code, stop the timer and get the elapsed time.\n\n```php\nTimer::start();\n// do something you want to measure...\nTimer::stop();\n\nreturn Timer::elapsed();\n```\n\nAfter running your timer you will need to reset it before using it again.\n\n```php\nTimer::reset();\n```\n\nYou may optionally reset the timer when you start it with the `$reset` parameter.\n\n```php\nTimer::start(reset: true);\n```\n\nUsage\n-----\n\n### start\n\u003e Start the timer.\n\n```php\nChronometer\\Timer::start( [ $reset = false ] ) : float\n```\n\n#### Example\n\n```php\nChronometer\\Timer::start(); // Returns something like 1538016612.1692\n```\n\n---\n\n### stop\n\u003e Stop the timer.\n\n```php\nChronometer\\Timer::stop( void ) : float\n```\n\n#### Example\n\n```php\nChronometer\\Timer::stop(); // Returns something like 1538016632.7721\n```\n\n---\n\n### addLap\n\u003e Add a new lap.\n\n```php\nChronometer\\Timer::addLap( [ string $description = null ] ) : Chronometer\\Lap\n```\n\n#### Example\n\n```php\n$lap = Chronometer\\Timer::addLap('The first lap.');\n\n$lap-\u003etime // Returns something like 1538016625.492\n$lap-\u003eduration // Returns something like 7.999922990799\n$lap-\u003edescription // Returns 'The first lap.'\n```\n\n---\n\n### started\n\u003e Return the timer start time.\n\n```php\nChronometer\\Timer::started( void ) : float\n```\n\n#### Example\n\n```php\nChronometer\\Timer::started(); // Returns something like 1538016612.1692\n```\n\n---\n\n### stopped\n\u003e Return the timer stop time.\n\n```php\nChronometer\\Timer::stopped( void ) : float\n```\n\n#### Example\n\n```php\nChronometer\\Timer::stopped(); // Returns something like 1538016632.7721\n```\n\n---\n\n### elapsed\n\u003e Return the total time elapsed in seconds.\n\n```php\nChronometer\\Timer::elapsed( void ) : float\n```\n\n#### Example\n\n```php\nChronometer\\Timer::elapsed(); // Returns something like 20.602929115295\n```\n\n---\n\n### lastLap\n\u003e Return the last lap.\n\n```php\nChronometer\\Timer::lastLap( void ) : Chronometer\\Lap\n```\n\n#### Example\n\n```php\n$lap = Chronometer\\Timer::lastLap();\n\n$lap-\u003etime // Returns something like 1538016632.7721\n$lap-\u003eduration // Returns something like 7.2800490856171\n```\n\n---\n\n### laps\n\u003e Return an array of all laps.\n\n```php\nChronometer\\Timer::laps( void ) : array\n```\n\n#### Example\n\n```php\nChronometer\\Timer::laps(); // Returns an array of Lap objects\n```\n\n---\n\n### reset\n\u003e Reset the timer state.\n\n```php\nChronometer\\Timer::reset( void ) : void\n```\n\n#### Example\n\n```php\nChronometer\\Timer::reset();\n```\n\n---\n\nChangelog\n---------\n\nA list of changes can be found on the [GitHub Releases](https://github.com/PHLAK/Chronometer/releases) page.\n\nTroubleshooting\n---------------\n\nFor general help and support join our [GitHub Discussion](https://github.com/PHLAK/Chronometer/discussions) or reach out on [Bluesky](https://bsky.app/profile/phlak.dev).\n\nPlease report bugs to the [GitHub Issue Tracker](https://github.com/PHLAK/Chronometer/issues).\n\nCopyright\n---------\n\nThis project is licensed under the [MIT License](https://github.com/PHLAK/Chronometer/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphlak%2Fchronometer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphlak%2Fchronometer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphlak%2Fchronometer/lists"}