PHP code example of heliip / laravel-encrypted-responses

1. Go to this page and download the library: Download heliip/laravel-encrypted-responses 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/ */

    

heliip / laravel-encrypted-responses example snippets


use Heliip\LaravelEncryptedResponses\Http\Middleware\EncryptResponse;
use Illuminate\Foundation\Configuration\Middleware;

->withMiddleware(function (Middleware $middleware) {
    $middleware->api(append: [
        EncryptResponse::class,
    ]);
})

Route::middleware('encrypt.responses')->get('/profile', ProfileController::class);

Crypt::encryptString(json_encode(base64_encode(gzcompress(json_encode($data), 9))))

use Heliip\LaravelEncryptedResponses\Facades\EncryptedResponse;

$encrypted = EncryptedResponse::encrypt(['ok' => true]);