whatisgithub

What is environment?

sebastianbergmann/environment — explained in plain English

Analysis updated 2026-06-24

6,779PHPAudience · developerComplexity · 1/5Setup · easy

In one sentence

A tiny PHP utility library that detects whether code is running on standard PHP or HHVM, so you can write conditional logic once and reuse it across test frameworks and developer tools.

Mindmap

mindmap
  root((environment))
    Purpose
      Runtime detection
      PHP vs HHVM
      Conditional logic
    Use cases
      Test frameworks
      Developer tools
      Reusable checks
    Setup
      Composer install
      Dev dependency
      Production use
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Write a test helper that skips certain test cases when the runtime is HHVM due to known behavioral differences.

USE CASE 2

Build a developer tool that adjusts its output format depending on which PHP runtime is detected.

USE CASE 3

Centralize all PHP runtime detection logic behind one reusable library rather than scattering checks throughout a codebase.

What is it built with?

PHPComposer

How does it compare?

sebastianbergmann/environmentaonez/kekadoctrine/annotations
Stars6,7796,7726,745
LanguagePHPPHPPHP
Setup difficultyeasyeasymoderate
Complexity1/51/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
License terms are not described in the explanation.

So what is it?

sebastian/environment is a small PHP utility library that makes it easier to write code with different behavior depending on which runtime is executing it. PHP programs can run on standard PHP (the official interpreter) or on HHVM, an alternative runtime originally developed by Meta that implements PHP with a just-in-time compiler. The two runtimes can differ in subtle ways, and this library provides a way to detect the current environment so developers can write code that adapts its execution path accordingly. The practical use case is often in test frameworks or developer tools, where behavior differences between runtimes need to be handled explicitly. Rather than scattering inline checks throughout application code, centralizing runtime detection behind a small library keeps that logic reusable and easier to test. Installation is through Composer, the standard package manager for PHP. You can add it as a regular dependency if your production code needs it, or restrict it to development use if you only need it when running a test suite. The command is composer require sebastian/environment or, for development-only installation, composer require --dev sebastian/environment. The README for this repository is minimal: it states the purpose in one sentence and provides the install command. No usage examples, API reference, or list of available detection methods appears in the file, so the full capabilities of the library are not detailed here.

Copy-paste prompts

Prompt 1
Using sebastian/environment in PHP, write a helper that checks if the current runtime is HHVM and skips a test section accordingly, logging a message when skipped.
Prompt 2
How do I add sebastian/environment as a dev-only Composer dependency and use it to branch behavior inside a PHPUnit test suite?
Prompt 3
Show me how to wrap sebastian/environment's runtime detection in my own service class so no application code calls the library directly.

Frequently asked questions

What is environment?

A tiny PHP utility library that detects whether code is running on standard PHP or HHVM, so you can write conditional logic once and reuse it across test frameworks and developer tools.

What language is environment written in?

Mainly PHP. The stack also includes PHP, Composer.

What license does environment use?

License terms are not described in the explanation.

How hard is environment to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is environment for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.