PHP code example of unclexo / filestorage

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

    

unclexo / filestorage example snippets




$data = [
    'facebook' => [
        'clientId'      => 'facebookClientId',
        'clientSecret'  => 'facebookClientSecret',
        'redirectUri'   => 'facebookRedirectUri',
    ],
    'twitter' => [
        'clientId'      => 'twitterClientId',
        'clientSecret'  => 'twitterClientSecret',
        'redirectUri'   => 'twitterRedirectUri',
    ],
];


 
$data = [
    'key' => 'value',
    'more_key' => ['key' => 'value'],
];



o\Storage\Storage;

$data = [
    'facebook' => [
        'clientId'      => 'facebookClientId',
        'clientSecret'  => 'facebookClientSecret',
        'redirectUri'   => 'facebookRedirectUri',
    ],
    'twitter' => [
        'clientId'      => 'twitterClientId',
        'clientSecret'  => 'twitterClientSecret',
        'redirectUri'   => 'twitterRedirectUri',
    ],
];

/** File must be writable */
$location = '/home/username/data/storage.txt';

Storage::create($data, $location);



o\Storage\Storage;

$location = '/home/username/data/storage.txt';

Storage::getInstance($location);



Storage::get('facebook'); /** returns */

[
    'clientId'      => 'facebookClientId',
    'clientSecret'  => 'facebookClientSecret',
    'redirectUri    => 'facebookRedirectUri',
]



Storage::set(string $key, mixed $value);



Storage::update(string $key, array $array);



Storage::has(string $key);



Storage::all();



Storage::remove(string $key);



Storage::clear();



Storage::delete();