Installing Laravel Telescope only in development environment

James Bhatta
Nov 26, 2020

Pull the package via composer:

composer require laravel/telescope --dev

Publish its assets:

php artisan telescope:install

Run database migration:

php artisan migrate

In /config/app.php remove the following line from Application Service Providers array list:

App\Providers\TelescopeServiceProvider::class,

No add the following in your app/Providers/AppServiceProvider.php:

use App\Providers\TelescopeServiceProvider;

And in the register() method:

if ($this->app->isLocal()) {
$this->app->register(TelescopeServiceProvider::class);
}

That’s all and you are good to go!!

--

--

James Bhatta

Manoj Bhatta. PHP developer often working in Laravel. Loved PHP just because I cant wait until compiler processes my code.