Map-based autoloader across php and phar resources

⌈⌋ ⎇ branch:  Canonic Autoloader


Artifact [97ac2bb692]

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)

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
.\"
.TH shared.phar "0.3.3 - September 2014" "BSD/Linux" "User Manuals"
.SH NAME
shared.phar \- Canonic PHP Autoloader
.SH SYNOPSIS
.I php
.B shared.phar
.RB [ path ,
.IR ... ]
.SH DESCRIPTION
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.
.P
.VS
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.
.P
\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.
.SH FEATURES
.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).
.SH PHP USAGE
Activating the autoloader within PHP applications is as simple as calling
.IP 
.BR include_once (
.I """shared.phar""
.RB ) ;
.P
Which will implicitly activate the contained classmap.
.SH MANUAL UPDATES
If there's no binfmt registered for .phar files, then the php interpreter
must be prefixed for invoking the update mechanism:
.IP
.IB "php " "-d" "phar.readonly" "=" "0 " ./shared.phar
.P
.SH ENVIRONMENT
.TP
.IR AUTOLOADER_UPDATE " (boolean)"
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.
.SH PHP.INI SETTINGS
.TP
.IR phar.readonly " (boolean)"
Needs to be set to
.I 0
to allow updating of phars.
.SH FORMAT
The default
.B shared.phar
package is a PKZIP archive. It's comprised of a
.IR .phar/stub.php ", " autoload.update.php ", " autoload.map.php
and may be split up for current 0.3.x versions.
.SH "SEE ALSO"
.BR php (1)
.BR phar (5)