PHPackages                             fellowgeek/php-ref - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fellowgeek/php-ref

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fellowgeek/php-ref
==================

A nicer print\_r/var\_dump alternative for PHP 8.3+

11101PHP

Since Jan 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/fellowgeek/php-ref)[ Packagist](https://packagist.org/packages/fellowgeek/php-ref)[ RSS](/packages/fellowgeek-php-ref/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

This is a fork of digitalnature/php-ref with updates from Juan Manuel Cabello to include PHP8.3 adaptations, modified to fit the OhCrud framework better.

REF, or `r()` is a nicer alternative to PHP's [`print_r`](http://php.net/manual/en/function.print-r.php) / [`var_dump`](http://php.net/manual/en/function.var-dump.php) functions.

[DEMO](http://dev.digitalnature.eu/php-ref/)
--------------------------------------------

[](#demo)

Requirements
------------

[](#requirements)

- (server) PHP 5.3+ (5.4+ displays additional info)
- (client) Any browser, except IE 8 and lower of course

Installation using Composer
---------------------------

[](#installation-using-composer)

Add REF to your `composer.json`:

```
{
    "require": {
        "fellowgeek/php-ref": "dev-master"
    }
}
```

Now tell composer to download the bundle by running:

```
$ php composer.phar update fellowgeek/php-ref
```

Composer will install the bundle to the directory `vendor/fellowgeek`.

Usage
-----

[](#usage)

Basic example:

```
// include the class (not needed if project runs with Composer because it's auto-loaded)
require '/full/path/to/ref.php';

// display info about defined classes
r(get_declared_classes());

// display info about global variables
r($GLOBALS);

```

To print in text mode you can use the `rt()` function instead:

```
rt($var);

```

To terminate the script after the info is dumped, prepend the bitwise NOT operator:

```
~r($var);   // html
~rt($var);  // text

```

Prepending the error control operator (@) will return the information:

```
$output = @r($var);   // html
$output = @rt($var);  // text

```

Keyboard shortcuts (javascript must be enabled):

- `X` - collapses / expands all levels

To modify the global configuration call `ref::config()`:

```
// example: initially expand first 3 levels
ref::config('expLvl', 3);

```

Currently available options and their default values:

OptionDefaultDescription`'expLvl'``1`Initially expanded levels (for HTML mode only). A negative value will expand all levels`'maxDepth'``6`Maximum depth (`0` to disable); note that disabling it or setting a high value can produce a 100+ MB page when input involves large data`'showIteratorContents'``FALSE`Display iterator data (keys and values)`'showResourceInfo'``TRUE`Display additional information about resources`'showMethods'``TRUE`Display methods and parameter information on objects`'showPrivateMembers'``FALSE`Include private properties and methods`'showStringMatches'``TRUE`Perform and display string matches for dates, files, json strings, serialized data, regex patterns etc. (SLOW)`'formatters'``array()`Custom/external formatters (as associative array: format =&gt; className)`'shortcutFunc'``array('r', 'rt')`Shortcut functions used to detect the input expression. If they are namespaced, the namespace must be present as well (methods are not supported)`'stylePath'``'{:dir}/ref.css'`Local path to a custom stylesheet (HTML only); `FALSE` means that no CSS is included.`'scriptPath'``'{:dir}/ref.js'`Local path to a custom javascript (HTML only); `FALSE` means no javascript (tooltips / toggle / kbd shortcuts require JS)`'showUrls'``TRUE`Gets information about URLs. Setting to false can improve performance (requires showStringMatches to be TRUE)License
-------

[](#license)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/14c6d2a2a081ebabcf5b3f0d1814e8f1fb6705b6aba44f8797bbf32d34ae5401?d=identicon)[fellowgeek](/maintainers/fellowgeek)

---

Top Contributors

[![fellowgeek](https://avatars.githubusercontent.com/u/3333580?v=4)](https://github.com/fellowgeek "fellowgeek (15 commits)")

### Embed Badge

![Health badge](/badges/fellowgeek-php-ref/health.svg)

```
[![Health](https://phpackages.com/badges/fellowgeek-php-ref/health.svg)](https://phpackages.com/packages/fellowgeek-php-ref)
```

###  Alternatives

[components/jqueryui

jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you're building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice.

1795.8M57](/packages/components-jqueryui)[clue/graph-composer

Dependency graph visualization for composer.json

93798.0k11](/packages/clue-graph-composer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
