PHP code example of kielabokkie / laravel-conceal
1. Go to this page and download the library: Download kielabokkie/laravel-conceal 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/ */
kielabokkie / laravel-conceal example snippets
$data = [
'username' => 'wouter',
'api_key' => 'secret'
];
$hide = ['api_key'];
$output = conceal($data, $hide);
print_r($output);
// Outputs: ['username' => 'wouter', 'api_key' => '********']
return [
/*
* Array of keys that will be concealed automatically.
*/
'defaults' => [
'password',
'password_confirmation',
]
];
$data = [
'username' => 'wouter',
'password' => 'secret'
];
$output = conceal($data);
print_r($output);
// Outputs: ['username' => 'wouter', 'password' => '********']
$data = [
'api_key' => 'secret'
];
$output = conceal($data, ['api_key']);
print_r($output);
// Outputs: ['api_key' => '********']
$data = new Collection([
'username' => 'wouter',
'password' => 'secret'
]);
$output = conceal($data);
print_r($output->toArray());
// Outputs: ['username' => 'wouter', 'password' => '********']
$data = [
'password' => 'secret',
'nextlevel' => [
'password' => 'secret',
]
];
$output = conceal($data);
print_r($output);
// Outputs: ['password' => '********', 'nextlevel' => ['password' => '********']]
use Kielabokkie\LaravelConceal\Facades\Concealer;
$data = [
'password' => 'secret'
];
$output = Concealer::conceal($data);
print_r($output);
// Outputs: ['password' => '********']
bash
php artisan vendor:publish --provider="Kielabokkie\LaravelConceal\ConcealServiceProvider"