1. Go to this page and download the library: Download mtownsend/progress library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Mtownsend\Progress\Progress;
use Mtownsend\Progress\Step;
$step1 = (new Step('https://marktownsend.rocks', 'Portfolio Site'))->url();
$step2 = (new Step(4, 'Bronze Level Developer'))->integer()->between(1, 5);
$progress = (new Progress($step1, $step2));
$progress->get();
// or an array of Steps
$steps = [
(new Step('https://marktownsend.rocks', 'Web Site'))->url(),
(new Step('Laravel Developer', 'Profession'))->notEmpty()->contains('Laravel'),
(new Step(true, 'Premier Member'))->boolean()->true()
];
$progress = new Progress($steps);
$progress->get();
$step = step('https://marktownsend.rocks', 'Web Site')->url();
$progress = progress($step)->get();
// or an array of Steps
$steps = [
step('https://marktownsend.rocks', 'Web Site')->url(),
step('Laravel Developer', 'Profession')->contains('Laravel'),
step(true, 'Premier Member')->boolean()->true()
];
$progress = progress($steps)->get();
new Progress(mixed Mtownsend\Progress\Step|array $steps);
$steps = [
(new Step(42, 'Answer To Everything'))->integer(),
(new Step('https://github.com/mtownsend5512', 'Github Profile'))->notEmpty()->url(),
(new Step(10, 'Open Source Packages'))->notEmpty()->integer(),
];
$progress = new Progress($steps);
$progress->get();
// Outputs:
[
"total_steps" => 3
"percentage_complete" => 100.0
"percentage_incomplete" => 0.0
"steps_complete" => 3
"steps_incomplete" => 0
"complete_step_names" => [
0 => "Answer To Everything"
1 => "Github Profile"
2 => "Open Source Packages"
]
"incomplete_step_names" => []
]
// To retrieve percentage_complete you can simply do:
$progress->percentage_complete; // 100.0