Helpers for working with files and directories.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the WireFileTools class also inherits all the methods and properties of: Wire.

Common / Advanced / Compiler


Name Return Summary  
$files->chmod(string $path) bool Change the read/write mode of a file or directory, consistent with ProcessWire's configuration settings
$files->copy(string $src, string $dst) bool Copy all files recursively from one directory ($src) to another directory ($dst)
$files->include(string $filename) bool Include a PHP file passing it all API variables and optionally your own specified variables
$files->mkdir(string $path) bool Create a directory that is writable to ProcessWire and uses the defined $config chmod settings
$files->render(string $filename) string or bool Given a filename, render it as a ProcessWire template file
$files->rmdir(string $path) bool Remove a directory and optionally everything within it (recursively)
$files->send(string $filename) (nothing) Send the contents of the given filename to the current http connection
$files->unzip(string $file, string $dst) array Unzips the given ZIP file to the destination directory
$files->zip(string $zipfile, $files) array Creates a ZIP file


Name Return Summary  
$files->getNamespace(string $file) string Get the namespace used in the given .php or .module file
$files->tempDir($name) WireTempDir Return a new temporary directory/path ready to use for files


Name Return Summary  
$files->compile(string $file) string Compile the given file using ProcessWire’s file compiler
$files->compileInclude(string $file) (nothing) Compile and include() the given file
$files->compileIncludeOnce(string $file) (nothing) Compile and include_once() the given file
$files->compileRequire(string $file) (nothing) Compile and require() the given file
$files->compileRequireOnce(string $file) (nothing) Compile and require_once() the given file

Additional methods and properties

In addition to the methods and properties above, WireFileTools also inherits the methods and properties of these classes: