Giter VIP home page Giter VIP logo

treblle-laravel's Introduction

Treblle for Laravel

Treblle for Laravel

Latest Version PHP Version Total Downloads MIT Licence

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:

  • Real-time API monitoring and logging
  • Auto-generated API docs with OAS support
  • API analytics
  • Quality scoring
  • One-click testing
  • API management on the go
  • Supports Laravel Vapor and Laravel Octane
  • and more...

Requirements

  • PHP 8.1+
  • Laravel 9+

Installation

Install Treblle for Laravel via Composer by running the following command in your terminal:

composer require treblle/treblle-laravel

Getting started

You can get started with Treblle directly from your Artisan console. Just type in the following command in your terminal:

php artisan treblle:start

The command guides you through a process and allows you to create an account, login to your existing account, create a new project and get all the .ENV keys you need to start using Treblle.

You can also visit our website https://treblle.com and create a FREE account to get your API key and Project ID. Once you have to simply add them to your .ENV file:

TREBLLE_API_KEY=YOUR_API_KEY
TREBLLE_PROJECT_ID=YOUR_PROJECT_ID

Enabling Treblle on your API

Open the routes/api.php and add the Treblle middleware to either a route group like so:

Route::middleware(['treblle'])->group(function () {

  // YOUR API ROUTES GO HERE
  Route::prefix('samples')->group(function () {
    Route::get('{uuid}', [SampleController::class, 'view']);
    Route::post('store', [SampleController::class, 'store']);
  });

});

or to an individual route like so:

Route::group(function () {
  Route::prefix('users')->group(function () {

    // IS LOGGED BY TREBLLE
    Route::get('{uuid}', [UserController::class, 'view'])->middleware('treblle');

    // IS NOT LOGGED BY TREBLLE
    Route::post('{uuid}/update', [UserController::class, 'update']);
  });
});

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.

Configuration options

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.

Masked fields

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 your configuration file. If you did not published your configuration file, run this command first:

php artisan vendor:publish --tag=treblle-config

This will create a file at "config/treblle.php". Then, open this file and tweak the masked fields:

return [
    // ...

    /*
     * Define which fields should be masked before leaving the server
     */
    'masked_fields' => [
        'password',
        'pwd',
        'secret',
        'password_confirmation',
        'cc',
        'card_number',
        'ccv',
        'ssn',
        'credit_score',
        'api_key',
    ],
];

Support

If you have problems of any kind feel free to reach out via https://treblle.com or email [email protected], and we'll do our best to help you out.

License

Copyright 2022., Treblle Limited. Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

treblle-laravel's People

Contributors

cindreta avatar lucasmichot avatar bhushan avatar juststeveking avatar khalyomede avatar strotgen avatar stephenjude avatar ziming avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.