PHPackages                             marc/xray - 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. marc/xray

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

marc/xray
=========

X-Ray allows declaration of Zend Engine include() and eval() hooks.

226C

Since Jul 1Pushed 7y ago3 watchersCompare

[ Source](https://github.com/marcioAlmada/xray)[ Packagist](https://packagist.org/packages/marc/xray)[ RSS](/packages/marc-xray/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (1)Used By (0)

X-Ray
=====

[](#x-ray)

[![Build Status](https://camo.githubusercontent.com/ed229a891e5bf65ab2309fcc4d9b28abdda335e403e5626e6350bef99588115b/68747470733a2f2f7472617669732d63692e6f72672f6d617263696f416c6d6164612f787261792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/marcioAlmada/xray)[![Percentage of issues still open](https://camo.githubusercontent.com/969bff24f9a54fb20321fea2eaf03313dbd64c5b3ae3bb64ae50667a232ef4ac/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f6f70656e2f6d617263696f416c6d6164612f787261792e737667)](http://isitmaintained.com/project/marcioAlmada/xray "Percentage of issues still open")[![License](https://camo.githubusercontent.com/bd146efc0fe521a677c1649d2e9ec30bc63d8b2b07dee9d1cfb81c47a4d75d11/68747470733a2f2f706f7365722e707567782e6f72672f7961792f7961792f6c6963656e73652e706e67)](https://github.com/marcioAlmada/xray)

**X-Ray** allows declaration of *Zend Engine* `include()`, `require()` and `eval()` hooks.:

How to use:
-----------

[](#how-to-use)

```
// adding a compiler hook:
xray\set_compiler_hook(function(string $source, string $filename = null) : string {
    if ($filename === null)  {
        // here we intercept source included through eval()
        // do transformations on $source and return the new $source to be included
    }
    else {
        // here we intercept source included from a *.php file
        // do transformations on $source and return the new $source to be included
    }
});

// removing the compiler hook:
$hook = xray\restore_compiler_hook();
```

How to install:
---------------

[](#how-to-install)

```
git clone https://github.com/marcioAlmada/xray
cd xray
phpize
./configure
make
sudo make install

```

Finally add `extension=xray.so` to your `/etc/php.ini`

Windows Support
---------------

[](#windows-support)

Pull requests welcome. Anyone?

Why?
----

[](#why)

A compiler hook API was needed in order to have a decent infrastructure for [YAY](https://github.com/marcioAlmada/yay). But this ended up as a more general purpose internal framework so [others projects](https://github.com/phplang/phack) can benefit too.

Copyright
---------

[](#copyright)

Copyright (c) 2015-\* Márcio Almada. Distributed under the terms of an MIT-style license. See LICENSE for details.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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/e6b4f6d6d37192719fb4d4d03bbdb9e866972a2b6556da9967b10b35843809f1?d=identicon)[marcioAlmada](/maintainers/marcioAlmada)

---

Top Contributors

[![marcioAlmada](https://avatars.githubusercontent.com/u/227395?v=4)](https://github.com/marcioAlmada "marcioAlmada (6 commits)")

---

Tags

php-extensionpreprocessor

### Embed Badge

![Health badge](/badges/marc-xray/health.svg)

```
[![Health](https://phpackages.com/badges/marc-xray/health.svg)](https://phpackages.com/packages/marc-xray)
```

###  Alternatives

[icehouse-ventures/laravel-mermaid

Simple package to generate diagrams in Laravel using the Mermaid.js library

2630.0k](/packages/icehouse-ventures-laravel-mermaid)[bmichotte/dijkstra

php 7+ implementation of the Dijkstra algorithm

131.5k](/packages/bmichotte-dijkstra)

PHPackages © 2026

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