PHP code example of treblle / treblle-api-tools-laravel

1. Go to this page and download the library: Download treblle/treblle-api-tools-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

treblle / treblle-api-tools-laravel example snippets


use Treblle\Tools\Http\Enums\Headers\AuthScheme;
use Treblle\Tools\Http\Headers\Authorization;

$auth = new Authorization(
    type: AuthScheme::BEARER,
    credentials: 'YOUR_API_TOKEN_HERE',
);

// Turn the header into an array
$array = $auth->toArray();
//[
//    'type' => AuthScheme::BEARER,
//    'credentials' => 'YOUR_API_TOKEN_HERE'
//]

// Turn the header into a header
$header = $auth->toHeader();
//[
//    'Authorization' => 'Bearer YOUR_API_TOKEN_HERE',
//]