WireTempDir::init() method

Initialize temporary directory

This method should only be called once per instance of this class. If you specified a $name argument in the constructor, then you should not call this method because it will have already been called.

Usage

// basic usage
$string = $wireTempDir->init();

// usage with all arguments
$string = $wireTempDir->init($name = '', string $basePath = '');

Arguments

NameType(s)Description
name (optional)string, object

Recommend providing the object that is using the temp dir, but can also be any string

basePath (optional)string

Base path where temp dirs should be created. Omit to use default (recommended).

Return value

string

Returns the root of the temporary directory. Use the get() method to get a dir for use.

Exceptions

Method can throw exceptions on error:

  • WireException - if given a $root that doesn't exist


WireTempDir methods and properties

API reference based on ProcessWire core version 3.0.244

Latest news

  • ProcessWire Weekly #559
    The 559th issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!
    Weekly.pw / 25 January 2025
  • ProcessWire 3.0.244 new main/master version
    ProcessWire 3.0.244 is our newest main/master/stable version. It's been more than a year in the making and is packed with tons of new features, issue fixes, optimizations and more. This post covers all the details.
    Blog / 18 January 2025
  • Subscribe to weekly ProcessWire news

I just love the easy and intuitive ProcessWire API. ProcessWire rocks!” —Jens Martsch, Web developer