GithubHelp home page GithubHelp logo

johninchina / environment Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sebastianbergmann/environment

0.0 1.0 0.0 62 KB

Provides functionality that helps writing PHP code that has runtime-specific (PHP / HHVM) execution paths

License: Other

PHP 100.00%

environment's Introduction

Environment

This component provides functionality that helps writing PHP code that has runtime-specific (PHP / HHVM) execution paths.

Latest Stable Version Build Status

Installation

To add Environment as a local, per-project dependency to your project, simply add a dependency on sebastian/environment to your project's composer.json file. Here is a minimal example of a composer.json file that just defines a dependency on Environment 1.0:

{
    "require": {
        "sebastian/environment": "1.0.*"
    }
}

Usage

<?php
use SebastianBergmann\Environment\Runtime;

$runtime = new Runtime;

var_dump($runtime->getNameWithVersion());
var_dump($runtime->getName());
var_dump($runtime->getVersion());
var_dump($runtime->getBinary());
var_dump($runtime->isHHVM());
var_dump($runtime->isPHP());
var_dump($runtime->hasXdebug());
var_dump($runtime->canCollectCodeCoverage());

Output on PHP

$ php --version
PHP 5.5.8 (cli) (built: Jan  9 2014 08:33:30)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans


$ php example.php
string(9) "PHP 5.5.8"
string(3) "PHP"
string(5) "5.5.8"
string(14) "'/usr/bin/php'"
bool(false)
bool(true)
bool(true)
bool(true)

Output on HHVM

$ hhvm --version
HipHop VM 2.4.0-dev (rel)
Compiler: heads/master-0-ga98e57cabee7e7f0d14493ab17d5c7ab0157eb98
Repo schema: 8d6e69287c41c1f09bb4d327421720d1922cfc67


$ hhvm example.php
string(14) "HHVM 2.4.0-dev"
string(4) "HHVM"
string(9) "2.4.0-dev"
string(42) "'/usr/local/src/hhvm/hphp/hhvm/hhvm' --php"
bool(true)
bool(false)
bool(false)
bool(true)

environment's People

Contributors

grahamcampbell avatar henriquemoody avatar rquadling avatar sebastianbergmann avatar stof avatar tomzx avatar whatthejeff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.