Site icon Student Projects Live

Laravel Telescope – Beginner Notes

Laravel Telescope - Beginner Notes

Think of Laravel Telescope as a security camera for your Laravel application.

It helps you see:

Telescope is mainly used by developers while building and debugging applications.


Check Laravel First

If Laravel is already installed, go to Step 2.

If Laravel is already installed and your database is ready, you can go to Step 3.


Step 1: Install Laravel First

Before using Telescope, you need a Laravel project.

What you need first

Make sure these are installed on your computer:

Check if PHP is installed

Open Terminal or Command Prompt and run:

php -v

If PHP is installed, you will see the version number.

Check if Composer is installed

Run:

composer -V

If Composer is installed, you will see its version number.

Create a new Laravel project

Run this command:

composer create-project laravel/laravel my-project

What happens?

Laravel will be downloaded and installed into a folder named my-project.

Go into the project folder

cd my-project

Check that Laravel is working

Run:

php artisan --version

You should see something like:

Laravel Framework 12.x.x

If you see this, Laravel is installed correctly.


Step 2: Configure MySQL Database

Before using Telescope, Laravel must be connected to your MySQL database.

Create a MySQL database

Open your MySQL tool, such as:

Create a new database.

Example database name:

laravel_telescope

Open the .env file

Inside your Laravel project, find the .env file.

This file stores database settings.

Update the database settings

Find these lines:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_telescope
DB_USERNAME=root
DB_PASSWORD=

What do these mean?

Save the file

After editing .env, save it.

Test the database connection

Run:

php artisan migrate

If the database is connected correctly, Laravel will create its tables successfully.

If you see an error, check:


Step 3: Install Laravel Telescope

Run:

composer require laravel/telescope --dev

What happens?

Composer downloads Telescope and adds it to your project.

Wait until installation completes successfully.


Step 4: Install Telescope Files

Run:

php artisan telescope:install

What happens?

Laravel creates:

You should see success messages.


Step 5: Create Telescope Database Tables

Run:

php artisan migrate

What happens?

Laravel creates Telescope tables in your database.

Example tables:

These tables store Telescope data.


Step 6: Start Laravel Server

Run:

php artisan serve

Output:

INFO Server running on http://127.0.0.1:8000

Keep this terminal open.


Step 7: Open Telescope Dashboard

Open your browser.

Visit:

http://127.0.0.1:8000/telescope

You should see the Telescope dashboard.

Congratulations! Telescope is running.


Step 8: Generate Some Activity

Open another browser tab and visit:

http://127.0.0.1:8000

Refresh the page a few times.

Why?

Because Telescope only shows activity after something happens.


Step 9: Refresh Telescope

Go back to:

http://127.0.0.1:8000/telescope

Refresh the page.

Now you should see:

being recorded.


Step 10: View Requests

Click:

Requests

You can see:

Example:

GET /
Status: 200
Duration: 25ms

Step 11: View Database Queries

Click:

Queries

You can see SQL statements executed by Laravel.

Example:

select * from users

Useful for finding slow queries.


Step 12: View Errors

Create an intentional error.

Example route:

Route::get('/error', function () {
    throw new Exception('Test Error');
});

Visit:

http://127.0.0.1:8000/error

Now check Telescope → Exceptions.

You will see:

Test Error

and its details.


Step 13: View Logs

Add a log entry:

use Illuminate\Support\Facades\Log;

Log::info('Testing Telescope Logs');

Refresh the page.

Open Telescope → Logs.

You should see:

Testing Telescope Logs

Step 14: Clear Telescope Data

Sometimes Telescope stores lots of data.

Clear old records:

php artisan telescope:clear

Step 15: Pause Telescope Recording

You can stop recording:

php artisan telescope:pause

Resume recording:

php artisan telescope:resume

Common Commands

Install Laravel project:

composer create-project laravel/laravel my-project

Check Laravel version:

php artisan --version

Configure MySQL database:

Edit the .env file

Install Telescope:

composer require laravel/telescope --dev

Install Telescope Files:

php artisan telescope:install

Run Migrations:

php artisan migrate

Start Server:

php artisan serve

Clear Telescope Data:

php artisan telescope:clear

Pause Telescope:

php artisan telescope:pause

Resume Telescope:

php artisan telescope:resume

Easy Memory Trick

Think of Telescope as:

Laravel App
      ↓
Telescope Watches Everything
      ↓
Shows Information on Dashboard
      ↓
Developer Finds Problems Faster

Formula

Install Laravel
   ↓
Configure MySQL
   ↓
Install Telescope
   ↓
Migrate
   ↓
Serve
   ↓
Open /telescope
   ↓
Generate Activity
   ↓
Inspect Results

That’s the complete beginner workflow for Laravel Telescope.

Exit mobile version