System library of the Ride framework
System abstraction library of the PHP Ride framework.
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, ...
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.
The file system works with File objects. All file operations are to be called through this class.
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.
You can use the PermissionConverter to convert permissions to different formats.
Check this code sample to see the possibilities of this library:
<?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:
You can use Composer to install this library.
composer require ride/lib-system