Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 28-Mar-2019 | - | ||||
src/ | H | 28-Mar-2019 | - | 309 | 173 | |
tests/ | H | 28-Mar-2019 | - | 184 | 74 | |
.travis.yml | H A D | 27-Mar-2019 | 200 | 17 | 11 | |
LICENSE | H A D | 27-Mar-2019 | 1.5 KiB | 34 | 27 | |
README.md | H A D | 27-Mar-2019 | 2 KiB | 73 | 52 | |
build.xml | H A D | 27-Mar-2019 | 812 | 27 | 23 | |
composer.json | H A D | 27-Mar-2019 | 713 | 31 | 30 | |
phpunit.xml | H A D | 27-Mar-2019 | 742 | 21 | 19 |
README.md
1# Environment 2 3This component provides functionality that helps writing PHP code that has runtime-specific (PHP / HHVM) execution paths. 4 5[![Latest Stable Version](https://poser.pugx.org/sebastian/environment/v/stable.png)](https://packagist.org/packages/sebastian/environment) 6[![Build Status](https://travis-ci.org/sebastianbergmann/environment.png?branch=master)](https://travis-ci.org/sebastianbergmann/environment) 7 8## Installation 9 10You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): 11 12 composer require sebastian/environment 13 14If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: 15 16 composer require --dev sebastian/environment 17 18## Usage 19 20```php 21<?php 22use SebastianBergmann\Environment\Runtime; 23 24$runtime = new Runtime; 25 26var_dump($runtime->getNameWithVersion()); 27var_dump($runtime->getName()); 28var_dump($runtime->getVersion()); 29var_dump($runtime->getBinary()); 30var_dump($runtime->isHHVM()); 31var_dump($runtime->isPHP()); 32var_dump($runtime->hasXdebug()); 33var_dump($runtime->canCollectCodeCoverage()); 34``` 35 36### Output on PHP 37 38 $ php --version 39 PHP 5.5.8 (cli) (built: Jan 9 2014 08:33:30) 40 Copyright (c) 1997-2013 The PHP Group 41 Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies 42 with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans 43 44 45 $ php example.php 46 string(9) "PHP 5.5.8" 47 string(3) "PHP" 48 string(5) "5.5.8" 49 string(14) "'/usr/bin/php'" 50 bool(false) 51 bool(true) 52 bool(true) 53 bool(true) 54 55### Output on HHVM 56 57 $ hhvm --version 58 HipHop VM 2.4.0-dev (rel) 59 Compiler: heads/master-0-ga98e57cabee7e7f0d14493ab17d5c7ab0157eb98 60 Repo schema: 8d6e69287c41c1f09bb4d327421720d1922cfc67 61 62 63 $ hhvm example.php 64 string(14) "HHVM 2.4.0-dev" 65 string(4) "HHVM" 66 string(9) "2.4.0-dev" 67 string(42) "'/usr/local/src/hhvm/hphp/hhvm/hhvm' --php" 68 bool(true) 69 bool(false) 70 bool(false) 71 bool(true) 72 73