• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..28-Mar-2019-

src/H28-Mar-2019-309173

tests/H28-Mar-2019-18474

.travis.ymlH A D27-Mar-2019200 1711

LICENSEH A D27-Mar-20191.5 KiB3427

README.mdH A D27-Mar-20192 KiB7352

build.xmlH A D27-Mar-2019812 2723

composer.jsonH A D27-Mar-2019713 3130

phpunit.xmlH A D27-Mar-2019742 2119

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