VOOZH about

URL: https://nightwatch.laravel.com/docs/start-guide

⇱ Start Guide - Laravel Nightwatch


Documentation Index

Fetch the complete documentation index at: /docs/llms.txt

Use this file to discover all available pages before exploring further.

Skip to main content
Welcome to Nightwatch. This guide will help you set up Nightwatch monitoring for your Laravel application in just a few minutes.

Registering an account

Visit nightwatch.laravel.com and register for a free account. After registering, you’ll be redirected to the organization creation page. From here, you can create a new organization or join an existing one if you have a pending invite.

Creating an organization

For a free account, you can get started with as little as an organization name. You can always upgrade and add more details later.
If you’re joining an existing organization, you’ll need to ask the owner to invite you.

Creating an application

1

Access your dashboard

Go to nightwatch.laravel.com and log in to your account.
2

Create a new application

Click + New Application and provide the following:
  • A name for your application
  • A data region (US, EU or Australia)
  • Details for your default environment (e.g. name, type)
3

Get your environment token

Once your application and its first environment are created, you’ll receive an environment-specific token. This token is required to authenticate the agent and send data to Nightwatch.
You can retrieve this token anytime from the Environments tab in your application settings.

Running the agent

1

Install the package

Add Nightwatch to your Laravel application using Composer:
composer require laravel/nightwatch
2

Add your token

Add your environment’s NIGHTWATCH_TOKEN to your .env file:
NIGHTWATCH_TOKEN=your-api-key
3

Run the agent

The agent must be actively running to collect and send data to Nightwatch. Start the agent using the following Artisan command:
php artisan nightwatch:agent

Verify your connection

After the agent has been running for a few minutes, you will see your data appear in the Nightwatch dashboard.

Disabling Nightwatch

By default, the Nightwatch package will start monitoring your application once installed. You may wish to disable Nightwatch during local development, your test suite runs, or temporarily in other environments. You may disable Nightwatch at any time by setting NIGHTWATCH_ENABLED=false in your environment. The easiest way to do that for local development and your local test suite runs is to set it in your project’s .env file:
.env
NIGHTWATCH_TOKEN=your-api-key
NIGHTWATCH_ENABLED=false
To ensure Nightwatch is disabled wherever you run your tests, you may also want to disable Nightwatch in your phpunit.xml file:
phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
 <!-- ... -->
 <php>
 <env name="APP_ENV" value="testing"/>
 <env name="NIGHTWATCH_ENABLED" value="false"/>
 <!-- ... -->
 </php>
</phpunit>

Support

Need help? Visit our support page for more information.

Was this page helpful?

⌘I
Assistant
Responses are generated using AI and may contain mistakes.