Download the PHP package othyn/php-time-remaining without Composer
On this page you can find all versions of the php package othyn/php-time-remaining. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download othyn/php-time-remaining
More information about othyn/php-time-remaining
Files in othyn/php-time-remaining
Package php-time-remaining
Short Description A tiny library that helps with simple progress output, focusing on time remaining.
License MIT
Informations about the package php-time-remaining
PHP Time Remaining
A Composer package for PHP that adds a seriously simple progress tracker, with a focus on estimating completion time.
The package is available on Packagist as othyn/php-time-remaining.
Installation
Hop into your project that you wish to install it in and run the following Composer command to grab the latest version:
Usage
For more comprehensive usage examples, you can view the test suite. However I'll show some basic usage examples below.
Initialisation
To start using the TimeRemaining
package, initialise it with the total number of items required:
You can also later update the total amount of items if you cannot define it at the point of initialisation:
Formatting the Output
To get a formatted string showing the progress and remaining time:
You can also customise the format:
Getting Elapsed Time
To get the elapsed time since the initialisation:
Getting Progress
To get the progress based on the current item:
Getting Estimated Total Time
To get the estimated total time for the process:
Getting Remaining Time
To get the remaining time for the process:
Development
Most development processes are wrapped up in an easy to use Docker container.
Enforcing Style
The projects .php-cs-fixer.dist.php
config contains the rules that this repo conforms to and will run against the ./src
and ./tests
directory.
For remote style enforcement there is a GitHub Action configured to automatically run phpcsfixer
.
For local style enforcement there is a composer script composer style
configured to run phpcsfixer
.
Testing
For remote testing there is a GitHub Action setup to automatically run the test suite on the main
branch or and PR branches.
For local testing there is a Docker container that is pre-built that contains an Alpine CLI release of PHP + PHPUnit + xdebug. This is setup to test the project and can be setup via the following:
This should trigger Docker Compose to build the image. You can then up the container via the following:
There are tests for all code written, in which can be run via:
In those tests, there are Feature tests for a production ready implementation of the package. There are no Unit tests at present.
You can also easily open a shell in the testing container by using the command: