operating-system/permission

Wrapper for retrieving information about operating system permissions with native PHP functions

v1.1.2 2018-12-19 14:51 UTC

This package is auto-updated.

Last update: 2020-02-19 17:39:42 UTC


README

Wrapper for retrieving information about operating system permissions with native PHP functions

Installation

composer require operating-system/permission

Usage

Instantiate permission:

use OperatingSystem\Permission\Permission;

$permission = new Permission(stat(__FILE__)['mode']);

Get permission information:

// Mode
$permission->getMode();             // 33188
// Permissions
$permission->canUserRead();         // TRUE
$permission->canUserWrite();        // TRUE
$permission->canUserExecute();      // FALSE
$permission->canGroupRead();        // TRUE
$permission->canOwnerGroupWrite();  // FALSE
$permission->canGroupExecute();     // FALSE
$permission->canOthersRead();       // TRUE
$permission->canOthersWrite();      // FALSE
$permission->canOthersExecute();    // FALSE
// Additonal permissions
$permission->hasSetUidBit();        // FALSE
$permission->hasSetUidBit();        // FALSE
$permission->hasStickyBit();        // FALSE

Testing

$ ./vendor/bin/phpunit

License

The MIT License (MIT). Please see License File for more information.