|
Phar::mountMount an external path or file to a virtual location within the phar archive Description
final public static void Phar::mount(string
$pharPath , string $externalPath )Much like the unix file system concept of mounting external devices to paths within the directory tree, Phar::mount allows referring to external files and directories as if they were inside of an archive. This allows powerful abstraction such as referring to external configuration files as if they were inside the archive. Parameters
Return ValuesNo return. PharException is thrown on failure. Errors/ExceptionsThrows PharException if any problems occur mounting the path. Examples
Example #1 A Phar::mount example The following example shows accessing an external configuration file as if it were a path within a phar archive. First, the code inside of a phar archive:
Next the external code used to mount the configuration file:
Another method is to put the mounting code inside the stub of the phar archive. Here is an example of setting up a default configuration file if no user configuration is specified:
...and the code externally to load this phar archive:
|