PHPackages                             burntcaramel/stir - 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. burntcaramel/stir

ActiveLibrary

burntcaramel/stir
=================

Record time taken in your website.

1.0(11y ago)328MITPHPPHP &gt;=5.3.0

Since May 23Pushed 11y ago1 watchersCompare

[ Source](https://github.com/BurntCaramel/stir)[ Packagist](https://packagist.org/packages/burntcaramel/stir)[ RSS](/packages/burntcaramel-stir/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (2)Used By (0)

stir
====

[](#stir)

Record time taken in your PHP website, and display as HTML or JSON.

Enable and disable easily
-------------------------

[](#enable-and-disable-easily)

(When stir is disabled, it falls back to safe-to-use empty functions)

```
// For example in WordPress, only enable if an administrator user is logged in.
define ('STIR_ENABLED', current_user_can('administrator'));
```

Measure times
-------------

[](#measure-times)

```
// Start measuring:
function displayPage() // example template function
{
	stir('display page');

	displayHTMLHead();
	stirring('display page', 'html head');

	displayNavigation();
	stirring('display page', 'nav');

	$articles = retrieveLatestArticles();
	$articleIndex = 0;
	foreach ($articles as $article):
		stir('display article');
		displayArticle($article);
		stirred('display article');
		$articleIndex++;
	endforeach;
	stirring('display page', 'articles');

	displayFooter();
	stirring('display page', 'footer');

	displayHTMLEnd();
	stirred('display page');
}
```

Display recorded times in HTML
------------------------------

[](#display-recorded-times-in-html)

```
// End of page.
stirDisplayRecordedTimesForHTML();
?>
