Map-based autoloader across php and phar resources

⌈⌋ branch:  Canonic Autoloader

Artifact Content

Artifact 97ac2bb692334b98628170e5b19a82af5c39ee86:

  • File manpage.1 — part of check-in [c956af642c] at 2015-01-22 19:34:07 on branch trunk — Typos in manpage. (user: mario size: 2207)

.TH shared.phar "0.3.3 - September 2014" "BSD/Linux" "User Manuals"
shared.phar \- Canonic PHP Autoloader
.I php
.B shared.phar
.RB [ path ,
.IR ... ]
shared.phar is a map-based autoloader for
.B *.php
scripts and
.B *.phar
collections. It self-contains the generated class map and
all updating logic.
On invocation from the command line it scans the directories
beneath its location. The primary installation in /usr/share/php
thus all globally shared includes.
\fBNot implemented:\fR
future versions will allow to specify a list of directories
as arguments to include in the scanning process. Hereby
.IR ./ relative
path names will be kept relative to 
.B shared.phar
itself. While absolute
.IR / paths
are never transformed.
.IP \(bu 2
Traverses any directory structure, but skips .hidden dirs,
while scanning *.php scripts.
.IP \(bu 2
Stores identifiers (classes, functions) case-insensitively
for consistency with PHP.
.IP \(bu 2
Phar collections are traversed as well, and references
stored with relative paths.
.IP \(bu 2
It also prepares for function autoloading support (far-fetched
future, if ever php-dev gets a grip).
Activating the autoloader within PHP applications is as simple as calling
.BR include_once (
.I """shared.phar""
.RB ) ;
Which will implicitly activate the contained classmap.
If there's no binfmt registered for .phar files, then the php interpreter
must be prefixed for invoking the update mechanism:
.IB "php " "-d" "phar.readonly" "=" "0 " ./shared.phar
Will enable implicit classmap updates on missed identifier (class)
lookups when run in webserver context. Advisable for development setups.
Best set via
.IB ".htaccess " SetEnv
or in VirtualHost section.
.IR phar.readonly " (boolean)"
Needs to be set to
.I 0
to allow updating of phars.
The default
.B shared.phar
package is a PKZIP archive. It's comprised of a
.IR .phar/stub.php ", " autoload.update.php ", "
and may be split up for current 0.3.x versions.
.BR php (1)
.BR phar (5)