Map-based autoloader across php and phar resources

⌈⌋ branch:  Canonic Autoloader


Check-in [a546e623ed]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add php -d update example.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a546e623ede57ee99618f397bcc2a1b1fa8f36fc
User & Date: mario 2014-09-10 22:57:45
Context
2015-01-22
19:33
Introduce addPhar(), fix "const" subarray, keep static list of $instances. check-in: 35d87d3c07 user: mario tags: trunk
2014-09-10
22:57
Add php -d update example. check-in: a546e623ed user: mario tags: trunk
22:57
Note about PHP 5.2 compatibility. check-in: 7c03f0bbee user: mario tags: trunk
Changes

Changes to manpage.1.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
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
.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
also prepares for function autoloading support (far-fetched
future, when php-dev gets a grip).
.P
.VS
By default it scans the directories beneath its location.
The primary installation thus
.I /usr/share/php
and all its contained includes.
.P
.I Not impemented:
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
................................................................................
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.



.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 implictly load the contained classmap.






.SH ENVIRONMENT
Recognized environment variables (as set via
.IB ".htaccess " SetEnv
for instance) in webserver or CLI context.
.TP
.BR AUTOLOADER_UPDATE " (boolean)"
Will enable implicit classmap updates on missed identifier (class)
lookups. Advisable for development setups only.






.SH FORMAT
The default
.B shared.phar
package is a PKZIP archive.


.SH "SEE ALSO"
.BR php (1)
.BR phar (5)







|
|
<


|
|

|







 







>
>
>








>
>
>
>
>
>








>
>
>
>
>
>



|
>
>



8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
..
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
82
.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 it scans the directories beneath its location.
The primary installation in
.I /usr/share/php
thus all globally shared includes.
.P
.I Not impemented:
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
................................................................................
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 implictly load 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
Recognized environment variables (as set via
.IB ".htaccess " SetEnv
for instance) in webserver or CLI context.
.TP
.BR AUTOLOADER_UPDATE " (boolean)"
Will enable implicit classmap updates on missed identifier (class)
lookups. Advisable for development setups only.
.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)