Treblle for Lumen

Learn how to get started with Treblle using our lumen package in less than 2 minutes on any new or existing API

Step 1

Install Treblle via Composer

Run command

composer require treblle/treblle-lumen

You can ⭐ our Github repo to stay up to date with new updates

View on Github

Go to Step 2
Step 2

Load Treblle config

Copy package config files

mkdir -p config cp vendor/treblle/treblle-lumen/config/treblle.php config/treblle.php

Edit bootstrap/app.php

/*
|--------------------------------------------------------------------------
| Register Config Files
|--------------------------------------------------------------------------
|
| Now we will register the "app" configuration file. If the file exists in
| your configuration directory it will be loaded; otherwise, we'll load
| the default version. You may register other files below as needed.
|
*/
 
$app->configure('treblle');
Go to Step 3
Step 3

Register Treblle middleware

Edit bootstrap/app.php

/*
|--------------------------------------------------------------------------
| Register Middleware
|--------------------------------------------------------------------------
|
| Next, we will register the middleware with the application. These can
| be global middleware that run before and after each request into a
| route or middleware that'll be assigned to some specific routes.
|
*/
 
$app->routeMiddleware([
'treblle' => Treblle\Middlewares\TreblleMiddleware::class
]);
Go to Step 4
Step 4

Configure Treblle

Edit .env

// Add this to your .env file
TREBLLE_API_KEY=YOUR_API_KEY
TREBLLE_PROJECT_ID=YOUR_PROJECT_ID

HEADS UP: You need to create an account to get your API KEY and PROJECT ID

Go to Step 5
Step 5

Enable Treblle on your API

Edit routes/web.php

$router->group(['prefix' => 'api', 'middleware' => 'treblle'], function () use ($router) {
$router->get('users', ['uses' => '[email protected]']);
$router->post('users', ['uses' => '[email protected]']);
});
Go to Step 6
Done

🎉 You're all set! 🎉

You and your team just got these amazing features:

  • Real-time API monitoring
  • Auto-generated API documenation
  • API analytics
  • Powerfull request search and filtering
  • 1-click API testing
  • Real-time problem detection
  • OpenAPI Specification support
  • Location based request tracking
  • Smart URL parameters detection
  • and many more..
Optional

Configuration params

Disable monitoring on specific environments

// Add this to your .env file
TREBLLE_IGNORED_ENV=local,dev,test

Define the Laravel environments you want Treblle to ignore

Mask sensitive data

return [
 
// other config params...
 
// Edit masked_fields array in config/treblle.php
'masked_fields' => [
'password',
'pwd',
'secret',
'password_confirmation',
'cc',
'card_number',
'ccv',
'ssn',
'credit_score',
'api_key',
],
];

PRO TIP: Data is masked before it even leaves your server

Need help getting started with Treblle on your API?

Book a meeting