Utilities

Debug

Cleans-up and formats debugging information in a way that makes it easier to read when being logged.

use Skyzyx\Shared\Logger;
use Skyzyx\Shared\Utility\Debug;

Logger::get('my_app')->debug(
    'This is my debugging message.'
    Debug::formatBacktrace(debug_backtrace())
);

File

Helps with ancillary tasks related to the file system. For reading/writing-oriented tasks, check out Symfony Filesystem or Flysystem.

use Skyzyx\Shared\Utility\File;

echo File::formatSize(memory_get_peak_usage()) . PHP_EOL;

Grammar

Helps with tasks related to the file system.

use Skyzyx\Shared\Utility\Grammar;

$ponies = 2;

if ($ponies > 0) {
    echo sprintf('I want %s!',
        Grammar::pluralize($ponies, 'a pony', 'lots of ponies')
    );
} else {
    echo "I don't want any ponies.";
}

Time

Helps with time-related tasks.

use Skyzyx\Shared\Utility\Time;

$start = microtime(true);

while ($i < 10000000000000000000000000000000000000000000000000000) {
    do_complex_task();
}

$duration = microtime(true) - $start;

echo sprintf('That task took %s.', Time::hhmmss($duration));