Tech Magazine

Laravel View X-Ray

0 1,829

Get real time updates directly on you device, subscribe now.

In this article, I’m going to share with you one wonderful Laravel resource “Laravel View X-Ray”. Sometimes it might be hard to figure out, which part of the output HTML was rendered using which template.

Laravel View X-Ray

Installation Laravel View X-Ray

Use the given command to install the package using the composer.

composer require beyondcode/laravel-view-xray --dev

No need to enable this package because it’s enabled by default.

You need to do is visit your application in the browser and use the given shortcuts as per your operating system.

  • Windows: CTRL + Shift + X
  • OSX: CMD + Shift + X

This shortcut toggles the X-Ray view, where we can see which view rendered the visual output.

Setup Configurations

You can use the given command to publish the package default configuration file. This file xray.php is located at the config folder.

php artisan vendor:publish --provider=BeyondCode\\ViewXray\\ViewXrayServiceProvider

And file contains some configuration such as:


return [

     * Determines if the Xray package should be enabled.
    'enabled' => env('XRAY_ENABLED', true),

     * If you want to exclude certain views from being processed by Xray,
     * you can list them here. Be aware that the check only applies to the
     * root views that you add here. If these views include other views
     * themselves, they need to be excluded manually.
    'excluded' => [


If, you want to exclude any view from this package then just add view name in the excluded array.

Disable Package

You can disable the Laravel View X-Ray package by setting an environment variable XRAY_ENABLED to false.


You can learn more about Laravel View X-Ray by visiting the GitHub repository. Also, you can found more resources and tutorials here. So please feel free to add comments if any query.

If you like our content, please consider buying us a coffee.
Thank you for your support!
Buy Me a Coffee

Get real time updates directly on you device, subscribe now.

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. AcceptRead More