diff --git a/reference/phar/Phar/addEmptyDir.xml b/reference/phar/Phar/addEmptyDir.xml new file mode 100644 index 0000000000..90b767efd3 --- /dev/null +++ b/reference/phar/Phar/addEmptyDir.xml @@ -0,0 +1,101 @@ + + + + + Phar::addEmptyDir + Add an empty directory to the phar archive + + + &reftitle.description; + + boolPhar::addEmptyDir + stringdirname + + &phar.write; + + + With this method, an empty directory is created with path dirname + + + + + &reftitle.parameters; + + + + dirname + + + The name of the empty directory to create in the phar archive + + + + + + + + + &reftitle.returnvalues; + + no return value, exception is thrown on failure. + + + + + &reftitle.examples; + + + A <function>Phar::addEmptyDir</function> example + +addEmptyDir('/full/path/to/file'); + // demonstrates how this file is stored + $b = $a['full/path/to/file']->isDir(); +} catch (Exception $e) { + // handle errors here +} +?> +]]> + + + + + + + &reftitle.seealso; + + + PharData::addEmptyDir + Phar::addFile + Phar::addFromString + + + + + + + + diff --git a/reference/phar/Phar/addFile.xml b/reference/phar/Phar/addFile.xml new file mode 100644 index 0000000000..ad8b667ae7 --- /dev/null +++ b/reference/phar/Phar/addFile.xml @@ -0,0 +1,122 @@ + + + + + Phar::addFile + Add a file from the filesystem to the phar archive + + + &reftitle.description; + + boolPhar::addFile + stringfile + stringlocalname + + &phar.write; + + + With this method, any file or URL can be added to the phar archive. If + the optional second parameter localname is specified, + the file will be stored in the archive with that name, otherwise the + file parameter is used as the path to store within + the archive. URLs must have a localname or an exception is thrown. + + + + + &reftitle.parameters; + + + + file + + + Full or relative path to a file on disk to be added + to the phar archive. + + + + + localname + + + Path that the file will be stored in the archive. + + + + + + + + + &reftitle.returnvalues; + + no return value, exception is thrown on failure. + + + + + &reftitle.examples; + + + A <function>Phar::addFile</function> example + +addFile('/full/path/to/file'); + // demonstrates how this file is stored + $b = $a['full/path/to/file']->getContent(); + + $a->addFile('/full/path/to/file', 'my/file.txt'); + $c = $a['my/file.txt']->getContent(); + + // demonstrate URL usage + $a->addFile('http://www.example.com', 'example.html'); +} catch (Exception $e) { + // handle errors here +} +?> +]]> + + + + + + + &reftitle.seealso; + + + Phar::offsetSet + PharData::addFile + Phar::addFromString + Phar::addEmptyDir + + + + + + + + diff --git a/reference/phar/Phar/addFromString.xml b/reference/phar/Phar/addFromString.xml new file mode 100644 index 0000000000..a2a42e5340 --- /dev/null +++ b/reference/phar/Phar/addFromString.xml @@ -0,0 +1,117 @@ + + + + + Phar::addFromString + Add a file from the filesystem to the phar archive + + + &reftitle.description; + + boolPhar::addFromString + stringlocalname + stringcontents + + &phar.write; + + + With this method, any string can be added to the phar archive. + The file will be stored in the archive with localname as its + path. + + + + + &reftitle.parameters; + + + + localname + + + Path that the file will be stored in the archive. + + + + + contents + + + The file contents to store + + + + + + + + + &reftitle.returnvalues; + + no return value, exception is thrown on failure. + + + + + &reftitle.examples; + + + A <function>Phar::addFromString</function> example + +addFromString('path/to/file.txt', 'my simple file'); + $b = $a['path/to/file.txt']->getContent(); + + // to add contents from a stream handle for large files, use offsetSet() + $c = fopen('/path/to/hugefile.bin'); + $a['largefile.bin'] = $c; + fclose($c); +} catch (Exception $e) { + // handle errors here +} +?> +]]> + + + + + + + &reftitle.seealso; + + + Phar::offsetSet + PharData::addFromString + Phar::addFile + Phar::addEmptyDir + + + + + + + + diff --git a/reference/phar/PharData/addEmptyDir.xml b/reference/phar/PharData/addEmptyDir.xml new file mode 100644 index 0000000000..82fcb926bf --- /dev/null +++ b/reference/phar/PharData/addEmptyDir.xml @@ -0,0 +1,100 @@ + + + + + PharData::addEmptyDir + Add an empty directory to the tar/zip archive + + + &reftitle.description; + + boolPharData::addEmptyDir + stringdirname + + + + With this method, an empty directory is created with path dirname + + + + + &reftitle.parameters; + + + + dirname + + + The name of the empty directory to create in the phar archive + + + + + + + + + &reftitle.returnvalues; + + no return value, exception is thrown on failure. + + + + + &reftitle.examples; + + + A <function>PharData::addEmptyDir</function> example + +addEmptyDir('/full/path/to/file'); + // demonstrates how this file is stored + $b = $a['full/path/to/file']->isDir(); +} catch (Exception $e) { + // handle errors here +} +?> +]]> + + + + + + + &reftitle.seealso; + + + Phar::addEmptyDir + PharData::addFile + PharData::addFromString + + + + + + + + diff --git a/reference/phar/PharData/addFile.xml b/reference/phar/PharData/addFile.xml new file mode 100644 index 0000000000..156a7cf80b --- /dev/null +++ b/reference/phar/PharData/addFile.xml @@ -0,0 +1,121 @@ + + + + + PharData::addFile + Add a file from the filesystem to the tar/zip archive + + + &reftitle.description; + + boolPhar::addFile + stringfile + stringlocalname + + + + With this method, any file or URL can be added to the tar/zip archive. If + the optional second parameter localname is specified, + the file will be stored in the archive with that name, otherwise the + file parameter is used as the path to store within + the archive. URLs must have a localname or an exception is thrown. + + + + + &reftitle.parameters; + + + + file + + + Full or relative path to a file on disk to be added + to the phar archive. + + + + + localname + + + Path that the file will be stored in the archive. + + + + + + + + + &reftitle.returnvalues; + + no return value, exception is thrown on failure. + + + + + &reftitle.examples; + + + A <function>PharData::addFile</function> example + +addFile('/full/path/to/file'); + // demonstrates how this file is stored + $b = $a['full/path/to/file']->getContent(); + + $a->addFile('/full/path/to/file', 'my/file.txt'); + $c = $a['my/file.txt']->getContent(); + + // demonstrate URL usage + $a->addFile('http://www.example.com', 'example.html'); +} catch (Exception $e) { + // handle errors here +} +?> +]]> + + + + + + + &reftitle.seealso; + + + PharData::offsetSet + Phar::addFile + PharData::addFromString + PharData::addEmptyDir + + + + + + + + diff --git a/reference/phar/PharData/addFromString.xml b/reference/phar/PharData/addFromString.xml new file mode 100644 index 0000000000..b2a69bec1a --- /dev/null +++ b/reference/phar/PharData/addFromString.xml @@ -0,0 +1,116 @@ + + + + + PharData::addFromString + Add a file from the filesystem to the tar/zip archive + + + &reftitle.description; + + boolPharData::addFromString + stringlocalname + stringcontents + + + + With this method, any string can be added to the tar/zip archive. + The file will be stored in the archive with localname as its + path. + + + + + &reftitle.parameters; + + + + localname + + + Path that the file will be stored in the archive. + + + + + contents + + + The file contents to store + + + + + + + + + &reftitle.returnvalues; + + no return value, exception is thrown on failure. + + + + + &reftitle.examples; + + + A <function>PharData::addFromString</function> example + +addFromString('path/to/file.txt', 'my simple file'); + $b = $a['path/to/file.txt']->getContent(); + + // to add contents from a stream handle for large files, use offsetSet() + $c = fopen('/path/to/hugefile.bin'); + $a['largefile.bin'] = $c; + fclose($c); +} catch (Exception $e) { + // handle errors here +} +?> +]]> + + + + + + + &reftitle.seealso; + + + PharData::offsetSet + Phar::addFromString + PharData::addFile + PharData::addEmptyDir + + + + + + + +