whatisgithub

What is exporter?

sebastianbergmann/exporter — explained in plain English

Analysis updated 2026-06-24

6,823PHPAudience · developerComplexity · 2/5Setup · easy

In one sentence

Small PHP library that converts any variable, arrays, objects, null, circular references, into a readable text representation. Best known as an internal dependency of PHPUnit that formats values in test failure messages.

Mindmap

mindmap
  root((exporter))
    What it does
      Convert variables to text
      Debug output
      Circular reference handling
    Use Cases
      PHPUnit assertions
      Debug logging
      Test failure messages
    Tech Stack
      PHP
      Composer
    Features
      Short export mode
      Type display
      Recursive safety
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

Print any PHP variable including deeply nested arrays and objects in a consistent, readable format for debug output.

USE CASE 2

Display clearly formatted variable values in custom PHPUnit assertion failure messages so test failures are easier to understand.

USE CASE 3

Handle circular references in PHP objects or arrays safely when converting them to text, without crashing or looping forever.

What is it built with?

PHPComposer

How does it compare?

sebastianbergmann/exporterdenvercoder1/github-readme-streak-statshyperf/hyperf
Stars6,8236,8226,833
LanguagePHPPHPPHP
Setup difficultyeasyeasyhard
Complexity2/51/54/5
Audiencedeveloperdeveloperdeveloper

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

How do you get it running?

Difficulty · easy Time to first run · 5min

So what is it?

This is a small PHP library that converts any PHP variable into a readable text representation. Numbers, strings, booleans, arrays, objects, and special values like null or resources all get printed out in a consistent format that shows their type and contents clearly. It is mainly useful when you need to display the state of a variable for debugging or in a test failure message. The library handles situations that would normally be tricky to display, such as circular references where an array or object refers back to itself. Rather than looping forever or crashing, it marks the repeated reference so you can see the structure without confusion. It also has a shorter export mode that shows just the type and a brief indicator when the value is large, instead of printing everything out. Installation is through Composer, the standard PHP package manager. You can add it as a regular project dependency or as a development-only dependency if it is only needed for tests. The library does not have a complex setup, you create an Exporter instance and call export() on whatever value you want to inspect. This package is best known as an internal dependency of PHPUnit, the widely used PHP testing framework, where it formats values in assertion failure output. Most PHP developers encounter it indirectly rather than installing it directly. The README is focused entirely on code examples rather than prose, so the scope of the library is exactly what the examples show: variable visualization for development and testing contexts.

Copy-paste prompts

Prompt 1
Use the sebastianbergmann/exporter library to print the contents of a complex nested PHP array in a readable format for a debug log entry.
Prompt 2
How do I use the Exporter class to format a PHP object inside a custom PHPUnit assertion so the failure message shows exactly what was returned?
Prompt 3
Show me how exporter handles a circular reference in a PHP array so I understand how to display recursive data structures without infinite loops.
Prompt 4
Add the exporter package as a Composer dev dependency and write a helper function that uses it to dump any variable to the console during local debugging.

Frequently asked questions

What is exporter?

Small PHP library that converts any variable, arrays, objects, null, circular references, into a readable text representation. Best known as an internal dependency of PHPUnit that formats values in test failure messages.

What language is exporter written in?

Mainly PHP. The stack also includes PHP, Composer.

How hard is exporter to set up?

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

Who is exporter for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.