phar.createdefaultstub(3) php man page | unix.com

Man Page: phar.createdefaultstub

Operating Environment: php

Section: 3

PHAR.CREATEDEFAULTSTUB(3)						 1						 PHAR.CREATEDEFAULTSTUB(3)

Phar::createDefaultStub - Create a phar-file format specific stub

SYNOPSIS
finalpublicstatic string Phar::createDefaultStub ([string $indexfile], [string $webindexfile])
DESCRIPTION
This method is intended for creation of phar-file format-specific stubs, and is not intended for use with tar- or zip-based phar archives. Phar archives contain a bootstrap loader, or stub written in PHP that is executed when the archive is executed in PHP either via include: <?php include 'myphar.phar'; ?> php myphar.phar This method provides a simple and easy method to create a stub that will run a startup file from the phar archive. In addition, different files can be specified for running the phar archive from the command line versus through a web server. The loader stub also calls Phar.interceptFileFuncs(3) to allow easy bundling of a PHP application that accesses the file system. If the phar extension is not present, the loader stub will extract the phar archive to a temporary directory and then operate on the files. A shutdown function erases the tempo- rary files on exit.
RETURN VALUES
Returns a string containing the contents of a customized bootstrap loader (stub) that allows the created Phar archive to work with or without the Phar extension enabled.
ERRORS
/EXCEPTIONS Throws UnexpectedValueException if either parameter is longer than 400 bytes.
EXAMPLES
Example #1 A Phar.createDefaultStub(3) example <?php try { $phar = new Phar('myphar.phar'); $phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php')); } catch (Exception $e) { // handle errors } ?>
SEE ALSO
Phar.setStub(3), Phar.getStub(3). PHP Documentation Group PHAR.CREATEDEFAULTSTUB(3)
Related Man Pages
pharfileinfo.delmetadata(3) - php
phardata(3) - php
phar.getstub(3) - php
pharfileinfo.getmetadata(3) - php
pharfileinfo.chmod(3) - php
Similar Topics in the Unix Linux Community
Pass variable to php from html form
php files are downloaded
How to Integrate DropBox in PHP Web Application?
Default PHP Sites
Search for / and insert \ for every instance