
For the past week or so I have been running Zend Z-Ray in Laravel Homestead. Every time using it, new features come to light that are fantastic for debugging your apps in development! What follows is a quick preview of Z-Ray, along with all the steps necessary to install it on Laravel Homestead.
Overview
Z-Ray installs on the server, and will automatically load on all your projects on that particular server (in our case Homestead) automatically. Even better, it supports many major frameworks right out of the box, including: WordPress, ZendFramework (1 & 2), Magento, Drupal, with Symfony support on the way. (You can even extend it for your own Framework, if you like!)
This is very exciting for developers who have all their client sites in Homestead, regardless of the framework. The bottom line is that Z-Ray saves time and provides debugging tools without requiring you to install them in each project.
General Features of Z-Ray






Laravel Features in Z-Ray






Admin Panel
The admin panel can be easily accessed from the Z-Ray bar itself via the right hamburger menu and selecting “Settings”, or you can browse any of your homestead sites with the admin port 10081, for example http://example.dev:10081/
.





Installation
Requirements
Guide
SSH into your homestead environment, and make sure you are in your home folder:
homestead ssh
cd ~
Let’s download Z-Ray:
wget http://downloads.zend.com/zray/1208/zray-php5.6-Ubuntu-14.04-x86_64.tar.gz
Enter super-user mode:
sudo su
Unzip the archive:
tar xvfz zray-php5.6-Ubuntu-14.04-x86_64.tar.gz -C /opt
Create a new file /etc/nginx/conf.d/zray.conf:
server {
listen 10081 default_server;
server_name _;
server_name_in_redirect off;
root /opt/zray/gui/public;
index index.php index.html index.htm;
location ~ ^/ZendServer/(.+)$ {
try_files /$1 /index.php?$args;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Create symlinks to PHP configurations:
ln -sf /opt/zray/zray.ini /etc/php5/cli/conf.d/zray.ini
ln -sf /opt/zray/zray.ini /etc/php5/fpm/conf.d/zray.ini
Verify Z-Ray is running:
php -v
Inside the with sections you should see Z-Ray listed:
with Zend Server Z-Ray v8.5.0
Now, we need to set permissions on the Z-Ray files so the web server can access them:
chown -R vagrant:vagrant /opt/zray
And finally, lets restart NGINX:
service nginx restart
You can now exit out of super-user mode (CTRL-D). Before we leave Homestead, let’s clean up after ourselves:
cd ~
rm -rf zray*
And now exit out of homestead (CTRL-D again). We’re almost there. We just need to edit the Homestead configuration to open the Z-Ray admin port:
homestead edit
And add the following lines under the cpus directive:
ports:
- send: 10081
to: 10081
Let’s restart and provision Homestead:
homestead halt
homestead up --provision
Now simply access any of your homestead sites like you normally would under port 8000, and you should see the Z-Ray bar at the bottom.
I want to thank Zeev Suraski from Zend for inviting me to test-drive their tech preview of the stand-alone version of Z-Ray.
We would love to hear about your experiences with Z-Ray! Do you like it? Does it improve your development workflow? Let us know.