PHPackages                             rotexsoft/callable-execution-timer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. rotexsoft/callable-execution-timer

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

rotexsoft/callable-execution-timer
==================================

A simple PHP library for tracking the total amount of time a callable (e.g. function / method) takes to execute (it can also return the result of executing the callable, if desired).

3.0.1(3mo ago)17BSD-3-ClausePHPPHP &gt;=8.2.0CI passing

Since Sep 16Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/rotexsoft/callable-execution-timer)[ Packagist](https://packagist.org/packages/rotexsoft/callable-execution-timer)[ Docs](https://github.com/rotexsoft/function-execution-timer)[ RSS](/packages/rotexsoft-callable-execution-timer/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (4)Versions (10)Used By (0)

Callable Execution Timer
========================

[](#callable-execution-timer)

[![Run PHP Tests and Code Quality Tools](https://github.com/rotexsoft/callable-execution-timer/actions/workflows/php.yml/badge.svg)](https://github.com/rotexsoft/callable-execution-timer/actions/workflows/php.yml) [![Release](https://camo.githubusercontent.com/a9e8c763cf4005ece0cfd64ba37af9904ff185c93d65005e60f323654e9daee7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d65722e706e673f7374796c653d666c61742d737175617265)](https://github.com/rotexsoft/callable-execution-timer/releases/latest) [![License](https://camo.githubusercontent.com/6ca561f57f3786f6febef6bd699bf040fb55a4f7ae5d5105a0908a735e8f0408/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253442d627269676874677265656e2e706e673f7374796c653d666c61742d737175617265)](https://github.com/rotexsoft/callable-execution-timer/blob/master/LICENSE) [![Coverage Status](https://camo.githubusercontent.com/a9df77159bf1f649c36ae930695cec7c3f7ffbaa6ff0e45b453864f9b5628ef9/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d65722f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/rotexsoft/callable-execution-timer?branch=main) [![GitHub repo size](https://camo.githubusercontent.com/06d7d0049594019c929756c3af008119e94040c6248a11e3b00ef7e92150d8bf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572)](https://camo.githubusercontent.com/06d7d0049594019c929756c3af008119e94040c6248a11e3b00ef7e92150d8bf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572) [![Packagist Downloads](https://camo.githubusercontent.com/7569bc2c38ac20d851accbd12abf98b667b93e3dfcbb0f2fd2e11dfeb4a14f8f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572)](https://camo.githubusercontent.com/7569bc2c38ac20d851accbd12abf98b667b93e3dfcbb0f2fd2e11dfeb4a14f8f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572)[![GitHub top language](https://camo.githubusercontent.com/a6fc2c2f154cef57f3bd1f0763c00510aa2ce40b1a95d2a3bcc064b37acad257/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572)](https://camo.githubusercontent.com/a6fc2c2f154cef57f3bd1f0763c00510aa2ce40b1a95d2a3bcc064b37acad257/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572) [![Packagist PHP Version Support](https://camo.githubusercontent.com/57c95441768775e504e47b26f8ab099745ef26b16305199b082b17f9c6cc4bfc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572)](https://camo.githubusercontent.com/57c95441768775e504e47b26f8ab099745ef26b16305199b082b17f9c6cc4bfc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572) [![GitHub commits since latest release (by date)](https://camo.githubusercontent.com/1a85ec1ea4f51b0d8d0261b0f4ee1ba40fbcad857ceb1d0eb8f914b8dce9162f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d65722f6c6174657374)](https://camo.githubusercontent.com/1a85ec1ea4f51b0d8d0261b0f4ee1ba40fbcad857ceb1d0eb8f914b8dce9162f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d65722f6c6174657374) [![GitHub last commit](https://camo.githubusercontent.com/7bae61a712645ddef75f4f70a4033b055e82697850600bf7592e6c4a38f7e23f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572)](https://camo.githubusercontent.com/7bae61a712645ddef75f4f70a4033b055e82697850600bf7592e6c4a38f7e23f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572) [![GitHub Release Date](https://camo.githubusercontent.com/46dfa56f693a9b147bc8bff97492b06600ecde138b640abb57db42efd72dbfdb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572)](https://camo.githubusercontent.com/46dfa56f693a9b147bc8bff97492b06600ecde138b640abb57db42efd72dbfdb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572) [![Libraries.io dependency status for GitHub repo](https://camo.githubusercontent.com/4eb3cadbf209244a637c6934692e55ba13ee2ab4d1297033cc53107834f1d1cf/68747470733a2f2f696d672e736869656c64732e696f2f6c6962726172696573696f2f6769746875622f726f746578736f66742f63616c6c61626c652d657865637574696f6e2d74696d6572)](https://libraries.io/packagist/rotexsoft%2Fcallable-execution-timer)

A simple PHP library for tracking the total amount of time a [callable](https://www.php.net/manual/en/language.types.callable.php) (e.g. function / method) takes to execute (it can also return the result of executing the callable, if desired).

If you want to do some simple execution time profiling in your application, without using some full blown tool like debugbar or xdebug, then this is the package for you.

Installation
------------

[](#installation)

**Via composer:** (Requires PHP 7.4+ or PHP 8.0+).

```
composer require rotexsoft/callable-execution-timer

```

Branching
---------

[](#branching)

These are the branches in this repository:

- **main:** contains code for the latest major version of this package
- **1.x:** contains code for the **1.x** version of this package
- **2.x:** contains code for the **1.x** version of this package

Introduction
------------

[](#introduction)

A simple PHP library for tracking the total amount of time a callable (e.g. function / method) takes to execute and return result(s) (if any).

> For the rest of this documentation the term **callable** will mostly be referring to functions / methods

This library also provides information associated with each execution / invocation of the callable such as:

- the arguments passed to the callable (array)
- the total time it took to execute the callable in seconds (int / float)
- the value returned from calling the callable (mixed)
- the absolute path to the file in which the callable was called (string)
- the exact line number in the file in which the callable was called (integer)

Executing callables
-------------------

[](#executing-callables)

### Executing built-in php functions

[](#executing-built-in-php-functions)

Let's call php's built-in [strtolower](https://www.php.net/manual/en/function.strtolower.php) &amp; [strtoupper](https://www.php.net/manual/en/function.strtoupper.php) functions:

```
