PHP code example of usman-ahmed / laravel-response-encryption

1. Go to this page and download the library: Download usman-ahmed/laravel-response-encryption 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/ */

    

usman-ahmed / laravel-response-encryption example snippets


'providers' => [
    // Other Service Providers

    \UsmanAhmed\LaravelResponseEncryption\ResponseEncryptionServiceProvider::class,
],

use \UsmanAhmed\LaravelResponseEncryption\Http\Middleware\EncryptResponses;

Route::get('/api/unencrypted', function () {
    return response()->json(['status' => 'ok']);
})->withoutMiddleware([EncryptResponses::class]);

'except' => [
    'api/v1/public/*',
    'health',
    'ping',
    'countries/list',

    ...(env('APP_ENV') === 'local' ? ['_debugbar/*'] : []),
],

use UsmanAhmed\LaravelResponseEncryption\Facades\ResponseEncryption;

public function boot()
{
    ResponseEncryption::excludeRoutes([
        'api/legacy/v' . config('app.api_version'),
    ]);
}

return [

    'enabled' => env('RESPONSE_ENCRYPTION_ENABLED', true),

    'content_types' => [
        'application/json',
    ],

    'except' => [
        'api/v1/public/*',
        'health',
        'ping',
        'countries/list',
    ],
];