System library of the Ride framework
System abstraction library of the PHP Ride framework., (*1)
The System class in an abstraction of the underlying server system. It offers easy access to the underlying file system. You can also use it to execute commands or check the type of system, the connected client, ..., (*2)
The FileSystem interface is an abstraction of the underlying file system. A Windows file system is handled different then a Unix file system. This interface makes it possible to program transparantly for both systems., (*3)
The file system works with File objects. All file operations are to be called through this class., (*4)
The FileBrowser interface is to create a transparant file structure. You can use it to request relative files without knowing how your files are organized. On top of that, you can request the application and the public directory., (*5)
You can use the PermissionConverter to convert permissions to different formats., (*6)
Check this code sample to see the possibilities of this library:, (*7)
<?php 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);
For more examples, you can check the following implementation of this library: - ride/app, (*8)
You can use Composer to install this library., (*9)
composer require ride/lib-system