Package Data | |
---|---|
Maintainer Username: | JustSteveKing |
Maintainer Contact: | vedran@treblle.com (Vedran Cindrić) |
Package Create Date: | 2022-03-05 |
Package Last Update: | 2024-12-20 |
Home Page: | https://www.treblle.com/ |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-24 15:07:41 |
Package Statistics | |
---|---|
Total Downloads: | 276 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 4 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
Treblle makes it super easy to understand what’s going on with your APIs and the apps that use them. Just by adding Treblle to your API out of the box you get:
Install Treblle for Lumen via Composer by running the following command in your console:
composer require treblle/treblle-lumen
Installing Lumen packages is a lot more complicated than Laravel packages and requires a few manual steps. If you want a completely automated process please use Laravel.
The first thing we need to do is publish the Treblle config file and make sure Lumen loads it. To do that we need to copy/paste the package config file like so:
mkdir -p config
cp vendor/treblle/treblle-lumen/config/treblle.php config/treblle.php
Now we can have Lumen load the config file. We do that by adding a new line in bootstrap/app.php
, under the Register Config Files section, like so:
$app->configure('treblle');
We need to register the Treblle middleware in Lumen. To do add a new line of code to bootstrap/app.php
, under the Register Middleware section, like so:
$app->routeMiddleware([
'treblle' => Treblle\Middlewares\TreblleMiddleware::class
]);
You need an API KEY and PROJECT ID for Treblle to work. You can get those by creating a FREE account on https://treblle.com and your first project. You'll get the two keys which you need to add to your .ENV file like so:
TREBLLE_API_KEY=YOUR_API_KEY
TREBLLE_PROJECT_ID=YOUR_PROJECT_ID
Now that we've installed the package we simply need to enable it. Open routes/web.php and assign the treblle middleware to your API routes like so:
$router->group(['prefix' => 'api', 'middleware' => 'treblle'], function () use ($router) {
$router->get('users', ['uses' => 'UserController@index']);
$router->post('users', ['uses' => 'TestController@store']);
});
You're all set. Next time someone makes a request to your API you will see it in real-time on your Treblle dashboard alongside other features like: auto-generated documentation, error tracking, analytics and API quality scoring.
You can configure Treblle using just .ENV variables:
TREBLLE_IGNORED_ENV=local,dev,test
Define which environments Treblle should NOT LOG at all. By default, Treblle will log all environments except local, dev and test. If you want to change that you can define your own ignored environments by using a comma separated list, or allow all environments by leaving the value empty.
Treblle masks sensitive information from both the request and response data as well as the request headers data before it even leaves your server. The following parameters are automatically masked: password, pwd, secret, password_confirmation, cc, card_number, ccv, ssn, credit_score.
You can customize this list by editing the array configuration file.
If you have problems of any kind feel free to reach out via https://treblle.com or email vedran@treblle.com, and we'll do our best to help you out.
Copyright 2022, Treblle Limited. Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php