PHP code example of andrewsuzuki / perm

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

    

andrewsuzuki / perm example snippets


'Andrewsuzuki\Perm\PermServiceProvider',

'Perm' => 'Andrewsuzuki\Perm\Facades\Perm',

// dot notation from base path (see above for configuration)
$perm = Perm::load('profile.andrew');
// ...or absolute path (no extension)
$perm = Perm::load('/path/to/file');

$location   = $perm->get('location');
$location   = $perm->location; // for the first level, you can use magic properties
$first_name = $perm->get('name.first'); // use dot notation for nested values

$locationAndFirstName = $perm->get(array('location', 'name.first'));
// or...
list($location, $firstName) = $perm->get(array('location', 'name.first'));

$config = $perm->all();

$perm->set('timezone', 'UTC');
// for the first level, you can use magic properties
$perm->timezone = 'UTC';

$perm->setIf('timezone', 'UTC');

$perm->set(array('timezone' => 'UTC', 'location' => 'Earth'));

$exists = $perm->has('location'); // true/false
$exists = $perm->has('name.first'); // true/false

$perm->forget('location');

$perm->reset();

$perm->save();

$perm->setFilename('/path/to/new/file');
// then you might set some more values, then call ->save() again, etc...

Perm::load('profile.andrew')->set('name', 'Andrew')->forget('location')->save();

php artisan config:publish hokeo/vessel