├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── docker-compose.yml ├── examples ├── basic.php ├── basicWithShortBar.php ├── basicWithText.php ├── colors.php ├── img │ └── terminal.gif ├── toString.php └── windows.php ├── phpunit.xml ├── src └── Dariuszp │ └── CliProgressBar.php └── test └── CliProgressBarTest.php /.gitignore: -------------------------------------------------------------------------------- 1 | composer.phar 2 | vendor/ 3 | /.idea/ 4 | /phpunit.phar -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - 7.2 4 | 5 | install: 6 | - composer --prefer-source install; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Dariusz Półtorak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cli-progress-bar [![Build Status](https://travis-ci.org/dariuszp/cli-progress-bar.png?branch=master)](https://travis-ci.org/dariuszp/cli-progress-bar) 2 | Progress bar for cli apps 3 | 4 | ![example animation](examples/img/terminal.gif) 5 | 6 | ## Installation 7 | 8 | ```bash 9 | composer require dariuszp/cli-progress-bar 10 | ``` 11 | 12 | ## Usage 13 | 14 | ```php 15 | use Dariuszp\CliProgressBar; 16 | $bar = new CliProgressBar(10, 5); 17 | $bar->display(); 18 | $bar->end(); 19 | ``` 20 | 21 | Code above will show half full progress bar: 22 | 23 | ``` 24 | ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░ 50.0% (5/10) 25 | ``` 26 | 27 | Windows can't handle some UTF characters so there is an alternate method to display progress bar: 28 | 29 | ```php 30 | use Dariuszp\CliProgressBar; 31 | $bar = new CliProgressBar(); 32 | $bar->displayAlternateProgressBar(); // this only switch style 33 | 34 | $bar->display(); 35 | $bar->end(); 36 | ``` 37 | 38 | Output will be: 39 | 40 | ``` 41 | XXXX____________________________________ 10.0% (10/100) 42 | ``` 43 | 44 | Add text to the progress bar using the following methods 45 | ```php 46 | use Dariuszp\CliProgressBar; 47 | $bar = new CliProgressBar(50, 0, "My Custom Text"); 48 | $bar->display(); 49 | $bar->end(); 50 | ``` 51 | or 52 | ```php 53 | use Dariuszp\CliProgressBar; 54 | $bar = new CliProgressBar(); 55 | $bar->setDetails("My Custom Text"); 56 | $bar->display(); 57 | $bar->end(); 58 | ``` 59 | 60 | Also update asynchronously with setDetails() 61 | 62 | More features like: 63 | - changing progress bar length (basicWithShortBar.php) 64 | - changing bar color (colors.php) 65 | - animation example (basic.php) 66 | - etc... 67 | 68 | in [example](examples/) directory. 69 | 70 | ---- 71 | 72 | License: [MIT](https://opensource.org/licenses/MIT) 73 | 74 | Author: Półtorak Dariusz 75 | Contributors: [@mathmatrix828 - Mason Phillips](https://github.com/mathmatrix828/) 76 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dariuszp/cli-progress-bar", 3 | "description": "Cli progress bar", 4 | "type": "library", 5 | "version": "1.0.5", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Dariusz Półtorak", 10 | "email": "poltorak.dariusz@gmail.com" 11 | }, 12 | { 13 | "name": "Mason Phillips", 14 | "email": "math.matrix@icloud.com", 15 | "role": "Contributor" 16 | } 17 | ], 18 | "require": {}, 19 | "autoload": { 20 | "psr-4": { 21 | "Dariuszp\\": "src/Dariuszp" 22 | } 23 | }, 24 | "require-dev": { 25 | "phpunit/phpunit": "^7.4" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "d73a51b1f24398fcba44074db0ada549", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "doctrine/instantiator", 12 | "version": "1.1.0", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/doctrine/instantiator.git", 16 | "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", 21 | "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "php": "^7.1" 26 | }, 27 | "require-dev": { 28 | "athletic/athletic": "~0.1.8", 29 | "ext-pdo": "*", 30 | "ext-phar": "*", 31 | "phpunit/phpunit": "^6.2.3", 32 | "squizlabs/php_codesniffer": "^3.0.2" 33 | }, 34 | "type": "library", 35 | "extra": { 36 | "branch-alias": { 37 | "dev-master": "1.2.x-dev" 38 | } 39 | }, 40 | "autoload": { 41 | "psr-4": { 42 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 43 | } 44 | }, 45 | "notification-url": "https://packagist.org/downloads/", 46 | "license": [ 47 | "MIT" 48 | ], 49 | "authors": [ 50 | { 51 | "name": "Marco Pivetta", 52 | "email": "ocramius@gmail.com", 53 | "homepage": "http://ocramius.github.com/" 54 | } 55 | ], 56 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 57 | "homepage": "https://github.com/doctrine/instantiator", 58 | "keywords": [ 59 | "constructor", 60 | "instantiate" 61 | ], 62 | "time": "2017-07-22T11:58:36+00:00" 63 | }, 64 | { 65 | "name": "myclabs/deep-copy", 66 | "version": "1.8.1", 67 | "source": { 68 | "type": "git", 69 | "url": "https://github.com/myclabs/DeepCopy.git", 70 | "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" 71 | }, 72 | "dist": { 73 | "type": "zip", 74 | "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", 75 | "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", 76 | "shasum": "" 77 | }, 78 | "require": { 79 | "php": "^7.1" 80 | }, 81 | "replace": { 82 | "myclabs/deep-copy": "self.version" 83 | }, 84 | "require-dev": { 85 | "doctrine/collections": "^1.0", 86 | "doctrine/common": "^2.6", 87 | "phpunit/phpunit": "^7.1" 88 | }, 89 | "type": "library", 90 | "autoload": { 91 | "psr-4": { 92 | "DeepCopy\\": "src/DeepCopy/" 93 | }, 94 | "files": [ 95 | "src/DeepCopy/deep_copy.php" 96 | ] 97 | }, 98 | "notification-url": "https://packagist.org/downloads/", 99 | "license": [ 100 | "MIT" 101 | ], 102 | "description": "Create deep copies (clones) of your objects", 103 | "keywords": [ 104 | "clone", 105 | "copy", 106 | "duplicate", 107 | "object", 108 | "object graph" 109 | ], 110 | "time": "2018-06-11T23:09:50+00:00" 111 | }, 112 | { 113 | "name": "phar-io/manifest", 114 | "version": "1.0.3", 115 | "source": { 116 | "type": "git", 117 | "url": "https://github.com/phar-io/manifest.git", 118 | "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" 119 | }, 120 | "dist": { 121 | "type": "zip", 122 | "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", 123 | "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", 124 | "shasum": "" 125 | }, 126 | "require": { 127 | "ext-dom": "*", 128 | "ext-phar": "*", 129 | "phar-io/version": "^2.0", 130 | "php": "^5.6 || ^7.0" 131 | }, 132 | "type": "library", 133 | "extra": { 134 | "branch-alias": { 135 | "dev-master": "1.0.x-dev" 136 | } 137 | }, 138 | "autoload": { 139 | "classmap": [ 140 | "src/" 141 | ] 142 | }, 143 | "notification-url": "https://packagist.org/downloads/", 144 | "license": [ 145 | "BSD-3-Clause" 146 | ], 147 | "authors": [ 148 | { 149 | "name": "Arne Blankerts", 150 | "email": "arne@blankerts.de", 151 | "role": "Developer" 152 | }, 153 | { 154 | "name": "Sebastian Heuer", 155 | "email": "sebastian@phpeople.de", 156 | "role": "Developer" 157 | }, 158 | { 159 | "name": "Sebastian Bergmann", 160 | "email": "sebastian@phpunit.de", 161 | "role": "Developer" 162 | } 163 | ], 164 | "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", 165 | "time": "2018-07-08T19:23:20+00:00" 166 | }, 167 | { 168 | "name": "phar-io/version", 169 | "version": "2.0.1", 170 | "source": { 171 | "type": "git", 172 | "url": "https://github.com/phar-io/version.git", 173 | "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" 174 | }, 175 | "dist": { 176 | "type": "zip", 177 | "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", 178 | "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", 179 | "shasum": "" 180 | }, 181 | "require": { 182 | "php": "^5.6 || ^7.0" 183 | }, 184 | "type": "library", 185 | "autoload": { 186 | "classmap": [ 187 | "src/" 188 | ] 189 | }, 190 | "notification-url": "https://packagist.org/downloads/", 191 | "license": [ 192 | "BSD-3-Clause" 193 | ], 194 | "authors": [ 195 | { 196 | "name": "Arne Blankerts", 197 | "email": "arne@blankerts.de", 198 | "role": "Developer" 199 | }, 200 | { 201 | "name": "Sebastian Heuer", 202 | "email": "sebastian@phpeople.de", 203 | "role": "Developer" 204 | }, 205 | { 206 | "name": "Sebastian Bergmann", 207 | "email": "sebastian@phpunit.de", 208 | "role": "Developer" 209 | } 210 | ], 211 | "description": "Library for handling version information and constraints", 212 | "time": "2018-07-08T19:19:57+00:00" 213 | }, 214 | { 215 | "name": "phpdocumentor/reflection-common", 216 | "version": "1.0.1", 217 | "source": { 218 | "type": "git", 219 | "url": "https://github.com/phpDocumentor/ReflectionCommon.git", 220 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" 221 | }, 222 | "dist": { 223 | "type": "zip", 224 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 225 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 226 | "shasum": "" 227 | }, 228 | "require": { 229 | "php": ">=5.5" 230 | }, 231 | "require-dev": { 232 | "phpunit/phpunit": "^4.6" 233 | }, 234 | "type": "library", 235 | "extra": { 236 | "branch-alias": { 237 | "dev-master": "1.0.x-dev" 238 | } 239 | }, 240 | "autoload": { 241 | "psr-4": { 242 | "phpDocumentor\\Reflection\\": [ 243 | "src" 244 | ] 245 | } 246 | }, 247 | "notification-url": "https://packagist.org/downloads/", 248 | "license": [ 249 | "MIT" 250 | ], 251 | "authors": [ 252 | { 253 | "name": "Jaap van Otterdijk", 254 | "email": "opensource@ijaap.nl" 255 | } 256 | ], 257 | "description": "Common reflection classes used by phpdocumentor to reflect the code structure", 258 | "homepage": "http://www.phpdoc.org", 259 | "keywords": [ 260 | "FQSEN", 261 | "phpDocumentor", 262 | "phpdoc", 263 | "reflection", 264 | "static analysis" 265 | ], 266 | "time": "2017-09-11T18:02:19+00:00" 267 | }, 268 | { 269 | "name": "phpdocumentor/reflection-docblock", 270 | "version": "4.3.0", 271 | "source": { 272 | "type": "git", 273 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 274 | "reference": "94fd0001232e47129dd3504189fa1c7225010d08" 275 | }, 276 | "dist": { 277 | "type": "zip", 278 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", 279 | "reference": "94fd0001232e47129dd3504189fa1c7225010d08", 280 | "shasum": "" 281 | }, 282 | "require": { 283 | "php": "^7.0", 284 | "phpdocumentor/reflection-common": "^1.0.0", 285 | "phpdocumentor/type-resolver": "^0.4.0", 286 | "webmozart/assert": "^1.0" 287 | }, 288 | "require-dev": { 289 | "doctrine/instantiator": "~1.0.5", 290 | "mockery/mockery": "^1.0", 291 | "phpunit/phpunit": "^6.4" 292 | }, 293 | "type": "library", 294 | "extra": { 295 | "branch-alias": { 296 | "dev-master": "4.x-dev" 297 | } 298 | }, 299 | "autoload": { 300 | "psr-4": { 301 | "phpDocumentor\\Reflection\\": [ 302 | "src/" 303 | ] 304 | } 305 | }, 306 | "notification-url": "https://packagist.org/downloads/", 307 | "license": [ 308 | "MIT" 309 | ], 310 | "authors": [ 311 | { 312 | "name": "Mike van Riel", 313 | "email": "me@mikevanriel.com" 314 | } 315 | ], 316 | "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", 317 | "time": "2017-11-30T07:14:17+00:00" 318 | }, 319 | { 320 | "name": "phpdocumentor/type-resolver", 321 | "version": "0.4.0", 322 | "source": { 323 | "type": "git", 324 | "url": "https://github.com/phpDocumentor/TypeResolver.git", 325 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" 326 | }, 327 | "dist": { 328 | "type": "zip", 329 | "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", 330 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", 331 | "shasum": "" 332 | }, 333 | "require": { 334 | "php": "^5.5 || ^7.0", 335 | "phpdocumentor/reflection-common": "^1.0" 336 | }, 337 | "require-dev": { 338 | "mockery/mockery": "^0.9.4", 339 | "phpunit/phpunit": "^5.2||^4.8.24" 340 | }, 341 | "type": "library", 342 | "extra": { 343 | "branch-alias": { 344 | "dev-master": "1.0.x-dev" 345 | } 346 | }, 347 | "autoload": { 348 | "psr-4": { 349 | "phpDocumentor\\Reflection\\": [ 350 | "src/" 351 | ] 352 | } 353 | }, 354 | "notification-url": "https://packagist.org/downloads/", 355 | "license": [ 356 | "MIT" 357 | ], 358 | "authors": [ 359 | { 360 | "name": "Mike van Riel", 361 | "email": "me@mikevanriel.com" 362 | } 363 | ], 364 | "time": "2017-07-14T14:27:02+00:00" 365 | }, 366 | { 367 | "name": "phpspec/prophecy", 368 | "version": "1.8.0", 369 | "source": { 370 | "type": "git", 371 | "url": "https://github.com/phpspec/prophecy.git", 372 | "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" 373 | }, 374 | "dist": { 375 | "type": "zip", 376 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", 377 | "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", 378 | "shasum": "" 379 | }, 380 | "require": { 381 | "doctrine/instantiator": "^1.0.2", 382 | "php": "^5.3|^7.0", 383 | "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", 384 | "sebastian/comparator": "^1.1|^2.0|^3.0", 385 | "sebastian/recursion-context": "^1.0|^2.0|^3.0" 386 | }, 387 | "require-dev": { 388 | "phpspec/phpspec": "^2.5|^3.2", 389 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" 390 | }, 391 | "type": "library", 392 | "extra": { 393 | "branch-alias": { 394 | "dev-master": "1.8.x-dev" 395 | } 396 | }, 397 | "autoload": { 398 | "psr-0": { 399 | "Prophecy\\": "src/" 400 | } 401 | }, 402 | "notification-url": "https://packagist.org/downloads/", 403 | "license": [ 404 | "MIT" 405 | ], 406 | "authors": [ 407 | { 408 | "name": "Konstantin Kudryashov", 409 | "email": "ever.zet@gmail.com", 410 | "homepage": "http://everzet.com" 411 | }, 412 | { 413 | "name": "Marcello Duarte", 414 | "email": "marcello.duarte@gmail.com" 415 | } 416 | ], 417 | "description": "Highly opinionated mocking framework for PHP 5.3+", 418 | "homepage": "https://github.com/phpspec/prophecy", 419 | "keywords": [ 420 | "Double", 421 | "Dummy", 422 | "fake", 423 | "mock", 424 | "spy", 425 | "stub" 426 | ], 427 | "time": "2018-08-05T17:53:17+00:00" 428 | }, 429 | { 430 | "name": "phpunit/php-code-coverage", 431 | "version": "6.1.4", 432 | "source": { 433 | "type": "git", 434 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 435 | "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" 436 | }, 437 | "dist": { 438 | "type": "zip", 439 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", 440 | "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", 441 | "shasum": "" 442 | }, 443 | "require": { 444 | "ext-dom": "*", 445 | "ext-xmlwriter": "*", 446 | "php": "^7.1", 447 | "phpunit/php-file-iterator": "^2.0", 448 | "phpunit/php-text-template": "^1.2.1", 449 | "phpunit/php-token-stream": "^3.0", 450 | "sebastian/code-unit-reverse-lookup": "^1.0.1", 451 | "sebastian/environment": "^3.1 || ^4.0", 452 | "sebastian/version": "^2.0.1", 453 | "theseer/tokenizer": "^1.1" 454 | }, 455 | "require-dev": { 456 | "phpunit/phpunit": "^7.0" 457 | }, 458 | "suggest": { 459 | "ext-xdebug": "^2.6.0" 460 | }, 461 | "type": "library", 462 | "extra": { 463 | "branch-alias": { 464 | "dev-master": "6.1-dev" 465 | } 466 | }, 467 | "autoload": { 468 | "classmap": [ 469 | "src/" 470 | ] 471 | }, 472 | "notification-url": "https://packagist.org/downloads/", 473 | "license": [ 474 | "BSD-3-Clause" 475 | ], 476 | "authors": [ 477 | { 478 | "name": "Sebastian Bergmann", 479 | "email": "sebastian@phpunit.de", 480 | "role": "lead" 481 | } 482 | ], 483 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 484 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 485 | "keywords": [ 486 | "coverage", 487 | "testing", 488 | "xunit" 489 | ], 490 | "time": "2018-10-31T16:06:48+00:00" 491 | }, 492 | { 493 | "name": "phpunit/php-file-iterator", 494 | "version": "2.0.2", 495 | "source": { 496 | "type": "git", 497 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 498 | "reference": "050bedf145a257b1ff02746c31894800e5122946" 499 | }, 500 | "dist": { 501 | "type": "zip", 502 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", 503 | "reference": "050bedf145a257b1ff02746c31894800e5122946", 504 | "shasum": "" 505 | }, 506 | "require": { 507 | "php": "^7.1" 508 | }, 509 | "require-dev": { 510 | "phpunit/phpunit": "^7.1" 511 | }, 512 | "type": "library", 513 | "extra": { 514 | "branch-alias": { 515 | "dev-master": "2.0.x-dev" 516 | } 517 | }, 518 | "autoload": { 519 | "classmap": [ 520 | "src/" 521 | ] 522 | }, 523 | "notification-url": "https://packagist.org/downloads/", 524 | "license": [ 525 | "BSD-3-Clause" 526 | ], 527 | "authors": [ 528 | { 529 | "name": "Sebastian Bergmann", 530 | "email": "sebastian@phpunit.de", 531 | "role": "lead" 532 | } 533 | ], 534 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 535 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 536 | "keywords": [ 537 | "filesystem", 538 | "iterator" 539 | ], 540 | "time": "2018-09-13T20:33:42+00:00" 541 | }, 542 | { 543 | "name": "phpunit/php-text-template", 544 | "version": "1.2.1", 545 | "source": { 546 | "type": "git", 547 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 548 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 549 | }, 550 | "dist": { 551 | "type": "zip", 552 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 553 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 554 | "shasum": "" 555 | }, 556 | "require": { 557 | "php": ">=5.3.3" 558 | }, 559 | "type": "library", 560 | "autoload": { 561 | "classmap": [ 562 | "src/" 563 | ] 564 | }, 565 | "notification-url": "https://packagist.org/downloads/", 566 | "license": [ 567 | "BSD-3-Clause" 568 | ], 569 | "authors": [ 570 | { 571 | "name": "Sebastian Bergmann", 572 | "email": "sebastian@phpunit.de", 573 | "role": "lead" 574 | } 575 | ], 576 | "description": "Simple template engine.", 577 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 578 | "keywords": [ 579 | "template" 580 | ], 581 | "time": "2015-06-21T13:50:34+00:00" 582 | }, 583 | { 584 | "name": "phpunit/php-timer", 585 | "version": "2.0.0", 586 | "source": { 587 | "type": "git", 588 | "url": "https://github.com/sebastianbergmann/php-timer.git", 589 | "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" 590 | }, 591 | "dist": { 592 | "type": "zip", 593 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", 594 | "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", 595 | "shasum": "" 596 | }, 597 | "require": { 598 | "php": "^7.1" 599 | }, 600 | "require-dev": { 601 | "phpunit/phpunit": "^7.0" 602 | }, 603 | "type": "library", 604 | "extra": { 605 | "branch-alias": { 606 | "dev-master": "2.0-dev" 607 | } 608 | }, 609 | "autoload": { 610 | "classmap": [ 611 | "src/" 612 | ] 613 | }, 614 | "notification-url": "https://packagist.org/downloads/", 615 | "license": [ 616 | "BSD-3-Clause" 617 | ], 618 | "authors": [ 619 | { 620 | "name": "Sebastian Bergmann", 621 | "email": "sebastian@phpunit.de", 622 | "role": "lead" 623 | } 624 | ], 625 | "description": "Utility class for timing", 626 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 627 | "keywords": [ 628 | "timer" 629 | ], 630 | "time": "2018-02-01T13:07:23+00:00" 631 | }, 632 | { 633 | "name": "phpunit/php-token-stream", 634 | "version": "3.0.1", 635 | "source": { 636 | "type": "git", 637 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 638 | "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" 639 | }, 640 | "dist": { 641 | "type": "zip", 642 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", 643 | "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", 644 | "shasum": "" 645 | }, 646 | "require": { 647 | "ext-tokenizer": "*", 648 | "php": "^7.1" 649 | }, 650 | "require-dev": { 651 | "phpunit/phpunit": "^7.0" 652 | }, 653 | "type": "library", 654 | "extra": { 655 | "branch-alias": { 656 | "dev-master": "3.0-dev" 657 | } 658 | }, 659 | "autoload": { 660 | "classmap": [ 661 | "src/" 662 | ] 663 | }, 664 | "notification-url": "https://packagist.org/downloads/", 665 | "license": [ 666 | "BSD-3-Clause" 667 | ], 668 | "authors": [ 669 | { 670 | "name": "Sebastian Bergmann", 671 | "email": "sebastian@phpunit.de" 672 | } 673 | ], 674 | "description": "Wrapper around PHP's tokenizer extension.", 675 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 676 | "keywords": [ 677 | "tokenizer" 678 | ], 679 | "time": "2018-10-30T05:52:18+00:00" 680 | }, 681 | { 682 | "name": "phpunit/phpunit", 683 | "version": "7.4.4", 684 | "source": { 685 | "type": "git", 686 | "url": "https://github.com/sebastianbergmann/phpunit.git", 687 | "reference": "b1be2c8530c4c29c3519a052c9fb6cee55053bbd" 688 | }, 689 | "dist": { 690 | "type": "zip", 691 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b1be2c8530c4c29c3519a052c9fb6cee55053bbd", 692 | "reference": "b1be2c8530c4c29c3519a052c9fb6cee55053bbd", 693 | "shasum": "" 694 | }, 695 | "require": { 696 | "doctrine/instantiator": "^1.1", 697 | "ext-dom": "*", 698 | "ext-json": "*", 699 | "ext-libxml": "*", 700 | "ext-mbstring": "*", 701 | "ext-xml": "*", 702 | "myclabs/deep-copy": "^1.7", 703 | "phar-io/manifest": "^1.0.2", 704 | "phar-io/version": "^2.0", 705 | "php": "^7.1", 706 | "phpspec/prophecy": "^1.7", 707 | "phpunit/php-code-coverage": "^6.0.7", 708 | "phpunit/php-file-iterator": "^2.0.1", 709 | "phpunit/php-text-template": "^1.2.1", 710 | "phpunit/php-timer": "^2.0", 711 | "sebastian/comparator": "^3.0", 712 | "sebastian/diff": "^3.0", 713 | "sebastian/environment": "^3.1 || ^4.0", 714 | "sebastian/exporter": "^3.1", 715 | "sebastian/global-state": "^2.0", 716 | "sebastian/object-enumerator": "^3.0.3", 717 | "sebastian/resource-operations": "^2.0", 718 | "sebastian/version": "^2.0.1" 719 | }, 720 | "conflict": { 721 | "phpunit/phpunit-mock-objects": "*" 722 | }, 723 | "require-dev": { 724 | "ext-pdo": "*" 725 | }, 726 | "suggest": { 727 | "ext-soap": "*", 728 | "ext-xdebug": "*", 729 | "phpunit/php-invoker": "^2.0" 730 | }, 731 | "bin": [ 732 | "phpunit" 733 | ], 734 | "type": "library", 735 | "extra": { 736 | "branch-alias": { 737 | "dev-master": "7.4-dev" 738 | } 739 | }, 740 | "autoload": { 741 | "classmap": [ 742 | "src/" 743 | ] 744 | }, 745 | "notification-url": "https://packagist.org/downloads/", 746 | "license": [ 747 | "BSD-3-Clause" 748 | ], 749 | "authors": [ 750 | { 751 | "name": "Sebastian Bergmann", 752 | "email": "sebastian@phpunit.de", 753 | "role": "lead" 754 | } 755 | ], 756 | "description": "The PHP Unit Testing framework.", 757 | "homepage": "https://phpunit.de/", 758 | "keywords": [ 759 | "phpunit", 760 | "testing", 761 | "xunit" 762 | ], 763 | "time": "2018-11-14T16:52:02+00:00" 764 | }, 765 | { 766 | "name": "sebastian/code-unit-reverse-lookup", 767 | "version": "1.0.1", 768 | "source": { 769 | "type": "git", 770 | "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", 771 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" 772 | }, 773 | "dist": { 774 | "type": "zip", 775 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 776 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 777 | "shasum": "" 778 | }, 779 | "require": { 780 | "php": "^5.6 || ^7.0" 781 | }, 782 | "require-dev": { 783 | "phpunit/phpunit": "^5.7 || ^6.0" 784 | }, 785 | "type": "library", 786 | "extra": { 787 | "branch-alias": { 788 | "dev-master": "1.0.x-dev" 789 | } 790 | }, 791 | "autoload": { 792 | "classmap": [ 793 | "src/" 794 | ] 795 | }, 796 | "notification-url": "https://packagist.org/downloads/", 797 | "license": [ 798 | "BSD-3-Clause" 799 | ], 800 | "authors": [ 801 | { 802 | "name": "Sebastian Bergmann", 803 | "email": "sebastian@phpunit.de" 804 | } 805 | ], 806 | "description": "Looks up which function or method a line of code belongs to", 807 | "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", 808 | "time": "2017-03-04T06:30:41+00:00" 809 | }, 810 | { 811 | "name": "sebastian/comparator", 812 | "version": "3.0.2", 813 | "source": { 814 | "type": "git", 815 | "url": "https://github.com/sebastianbergmann/comparator.git", 816 | "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" 817 | }, 818 | "dist": { 819 | "type": "zip", 820 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", 821 | "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", 822 | "shasum": "" 823 | }, 824 | "require": { 825 | "php": "^7.1", 826 | "sebastian/diff": "^3.0", 827 | "sebastian/exporter": "^3.1" 828 | }, 829 | "require-dev": { 830 | "phpunit/phpunit": "^7.1" 831 | }, 832 | "type": "library", 833 | "extra": { 834 | "branch-alias": { 835 | "dev-master": "3.0-dev" 836 | } 837 | }, 838 | "autoload": { 839 | "classmap": [ 840 | "src/" 841 | ] 842 | }, 843 | "notification-url": "https://packagist.org/downloads/", 844 | "license": [ 845 | "BSD-3-Clause" 846 | ], 847 | "authors": [ 848 | { 849 | "name": "Jeff Welch", 850 | "email": "whatthejeff@gmail.com" 851 | }, 852 | { 853 | "name": "Volker Dusch", 854 | "email": "github@wallbash.com" 855 | }, 856 | { 857 | "name": "Bernhard Schussek", 858 | "email": "bschussek@2bepublished.at" 859 | }, 860 | { 861 | "name": "Sebastian Bergmann", 862 | "email": "sebastian@phpunit.de" 863 | } 864 | ], 865 | "description": "Provides the functionality to compare PHP values for equality", 866 | "homepage": "https://github.com/sebastianbergmann/comparator", 867 | "keywords": [ 868 | "comparator", 869 | "compare", 870 | "equality" 871 | ], 872 | "time": "2018-07-12T15:12:46+00:00" 873 | }, 874 | { 875 | "name": "sebastian/diff", 876 | "version": "3.0.1", 877 | "source": { 878 | "type": "git", 879 | "url": "https://github.com/sebastianbergmann/diff.git", 880 | "reference": "366541b989927187c4ca70490a35615d3fef2dce" 881 | }, 882 | "dist": { 883 | "type": "zip", 884 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", 885 | "reference": "366541b989927187c4ca70490a35615d3fef2dce", 886 | "shasum": "" 887 | }, 888 | "require": { 889 | "php": "^7.1" 890 | }, 891 | "require-dev": { 892 | "phpunit/phpunit": "^7.0", 893 | "symfony/process": "^2 || ^3.3 || ^4" 894 | }, 895 | "type": "library", 896 | "extra": { 897 | "branch-alias": { 898 | "dev-master": "3.0-dev" 899 | } 900 | }, 901 | "autoload": { 902 | "classmap": [ 903 | "src/" 904 | ] 905 | }, 906 | "notification-url": "https://packagist.org/downloads/", 907 | "license": [ 908 | "BSD-3-Clause" 909 | ], 910 | "authors": [ 911 | { 912 | "name": "Kore Nordmann", 913 | "email": "mail@kore-nordmann.de" 914 | }, 915 | { 916 | "name": "Sebastian Bergmann", 917 | "email": "sebastian@phpunit.de" 918 | } 919 | ], 920 | "description": "Diff implementation", 921 | "homepage": "https://github.com/sebastianbergmann/diff", 922 | "keywords": [ 923 | "diff", 924 | "udiff", 925 | "unidiff", 926 | "unified diff" 927 | ], 928 | "time": "2018-06-10T07:54:39+00:00" 929 | }, 930 | { 931 | "name": "sebastian/environment", 932 | "version": "3.1.0", 933 | "source": { 934 | "type": "git", 935 | "url": "https://github.com/sebastianbergmann/environment.git", 936 | "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" 937 | }, 938 | "dist": { 939 | "type": "zip", 940 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", 941 | "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", 942 | "shasum": "" 943 | }, 944 | "require": { 945 | "php": "^7.0" 946 | }, 947 | "require-dev": { 948 | "phpunit/phpunit": "^6.1" 949 | }, 950 | "type": "library", 951 | "extra": { 952 | "branch-alias": { 953 | "dev-master": "3.1.x-dev" 954 | } 955 | }, 956 | "autoload": { 957 | "classmap": [ 958 | "src/" 959 | ] 960 | }, 961 | "notification-url": "https://packagist.org/downloads/", 962 | "license": [ 963 | "BSD-3-Clause" 964 | ], 965 | "authors": [ 966 | { 967 | "name": "Sebastian Bergmann", 968 | "email": "sebastian@phpunit.de" 969 | } 970 | ], 971 | "description": "Provides functionality to handle HHVM/PHP environments", 972 | "homepage": "http://www.github.com/sebastianbergmann/environment", 973 | "keywords": [ 974 | "Xdebug", 975 | "environment", 976 | "hhvm" 977 | ], 978 | "time": "2017-07-01T08:51:00+00:00" 979 | }, 980 | { 981 | "name": "sebastian/exporter", 982 | "version": "3.1.0", 983 | "source": { 984 | "type": "git", 985 | "url": "https://github.com/sebastianbergmann/exporter.git", 986 | "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" 987 | }, 988 | "dist": { 989 | "type": "zip", 990 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", 991 | "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", 992 | "shasum": "" 993 | }, 994 | "require": { 995 | "php": "^7.0", 996 | "sebastian/recursion-context": "^3.0" 997 | }, 998 | "require-dev": { 999 | "ext-mbstring": "*", 1000 | "phpunit/phpunit": "^6.0" 1001 | }, 1002 | "type": "library", 1003 | "extra": { 1004 | "branch-alias": { 1005 | "dev-master": "3.1.x-dev" 1006 | } 1007 | }, 1008 | "autoload": { 1009 | "classmap": [ 1010 | "src/" 1011 | ] 1012 | }, 1013 | "notification-url": "https://packagist.org/downloads/", 1014 | "license": [ 1015 | "BSD-3-Clause" 1016 | ], 1017 | "authors": [ 1018 | { 1019 | "name": "Jeff Welch", 1020 | "email": "whatthejeff@gmail.com" 1021 | }, 1022 | { 1023 | "name": "Volker Dusch", 1024 | "email": "github@wallbash.com" 1025 | }, 1026 | { 1027 | "name": "Bernhard Schussek", 1028 | "email": "bschussek@2bepublished.at" 1029 | }, 1030 | { 1031 | "name": "Sebastian Bergmann", 1032 | "email": "sebastian@phpunit.de" 1033 | }, 1034 | { 1035 | "name": "Adam Harvey", 1036 | "email": "aharvey@php.net" 1037 | } 1038 | ], 1039 | "description": "Provides the functionality to export PHP variables for visualization", 1040 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 1041 | "keywords": [ 1042 | "export", 1043 | "exporter" 1044 | ], 1045 | "time": "2017-04-03T13:19:02+00:00" 1046 | }, 1047 | { 1048 | "name": "sebastian/global-state", 1049 | "version": "2.0.0", 1050 | "source": { 1051 | "type": "git", 1052 | "url": "https://github.com/sebastianbergmann/global-state.git", 1053 | "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" 1054 | }, 1055 | "dist": { 1056 | "type": "zip", 1057 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", 1058 | "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", 1059 | "shasum": "" 1060 | }, 1061 | "require": { 1062 | "php": "^7.0" 1063 | }, 1064 | "require-dev": { 1065 | "phpunit/phpunit": "^6.0" 1066 | }, 1067 | "suggest": { 1068 | "ext-uopz": "*" 1069 | }, 1070 | "type": "library", 1071 | "extra": { 1072 | "branch-alias": { 1073 | "dev-master": "2.0-dev" 1074 | } 1075 | }, 1076 | "autoload": { 1077 | "classmap": [ 1078 | "src/" 1079 | ] 1080 | }, 1081 | "notification-url": "https://packagist.org/downloads/", 1082 | "license": [ 1083 | "BSD-3-Clause" 1084 | ], 1085 | "authors": [ 1086 | { 1087 | "name": "Sebastian Bergmann", 1088 | "email": "sebastian@phpunit.de" 1089 | } 1090 | ], 1091 | "description": "Snapshotting of global state", 1092 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1093 | "keywords": [ 1094 | "global state" 1095 | ], 1096 | "time": "2017-04-27T15:39:26+00:00" 1097 | }, 1098 | { 1099 | "name": "sebastian/object-enumerator", 1100 | "version": "3.0.3", 1101 | "source": { 1102 | "type": "git", 1103 | "url": "https://github.com/sebastianbergmann/object-enumerator.git", 1104 | "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" 1105 | }, 1106 | "dist": { 1107 | "type": "zip", 1108 | "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", 1109 | "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", 1110 | "shasum": "" 1111 | }, 1112 | "require": { 1113 | "php": "^7.0", 1114 | "sebastian/object-reflector": "^1.1.1", 1115 | "sebastian/recursion-context": "^3.0" 1116 | }, 1117 | "require-dev": { 1118 | "phpunit/phpunit": "^6.0" 1119 | }, 1120 | "type": "library", 1121 | "extra": { 1122 | "branch-alias": { 1123 | "dev-master": "3.0.x-dev" 1124 | } 1125 | }, 1126 | "autoload": { 1127 | "classmap": [ 1128 | "src/" 1129 | ] 1130 | }, 1131 | "notification-url": "https://packagist.org/downloads/", 1132 | "license": [ 1133 | "BSD-3-Clause" 1134 | ], 1135 | "authors": [ 1136 | { 1137 | "name": "Sebastian Bergmann", 1138 | "email": "sebastian@phpunit.de" 1139 | } 1140 | ], 1141 | "description": "Traverses array structures and object graphs to enumerate all referenced objects", 1142 | "homepage": "https://github.com/sebastianbergmann/object-enumerator/", 1143 | "time": "2017-08-03T12:35:26+00:00" 1144 | }, 1145 | { 1146 | "name": "sebastian/object-reflector", 1147 | "version": "1.1.1", 1148 | "source": { 1149 | "type": "git", 1150 | "url": "https://github.com/sebastianbergmann/object-reflector.git", 1151 | "reference": "773f97c67f28de00d397be301821b06708fca0be" 1152 | }, 1153 | "dist": { 1154 | "type": "zip", 1155 | "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", 1156 | "reference": "773f97c67f28de00d397be301821b06708fca0be", 1157 | "shasum": "" 1158 | }, 1159 | "require": { 1160 | "php": "^7.0" 1161 | }, 1162 | "require-dev": { 1163 | "phpunit/phpunit": "^6.0" 1164 | }, 1165 | "type": "library", 1166 | "extra": { 1167 | "branch-alias": { 1168 | "dev-master": "1.1-dev" 1169 | } 1170 | }, 1171 | "autoload": { 1172 | "classmap": [ 1173 | "src/" 1174 | ] 1175 | }, 1176 | "notification-url": "https://packagist.org/downloads/", 1177 | "license": [ 1178 | "BSD-3-Clause" 1179 | ], 1180 | "authors": [ 1181 | { 1182 | "name": "Sebastian Bergmann", 1183 | "email": "sebastian@phpunit.de" 1184 | } 1185 | ], 1186 | "description": "Allows reflection of object attributes, including inherited and non-public ones", 1187 | "homepage": "https://github.com/sebastianbergmann/object-reflector/", 1188 | "time": "2017-03-29T09:07:27+00:00" 1189 | }, 1190 | { 1191 | "name": "sebastian/recursion-context", 1192 | "version": "3.0.0", 1193 | "source": { 1194 | "type": "git", 1195 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1196 | "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" 1197 | }, 1198 | "dist": { 1199 | "type": "zip", 1200 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", 1201 | "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", 1202 | "shasum": "" 1203 | }, 1204 | "require": { 1205 | "php": "^7.0" 1206 | }, 1207 | "require-dev": { 1208 | "phpunit/phpunit": "^6.0" 1209 | }, 1210 | "type": "library", 1211 | "extra": { 1212 | "branch-alias": { 1213 | "dev-master": "3.0.x-dev" 1214 | } 1215 | }, 1216 | "autoload": { 1217 | "classmap": [ 1218 | "src/" 1219 | ] 1220 | }, 1221 | "notification-url": "https://packagist.org/downloads/", 1222 | "license": [ 1223 | "BSD-3-Clause" 1224 | ], 1225 | "authors": [ 1226 | { 1227 | "name": "Jeff Welch", 1228 | "email": "whatthejeff@gmail.com" 1229 | }, 1230 | { 1231 | "name": "Sebastian Bergmann", 1232 | "email": "sebastian@phpunit.de" 1233 | }, 1234 | { 1235 | "name": "Adam Harvey", 1236 | "email": "aharvey@php.net" 1237 | } 1238 | ], 1239 | "description": "Provides functionality to recursively process PHP variables", 1240 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1241 | "time": "2017-03-03T06:23:57+00:00" 1242 | }, 1243 | { 1244 | "name": "sebastian/resource-operations", 1245 | "version": "2.0.1", 1246 | "source": { 1247 | "type": "git", 1248 | "url": "https://github.com/sebastianbergmann/resource-operations.git", 1249 | "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" 1250 | }, 1251 | "dist": { 1252 | "type": "zip", 1253 | "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", 1254 | "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", 1255 | "shasum": "" 1256 | }, 1257 | "require": { 1258 | "php": "^7.1" 1259 | }, 1260 | "type": "library", 1261 | "extra": { 1262 | "branch-alias": { 1263 | "dev-master": "2.0-dev" 1264 | } 1265 | }, 1266 | "autoload": { 1267 | "classmap": [ 1268 | "src/" 1269 | ] 1270 | }, 1271 | "notification-url": "https://packagist.org/downloads/", 1272 | "license": [ 1273 | "BSD-3-Clause" 1274 | ], 1275 | "authors": [ 1276 | { 1277 | "name": "Sebastian Bergmann", 1278 | "email": "sebastian@phpunit.de" 1279 | } 1280 | ], 1281 | "description": "Provides a list of PHP built-in functions that operate on resources", 1282 | "homepage": "https://www.github.com/sebastianbergmann/resource-operations", 1283 | "time": "2018-10-04T04:07:39+00:00" 1284 | }, 1285 | { 1286 | "name": "sebastian/version", 1287 | "version": "2.0.1", 1288 | "source": { 1289 | "type": "git", 1290 | "url": "https://github.com/sebastianbergmann/version.git", 1291 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" 1292 | }, 1293 | "dist": { 1294 | "type": "zip", 1295 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", 1296 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", 1297 | "shasum": "" 1298 | }, 1299 | "require": { 1300 | "php": ">=5.6" 1301 | }, 1302 | "type": "library", 1303 | "extra": { 1304 | "branch-alias": { 1305 | "dev-master": "2.0.x-dev" 1306 | } 1307 | }, 1308 | "autoload": { 1309 | "classmap": [ 1310 | "src/" 1311 | ] 1312 | }, 1313 | "notification-url": "https://packagist.org/downloads/", 1314 | "license": [ 1315 | "BSD-3-Clause" 1316 | ], 1317 | "authors": [ 1318 | { 1319 | "name": "Sebastian Bergmann", 1320 | "email": "sebastian@phpunit.de", 1321 | "role": "lead" 1322 | } 1323 | ], 1324 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1325 | "homepage": "https://github.com/sebastianbergmann/version", 1326 | "time": "2016-10-03T07:35:21+00:00" 1327 | }, 1328 | { 1329 | "name": "theseer/tokenizer", 1330 | "version": "1.1.0", 1331 | "source": { 1332 | "type": "git", 1333 | "url": "https://github.com/theseer/tokenizer.git", 1334 | "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" 1335 | }, 1336 | "dist": { 1337 | "type": "zip", 1338 | "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", 1339 | "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", 1340 | "shasum": "" 1341 | }, 1342 | "require": { 1343 | "ext-dom": "*", 1344 | "ext-tokenizer": "*", 1345 | "ext-xmlwriter": "*", 1346 | "php": "^7.0" 1347 | }, 1348 | "type": "library", 1349 | "autoload": { 1350 | "classmap": [ 1351 | "src/" 1352 | ] 1353 | }, 1354 | "notification-url": "https://packagist.org/downloads/", 1355 | "license": [ 1356 | "BSD-3-Clause" 1357 | ], 1358 | "authors": [ 1359 | { 1360 | "name": "Arne Blankerts", 1361 | "email": "arne@blankerts.de", 1362 | "role": "Developer" 1363 | } 1364 | ], 1365 | "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", 1366 | "time": "2017-04-07T12:08:54+00:00" 1367 | }, 1368 | { 1369 | "name": "webmozart/assert", 1370 | "version": "1.3.0", 1371 | "source": { 1372 | "type": "git", 1373 | "url": "https://github.com/webmozart/assert.git", 1374 | "reference": "0df1908962e7a3071564e857d86874dad1ef204a" 1375 | }, 1376 | "dist": { 1377 | "type": "zip", 1378 | "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", 1379 | "reference": "0df1908962e7a3071564e857d86874dad1ef204a", 1380 | "shasum": "" 1381 | }, 1382 | "require": { 1383 | "php": "^5.3.3 || ^7.0" 1384 | }, 1385 | "require-dev": { 1386 | "phpunit/phpunit": "^4.6", 1387 | "sebastian/version": "^1.0.1" 1388 | }, 1389 | "type": "library", 1390 | "extra": { 1391 | "branch-alias": { 1392 | "dev-master": "1.3-dev" 1393 | } 1394 | }, 1395 | "autoload": { 1396 | "psr-4": { 1397 | "Webmozart\\Assert\\": "src/" 1398 | } 1399 | }, 1400 | "notification-url": "https://packagist.org/downloads/", 1401 | "license": [ 1402 | "MIT" 1403 | ], 1404 | "authors": [ 1405 | { 1406 | "name": "Bernhard Schussek", 1407 | "email": "bschussek@gmail.com" 1408 | } 1409 | ], 1410 | "description": "Assertions to validate method input/output with nice error messages.", 1411 | "keywords": [ 1412 | "assert", 1413 | "check", 1414 | "validate" 1415 | ], 1416 | "time": "2018-01-29T19:49:41+00:00" 1417 | } 1418 | ], 1419 | "aliases": [], 1420 | "minimum-stability": "stable", 1421 | "stability-flags": [], 1422 | "prefer-stable": false, 1423 | "prefer-lowest": false, 1424 | "platform": [], 1425 | "platform-dev": [] 1426 | } 1427 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | php72: 4 | image: "php:7.2-alpine" 5 | working_dir: "/app" 6 | volumes: 7 | - "./:/app" 8 | composer: 9 | image: "composer:latest" 10 | working_dir: "/app" 11 | volumes: 12 | - "./:/app" -------------------------------------------------------------------------------- /examples/basic.php: -------------------------------------------------------------------------------- 1 | display(); 9 | 10 | $bar->setColorToRed(); 11 | 12 | while($bar->getCurrentstep() < $bar->getSteps()) { 13 | usleep(50000); 14 | $bar->progress(); 15 | 16 | if ($bar->getCurrentstep() >= ($bar->getSteps() / 2)) { 17 | $bar->setColorToYellow(); 18 | } 19 | } 20 | 21 | $bar->setColorToGreen(); 22 | $bar->display(); 23 | 24 | $bar->end(); -------------------------------------------------------------------------------- /examples/basicWithShortBar.php: -------------------------------------------------------------------------------- 1 | setBarLength(5); 9 | $bar->display(); 10 | 11 | $bar->setColorToRed(); 12 | 13 | while($bar->getCurrentstep() < $bar->getSteps()) { 14 | usleep(50000); 15 | $bar->progress(); 16 | 17 | if ($bar->getCurrentstep() >= ($bar->getSteps() / 2)) { 18 | $bar->setColorToYellow(); 19 | } 20 | } 21 | 22 | $bar->setColorToGreen(); 23 | $bar->display(); 24 | 25 | $bar->end(); -------------------------------------------------------------------------------- /examples/basicWithText.php: -------------------------------------------------------------------------------- 1 | display(); 9 | 10 | $bar->setColorToRed(); 11 | 12 | while($bar->getCurrentstep() < $bar->getSteps()) { 13 | usleep(50000); 14 | $bar->progress(); 15 | 16 | if ($bar->getCurrentstep() >= ($bar->getSteps() / 2)) { 17 | $bar->setColorToYellow(); 18 | } 19 | } 20 | 21 | $bar->setColorToGreen(); 22 | $bar->display(); 23 | 24 | $bar->end(); 25 | -------------------------------------------------------------------------------- /examples/colors.php: -------------------------------------------------------------------------------- 1 | setColorToBlack(); 13 | $bar->display(); 14 | $bar->end(); 15 | 16 | print("\nRED\n"); 17 | $bar->setColorToRed(); 18 | $bar->display(); 19 | $bar->end(); 20 | 21 | print("\nGREEN\n"); 22 | $bar->setColorToGreen(); 23 | $bar->display(); 24 | $bar->end(); 25 | 26 | print("\nYELLOW\n"); 27 | $bar->setColorToYellow(); 28 | $bar->display(); 29 | $bar->end(); 30 | 31 | print("\nBLUE\n\n"); 32 | $bar->setColorToBlue(); 33 | $bar->display(); 34 | $bar->end(); 35 | 36 | print("\nMAGENTA\n\n"); 37 | $bar->setColorToMagenta(); 38 | $bar->display(); 39 | $bar->end(); 40 | 41 | print("\nCYAN\n\n"); 42 | $bar->setColorToCyan(); 43 | $bar->display(); 44 | $bar->end(); 45 | 46 | print("\nWHITE\n\n"); 47 | $bar->setColorToWhite(); 48 | $bar->display(); 49 | $bar->end(); 50 | 51 | print("\nDEFAULT\n\n"); 52 | $bar->setColorToDefault(); 53 | $bar->display(); 54 | $bar->end(); 55 | 56 | print("\nDONE!\n\n"); -------------------------------------------------------------------------------- /examples/img/terminal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dariuszp/cli-progress-bar/1be746082242092ce9e7c735be45f9d9a77be1aa/examples/img/terminal.gif -------------------------------------------------------------------------------- /examples/toString.php: -------------------------------------------------------------------------------- 1 | displayAlternateProgressBar(); 9 | $bar->display(); 10 | $bar->end(); -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | ./test/ 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Dariuszp/CliProgressBar.php: -------------------------------------------------------------------------------- 1 | setSteps($steps); 70 | $this->setProgressTo($currentStep); 71 | $this->setDetails($details); 72 | 73 | // Windows terminal is unable to display utf characters and colors 74 | if (!$forceDefaultProgressBar && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { 75 | $this->displayDefaultProgressBar(); 76 | } 77 | } 78 | 79 | /** 80 | * @param int $currentStep 81 | * @return $this 82 | */ 83 | public function setProgressTo($currentStep) 84 | { 85 | $this->setCurrentstep($currentStep); 86 | return $this; 87 | } 88 | 89 | /** 90 | * @return $this 91 | */ 92 | public function displayDefaultProgressBar() 93 | { 94 | $this->charEmpty = $this->defaultCharEmpty; 95 | $this->charFull = $this->defaultCharFull; 96 | return $this; 97 | } 98 | 99 | /** 100 | * @return $this 101 | */ 102 | public function setColorToDefault() 103 | { 104 | $this->color = false; 105 | return $this; 106 | } 107 | 108 | public function setColorToBlack() 109 | { 110 | return $this->setColor(30, 39); 111 | } 112 | 113 | /** 114 | * @param $start 115 | * @param $end 116 | * @return $this 117 | */ 118 | protected function setColor($start, $end) 119 | { 120 | $this->color = array( 121 | sprintf(self::COLOR_CODE_FORMAT, $start), 122 | sprintf(self::COLOR_CODE_FORMAT, $end), 123 | ); 124 | return $this; 125 | } 126 | 127 | public function setColorToRed() 128 | { 129 | return $this->setColor(31, 39); 130 | } 131 | 132 | public function setColorToGreen() 133 | { 134 | return $this->setColor(32, 39); 135 | } 136 | 137 | public function setColorToYellow() 138 | { 139 | return $this->setColor(33, 39); 140 | } 141 | 142 | public function setColorToBlue() 143 | { 144 | return $this->setColor(34, 39); 145 | } 146 | 147 | public function setColorToMagenta() 148 | { 149 | return $this->setColor(35, 39); 150 | } 151 | 152 | public function setColorToCyan() 153 | { 154 | return $this->setColor(36, 39); 155 | } 156 | 157 | public function setColorToWhite() 158 | { 159 | return $this->setColor(37, 39); 160 | } 161 | 162 | /** 163 | * @return string 164 | */ 165 | public function getDefaultCharEmpty() 166 | { 167 | return $this->defaultCharEmpty; 168 | } 169 | 170 | /** 171 | * @param string $defaultCharEmpty 172 | */ 173 | public function setDefaultCharEmpty($defaultCharEmpty) 174 | { 175 | $this->defaultCharEmpty = $defaultCharEmpty; 176 | } 177 | 178 | /** 179 | * @return string 180 | */ 181 | public function getDefaultCharFull() 182 | { 183 | return $this->defaultCharFull; 184 | } 185 | 186 | /** 187 | * @param string $defaultCharFull 188 | */ 189 | public function setDefaultCharFull($defaultCharFull) 190 | { 191 | $this->defaultCharFull = $defaultCharFull; 192 | } 193 | 194 | /** 195 | * @return $this 196 | */ 197 | public function displayAlternateProgressBar() 198 | { 199 | $this->charEmpty = $this->alternateCharEmpty; 200 | $this->charFull = $this->alternateCharFull; 201 | return $this; 202 | } 203 | 204 | /** 205 | * @param int $currentStep 206 | * @return $this 207 | */ 208 | public function addCurrentStep($currentStep) 209 | { 210 | $this->currentStep += intval($currentStep); 211 | return $this; 212 | } 213 | 214 | /** 215 | * @return string 216 | */ 217 | public function getCharEmpty() 218 | { 219 | return $this->charEmpty; 220 | } 221 | 222 | /** 223 | * @param string $charEmpty 224 | * @return $this 225 | */ 226 | public function setCharEmpty($charEmpty) 227 | { 228 | $this->charEmpty = $charEmpty; 229 | return $this; 230 | } 231 | 232 | /** 233 | * @return string 234 | */ 235 | public function getCharFull() 236 | { 237 | return $this->charFull; 238 | } 239 | 240 | /** 241 | * @param string $charFull 242 | * @return $this 243 | */ 244 | public function setCharFull($charFull) 245 | { 246 | $this->charFull = $charFull; 247 | return $this; 248 | } 249 | 250 | /** 251 | * @return string 252 | */ 253 | public function getAlternateCharEmpty() 254 | { 255 | return $this->alternateCharEmpty; 256 | } 257 | 258 | /** 259 | * @param string $alternateCharEmpty 260 | * @return $this 261 | */ 262 | public function setAlternateCharEmpty($alternateCharEmpty) 263 | { 264 | $this->alternateCharEmpty = $alternateCharEmpty; 265 | return $this; 266 | } 267 | 268 | /** 269 | * @return string 270 | */ 271 | public function getAlternateCharFull() 272 | { 273 | return $this->alternateCharFull; 274 | } 275 | 276 | /** 277 | * @param string $alternateCharFull 278 | * @return $this 279 | */ 280 | public function setAlternateCharFull($alternateCharFull) 281 | { 282 | $this->alternateCharFull = $alternateCharFull; 283 | return $this; 284 | } 285 | 286 | /** 287 | * @param string $details 288 | * @return $this 289 | */ 290 | public function setDetails($details) 291 | { 292 | $this->detail = $details; 293 | return $this; 294 | } 295 | 296 | public function getDetails() 297 | { 298 | return $this->detail; 299 | } 300 | 301 | /** 302 | * @param int $step 303 | * @param bool $display 304 | * @return $this 305 | */ 306 | public function progress($step = 1, $display = true) 307 | { 308 | $step = intval($step); 309 | $this->setCurrentstep($this->getCurrentStep() + $step); 310 | 311 | if ($display) { 312 | $this->display(); 313 | } 314 | 315 | return $this; 316 | } 317 | 318 | /** 319 | * @return int 320 | */ 321 | public function getCurrentStep() 322 | { 323 | return $this->currentStep; 324 | } 325 | 326 | /** 327 | * @param int $currentStep 328 | * @return $this 329 | */ 330 | public function setCurrentStep($currentStep) 331 | { 332 | $currentStep = intval($currentStep); 333 | if ($currentStep < 0) { 334 | throw new \InvalidArgumentException('Current step must be 0 or above'); 335 | } 336 | 337 | $this->currentStep = $currentStep; 338 | if ($this->currentStep > $this->getSteps()) { 339 | $this->currentStep = $this->getSteps(); 340 | } 341 | return $this; 342 | } 343 | 344 | public function display() 345 | { 346 | print $this->draw(); 347 | } 348 | 349 | /** 350 | * @return string 351 | */ 352 | public function draw() 353 | { 354 | $fullValue = floor($this->getCurrentStep() / $this->getSteps() * $this->getBarLength()); 355 | $emptyValue = $this->getBarLength() - $fullValue; 356 | $prc = number_format(($this->getCurrentStep() / $this->getSteps()) * 100, 1, '.', ' '); 357 | 358 | $colorStart = ''; 359 | $colorEnd = ''; 360 | if ($this->color) { 361 | $colorStart = $this->color[0]; 362 | $colorEnd = $this->color[1]; 363 | } 364 | 365 | $userDetail = $this->getDetails(); 366 | $userDetail = ((strlen($userDetail) > 1) ? "{$userDetail} " : ""); 367 | $bar = sprintf("%4\$s%5\$s %3\$.1f%% (%1\$d/%2\$d)", $this->getCurrentStep(), $this->getSteps(), $prc, str_repeat($this->charFull, $fullValue), str_repeat($this->charEmpty, $emptyValue)); 368 | return sprintf("\r%s%s%s%s", $colorStart, $userDetail, $bar, $colorEnd); 369 | } 370 | 371 | /** 372 | * @return int 373 | */ 374 | public function getSteps() 375 | { 376 | return $this->steps; 377 | } 378 | 379 | /** 380 | * @param int $steps 381 | * @return $this 382 | */ 383 | public function setSteps($steps) 384 | { 385 | $steps = intval($steps); 386 | if ($steps < 0) { 387 | throw new \InvalidArgumentException('Steps amount must be 0 or above'); 388 | } 389 | 390 | $this->steps = intval($steps); 391 | 392 | $this->setCurrentStep($this->getCurrentStep()); 393 | 394 | return $this; 395 | } 396 | 397 | /** 398 | * @return int 399 | */ 400 | public function getBarLength() 401 | { 402 | return $this->barLength; 403 | } 404 | 405 | /** 406 | * @param $barLength 407 | * @return $this 408 | */ 409 | public function setBarLength($barLength) 410 | { 411 | $barLength = intval($barLength); 412 | if ($barLength < 1) { 413 | throw new \InvalidArgumentException('Progress bar length must be above 0'); 414 | } 415 | $this->barLength = $barLength; 416 | return $this; 417 | } 418 | 419 | /** 420 | * @return string 421 | */ 422 | public function __toString() 423 | { 424 | return $this->draw(); 425 | } 426 | 427 | /** 428 | * Alias to new line (nl) 429 | */ 430 | public function end() 431 | { 432 | $this->nl(); 433 | } 434 | 435 | /** 436 | * display new line 437 | */ 438 | public function nl() 439 | { 440 | print "\n"; 441 | } 442 | } 443 | -------------------------------------------------------------------------------- /test/CliProgressBarTest.php: -------------------------------------------------------------------------------- 1 | assertEquals($bar->getBarLength(), 40, 'Bar length should be 40 at the beginning'); 10 | $this->assertEquals($bar->getCurrentstep(), 0, 'Progress bar should start with 0'); 11 | $this->assertEquals($bar->getSteps(), 100, 'Default number of steps should be 100'); 12 | } 13 | 14 | public function testDefaultBarString() { 15 | $bar = new CliProgressBar(100, 10); 16 | $this->assertEquals((string)$bar, "\r▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 10.0% (10/100)"); 17 | } 18 | 19 | public function testFullBarStringFromSources() { 20 | $fullBar = "\r▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (100/100)"; 21 | $bar = new CliProgressBar(100, 100); 22 | $this->assertEquals((string)$bar, $fullBar); 23 | 24 | $bar = new CliProgressBar(); 25 | $bar->setProgressTo(100); 26 | $this->assertEquals((string)$bar, $fullBar); 27 | 28 | $bar = new CliProgressBar(); 29 | $bar->setProgressTo(99); 30 | $bar->progress(); 31 | $this->assertEquals((string)$bar, $fullBar); 32 | } 33 | 34 | public function testBarProgress() { 35 | $bar = new CliProgressBar(10, 1); 36 | $this->assertEquals((string)$bar, "\r▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 10.0% (1/10)"); 37 | $bar->progress(); 38 | $this->assertEquals((string)$bar, "\r▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 20.0% (2/10)"); 39 | $bar->progress(2); 40 | $this->assertEquals((string)$bar, "\r▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░ 40.0% (4/10)"); 41 | $bar->setProgressTo(3); 42 | $this->assertEquals((string)$bar, "\r▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 30.0% (3/10)"); 43 | $bar->setProgressTo(99); 44 | $this->assertEquals((string)$bar, "\r▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (10/10)"); 45 | } 46 | 47 | public function testBarOverflow() { 48 | $fullBar = "\r▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (100/100)"; 49 | $bar = new CliProgressBar(); 50 | $bar->setProgressTo(99); 51 | $bar->progress(); 52 | $bar->progress(); 53 | $bar->progress(); 54 | $bar->progress(); 55 | $this->assertEquals((string)$bar, $fullBar); 56 | 57 | $bar = new CliProgressBar(); 58 | $bar->setProgressTo(99); 59 | $bar->progress(5); 60 | $this->assertEquals((string)$bar, $fullBar); 61 | } 62 | 63 | public function testShortBarColorRed() { 64 | $expected = "\r\033[31m▓░░░░ 20.0% (2/10)\033[39m"; 65 | 66 | $bar = new CliProgressBar(10, 2); 67 | $bar->setBarLength(5); 68 | $bar->setColorToRed(); 69 | $this->assertEquals($bar->draw(), $expected); 70 | } 71 | 72 | /** 73 | * @expectedException InvalidArgumentException 74 | */ 75 | public function testInvalidConstructorStepsArgument() { 76 | new CliProgressBar(10, -5); 77 | } 78 | 79 | /** 80 | * @expectedException InvalidArgumentException 81 | */ 82 | public function testInvalidConstructorCurrentStepArgument() { 83 | new CliProgressBar(-1); 84 | } 85 | 86 | /** 87 | * @expectedException InvalidArgumentException 88 | */ 89 | public function testInvalidSetCurrentStep() { 90 | $bar = new CliProgressBar(); 91 | $bar->setCurrentStep(-10); 92 | } 93 | 94 | /** 95 | * @expectedException InvalidArgumentException 96 | */ 97 | public function testInvalidSetProgressTo() { 98 | $bar = new CliProgressBar(); 99 | $bar->setProgressTo(-10); 100 | } 101 | } --------------------------------------------------------------------------------