PHP code example of ride / lib-system

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

    

ride / lib-system example snippets




use ride\library\system\System;

$system = new System();

// check the type of operating system
$system->isUnix();
$system->isWindows();

// check the client
$system->isCli();
$system->getClient(); // ip address or username when in cli

// execute a command
$output = $system->execute('whoami');

// file system abstraction
$fileSystem = $system->getFileSystem();

$dir = $fileSystem->getFile('/path/to/dir');
$dir->isDirectory();
$dir->isReadable();
$files = $dir->read();

$file = $fileSystem->getFile('/path/to/file');
$file->exists();
$file->getModificationTime();
$file->setLock(true);
$content = $file->read();

$destination = $dir->getChild($file->getName());
$destination = $destination->getCopyFile();

$file->copy($destination);