Extending Z-Ray

      No Comments on Extending Z-Ray

One of the coolest new features added in Zend Server 8 is the ability to extend Z-Ray. This feature means that regardless of the app/framework/platform you’re developing, you can easily extend Z-Ray to extract and display the information you want.

In fact, this ability was used to add Z-Ray support for popular PHP apps and frameworks. Zend Server comes built-in with Z-Ray extensions for WordPress, Drupal, Magento, ZF1 and ZF2, Laravel, and more.

This feature is very easy to use, and all the documentation you need is on GitHub. To learn how to build your own extension, you can check out this tutorial as well. The PHP community has picked up the gauntlet, and is contributing some very interesting extensions. The Z-Ray eco-system now consists of extensions for Joomla, Doctrine2, Redis, OPcache, and more – and all this by PHP developers around the world and within just a few weeks.

Below is the first piece in a new series of posts I’ll be publishing, analyzing these extensions.

Z-Ray for OPcache

This first piece in the series describes the Z-Ray OPcache extension.

This extension was developed by Jan Burkl (@janatzend), and is available here:  https://github.com/janatzend/Z-Ray-OPcache

After installing this extension (just follow the very easy instructions supplied by Jan), you will see two new panels displayed in Z-Ray.

The first panel is called OPcache Status and it gives us some info spread out in five separate tabs:

  • Statistics – a general statistical overview of OPcache work and status – a cool graph of the hit rate, total amount of hits and misses, and number of cached scripts

  • Memory – a graph representing memory consumption, including memory consumed by obsolete scripts

  • Directives – a list of the OPcache configuration directives and their settings

  • Version – general information on OPcache version

  • Blacklist – includes a list of PHP scripts to be excluded from being cached by OPcache

The second panel is called OPcache Scripts, and it conveniently lists all the cached PHP scripts, including information on the script’s file path, number of cached hits, the amount of memory consumed, the date and time for the last time the cached script was used, and the date and time the script was first cached.