Atatus Laravel Middleware helps you to automatically capture of Laravel API calls and sends them to Atatus API analytics, which gives you a comprehensive Laravel API monitoring.

Add Atatus Laravel Middleware steps

  1. Make sure the Atatus PHP agent is installed on your host. If not, follow the installation steps to install the Atatus PHP agent.
  2. Install/Config the atatus middleware Option 1: Install the laravel package using composer.
    Option 2: Add atatus/laravel-atatus to your project’s composer.json file, and install composer.
  3. Add Atatus provider to service provider in config/app.php file.
  4. Add Atatus middleware in your App/Http/Kernel.php file
    If you only want to add tracking for APIs under specific route group, add to your route group, but be sure to remove from the global Middleware stack from above global list.
    To track only certain routes, use route specific middleware setup.
  5. Publish the package config file.
  6. Add configuration in config/atatus.php file.

Configuration options

You can define Atatus configuration options in the config/atatus.php file.

Configuration class (Optional)

Because configuration hooks and functions cannot be placed in the config/atatus.php file, these reside in a PHP class that you create. Set the path to this class using the configClass option. You can define any of the following hooks:
  • identifyUserId
    Type: ($request, $response) => String Optional, a function that takes a $request and $response and return a string for userId. Atatus automatically obtains end userId via $request->user()['id'], In case you use a non standard way of injecting user into $request or want to override userId, you can do so with identifyUserId.
  • identifyCompanyId
    Type: ($request, $response) => String Optional, a function that takes a $request and $response and return a string for companyId.
  • maskRequestBody
    Type: $body => $body Optional, a function that takes a $body, which is an associative array representation of JSON, and returns an associative array with any information removed.
  • maskResponseBody
    Type: $body => $body Optional, same as above, but for Responses.