PHP code example of bgeneto / ci4-secrets

1. Go to this page and download the library: Download bgeneto/ci4-secrets 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/ */

    

bgeneto / ci4-secrets example snippets


use Bgeneto\Secrets\Secrets;

$secrets = new secrets();
$secrets->store('new_secret', 'new_secret_value');

// OR simply
$secrets = Services::secrets();
$secrets->retrieve('new_secret');

    // app/Models/SecretModel.php
    namespace App\Models;

    use Bgeneto\Secrets\Models\BaseSecretModel;

    class SecretModel extends BaseSecretModel
    {
        // Add your custom traits and methods here
        use \App\Traits\MyTrait; // Example
    }

    

        /**
         * The model class to use for managing secrets.
         *
         * @var string
         */
        public $modelClass = '\App\Models\SecretModel';
    
sh
php spark key:generate
sh
php spark secrets:publish