PHP code example of hisman / option

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

    

hisman / option example snippets


'providers' => [
    ...

    Hisman\Option\OptionServiceProvider::class,

    ...
]

'aliases' => [
    ...

    'Option' => Hisman\Option\Facade\Option::class,

    ...
]

// Set option
Option::set('name', 'value');
Option::set('name', [1, 2, 3]);

// Get option
$option = Option::get('name');

// Get option with default value
$option = Option::get('name', 'default value');

// Set option
option()->set('name', 'value');
option()->set('name', [1, 2, 3]);

// Get option
$option = option('name');
$option = option()->get('name');

// Get option with default value
$option = option('name', 'default value');
$option = option()->get('name', 'default value');