aibuy/utils

This package is abandoned and no longer maintained. No replacement package was suggested.

A few common helpers for debugging. PID file lock out class and time measurement class.

Maintainers

Details

github.com/aibuy-inc/utils

This package has no released version yet, and little information is available.


README

Build Status PHP from Packagist Packagist Version Packagist

Helpers

See the helper readme

Classes

MeasureTime

Use this class to measure response time when debugging or to include time in your API responses.

Usage

$time = new MeasureTime();

/* Do some stuff */

echo $time->mark(); /* Total time since $time was instantiated */

/* Do more stuff */

echo $time->markInterval(); /* Time since last mark()  */

/* Do even more stuff */

echo $time->mark(); /* Total time since $time was instantiated */

ProcessId

Create a PID file and lock out running the script multiple times.

Installation

composer require aibuy/utils

Usage

Add use AiBuy\Utils\ProcessId; to your file.

Within your code add the following to the start of your script.

$pid = new ProcessId('myScriptName');
$pid->setLock();

or

$pid = new ProcessId();
$pid->setScriptName('myScriptName');
$pid->setLock();

If no name is given then script is used.

You can check if the process is running (boolean returned).

$pid->isRunning()

Add the following to the end of your script.

$pid->releaseLock();

Testing

Run the tests with vendor/bin/phpunit --coverage-html build/coverage-report

Contributing

Please try to use GitFlow. More information here. And here.

  • Fork it!
  • Create your feature branch: git checkout -b feature/my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin feature/my-new-feature
  • Submit a pull request!

License

GPL v2