Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 264 lines (172 sloc) 8.655 kb
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
1 # PHP Autoload Builder
034474d @theseer A first version of a readme
authored
2
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
3 The PHP AutoloadBuilder CLI tool **phpab** is a command line application to automate the process of generating
4 an autoload require file with the option of creating static require lists as well as phar archives.
034474d @theseer A first version of a readme
authored
5
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
6 ## Features
034474d @theseer A first version of a readme
authored
7
5f0f3ce @theseer Update readme for release 1.15.0
authored
8 * scan multiple directories recursively in one run, optionally follow symlinks, wildcards or based on composer.json
9 * Cache scan results
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
10 * Template based autoload code
11 * Custom variables for templates
12 * Compatibility mode for PHP 5.2 compliant autoloader
13 * Case sensitive as well as case insensitive classname mapping
14 * Phar generation, with or without compression and openssl key signing
15 * Static require list generation
16 * Linting of generated code
034474d @theseer A first version of a readme
authored
17
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
18 ## Requirements
034474d @theseer A first version of a readme
authored
19
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
20 * PHP 5.3+
21 * Tokenizer (ext/tokenizer)
22 * For PHAR generation support:
23 + ext/phar (write enabled: phar.readonly = Off)
24 + ext/gzip (optional)
25 + ext/bzip2 (optional)
26 + ext/openssl (optional, for phar signing only)
034474d @theseer A first version of a readme
authored
27
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
28 ## Installation
034474d @theseer A first version of a readme
authored
29
5cfb856 @theseer Update README.md
authored
30 ### Executable PHAR
31
056c1aa @corburn Fix typo why=>way
corburn authored
32 The recommended way to install **phpab** is by downloading a fully self contained PHAR archive:
5cfb856 @theseer Update README.md
authored
33
31b0113 @theseer Prepeare for release 1.16.1
authored
34 * [Version 1.16.1](http://phpab.net/phpab-1.16.1.phar) - 196kb
17223da @theseer Update for Reelaes 1.16.0
authored
35 * [Version 1.16.0](http://phpab.net/phpab-1.16.0.phar) - 176kb
36
2377cdd @theseer Release 1.15.1
authored
37 * [Version 1.15.1](http://phpab.net/phpab-1.15.1.phar) - 175kb
5f0f3ce @theseer Update readme for release 1.15.0
authored
38 * [Version 1.15.0](http://phpab.net/phpab-1.15.0.phar) - 175kb
2377cdd @theseer Release 1.15.1
authored
39
2b6877e @theseer Release 1.14.2
authored
40 * [Version 1.14.2](http://phpab.net/phpab-1.14.2.phar) - 169kb
5cfb856 @theseer Update README.md
authored
41 * [Version 1.14.1](http://phpab.net/phpab-1.14.1.phar) - 169kb
42 * [Version 1.14.0](http://phpab.net/phpab-1.14.0.phar) - 169kb
2377cdd @theseer Release 1.15.1
authored
43
5cfb856 @theseer Update README.md
authored
44 * [Version 1.13.1](http://phpab.net/phpab-1.13.1.phar) - 170kb
2377cdd @theseer Release 1.15.1
authored
45
5cfb856 @theseer Update README.md
authored
46 * [Version 1.12.0](http://phpab.net/phpab-1.12.0.phar) - 170kb
2377cdd @theseer Release 1.15.1
authored
47
5cfb856 @theseer Update README.md
authored
48 * [Version 1.11.0](http://phpab.net/phpab-1.11.0.phar) - 170kb
2377cdd @theseer Release 1.15.1
authored
49
5cfb856 @theseer Update README.md
authored
50 * [Version 1.10.3](http://phpab.net/phpab-1.10.3.phar) - 170kb
51 * [Version 1.10.2](http://phpab.net/phpab-1.10.2.phar) - 169kb
52 * [Version 1.10.1](http://phpab.net/phpab-1.10.1.phar) - 185kb
53
54 _Please note:_
55 On Linux/Unix based system the phar needs to be marked executable for direct execution:
56 ```
57 [theseer@rikka ~]$ chmod +x phpab*.phar
58 ```
59
60 Once it is marked as executable, you can run it directly. For instance:
61
62 ```
63 [theseer@rikka ~]$ ./phpab.phar -v
31b0113 @theseer Prepeare for release 1.16.1
authored
64 phpab 1.16.1 - Copyright (C) 2009 - 2014 by Arne Blankerts
d69872e @theseer Fix formatting
authored
65 ```
034474d @theseer A first version of a readme
authored
66
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
67 ## Other Downloads
034474d @theseer A first version of a readme
authored
68
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
69 * [Latest development snapshot](https://github.com/theseer/Autoload/archive/master.zip)</a> (ZIP Archive)
70 * [Releases (Source)](https://github.com/theseer/Autoload/tags)
034474d @theseer A first version of a readme
authored
71
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
72 ## Usage
73 ```
cdb9031 @theseer Fix syntax break
authored
74 phpab [switches] <directory1|/path/to/composer.json> [...<directoryN>]
034474d @theseer A first version of a readme
authored
75
17223da @theseer Update for Reelaes 1.16.0
authored
76 -i, --include File pattern to include (default: *.php)
77 -e, --exclude File pattern to exclude
0b52c16 @theseer formating changes, sample calls added
authored
78
17223da @theseer Update for Reelaes 1.16.0
authored
79 --blacklist Blacklist classname or namespace (wildcards supported)
80 --whitelist Whitelist classname or namespace (wildcards supported)
0b52c16 @theseer formating changes, sample calls added
authored
81
17223da @theseer Update for Reelaes 1.16.0
authored
82 -b, --basedir Basedir for filepaths
83 -t, --template Path to code template to use
0b52c16 @theseer formating changes, sample calls added
authored
84
17223da @theseer Update for Reelaes 1.16.0
authored
85 -o, --output Output file for generated code (default: STDOUT)
86 -p, --phar Create a phar archive (requires -o )
87 --bzip2 Compress phar archive using bzip2 (requires -p) (bzip2 required)
88 --gz Compress phar archive using gzip (requires -p) (gzip required)
89 --key OpenSSL key file to use for signing phar archive (requires -p) (openssl required)
bcddf6b @theseer updated readme
authored
90
17223da @theseer Update for Reelaes 1.16.0
authored
91 -c, --compat Generate PHP 5.2 compatible code
92 -s, --static Generate a static require file
92b7e1e @edorian Update usage information to 1.5
edorian authored
93
17223da @theseer Update for Reelaes 1.16.0
authored
94 -n, --nolower Do not lowercase classnames for case insensitivity
0b52c16 @theseer formating changes, sample calls added
authored
95
17223da @theseer Update for Reelaes 1.16.0
authored
96 -q, --quiet Quiet mode, do not output any processing errors or information
76a39c6 @theseer Update for 1.8.0
authored
97
17223da @theseer Update for Reelaes 1.16.0
authored
98 --cache <file> Enable caching and set filename to use for cache storage
76a39c6 @theseer Update for 1.8.0
authored
99
17223da @theseer Update for Reelaes 1.16.0
authored
100 --follow Enables following symbolic links (not compatible with phar mode)
101 --format Dateformat string for timestamp
102 --linebreak Linebreak style (CR, CRLF or LF, default: LF)
103 --indent String used for indenting or number of spaces (default: 16 (compat 12) spaces)
2bc5b7c @theseer Added 1.9.1 cli params
authored
104
17223da @theseer Update for Reelaes 1.16.0
authored
105 --tolerant Ignore Class Redeclarations in the same file
106 --once Use require_once instead of require when creating a static require file
92b7e1e @edorian Update usage information to 1.5
edorian authored
107
17223da @theseer Update for Reelaes 1.16.0
authored
108 --all Include all files in given directory when creating a phar
109 --alias Specify explicit internal phar alias filename (default: output filename)
110
111 --trusting Do not check mimetype of files prior to parsing (default)
112 --paranoid Do check mimetype of files prior to parsing
113
114 --var name=foo Assign value 'foo' to variable 'name' to be used in (custom) templates
115
116 --lint Run lint on generated code and exit
117 --lint-php PHP binary to use for linting (default: /usr/bin/php or c:\php\php.exe)
118
119 -h, --help Prints this usage information
120 -v, --version Prints the version and exits
cdb9031 @theseer Fix syntax break
authored
121 ```
0b52c16 @theseer formating changes, sample calls added
authored
122
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
123 ### Usage Examples
034474d @theseer A first version of a readme
authored
124
31b0113 @theseer Prepeare for release 1.16.1
authored
125 [theseer@rikka ~]$ phpab -o src/autoload.php -b src composer.json
126
0b52c16 @theseer formating changes, sample calls added
authored
127 [theseer@rikka ~]$ phpab -o src/autoload.inc.php src
034474d @theseer A first version of a readme
authored
128
bcddf6b @theseer updated readme
authored
129 [theseer@rikka ~]$ phpab -c -o src/autoload.inc.php src
130
131 [theseer@rikka ~]$ phpab -o src/core/autoload.inc.php -b src src
132
31b0113 @theseer Prepeare for release 1.16.1
authored
133 [theseer@rikka ~]$ phpab -p -o framework.phar -b src composer.json
134
0b52c16 @theseer formating changes, sample calls added
authored
135 [theseer@rikka ~]$ phpab -p -o framework.phar framework/src
034474d @theseer A first version of a readme
authored
136
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
137 [theseer@rikka ~]$ phpab -p -o framework.phar --bzip2 --key sign.key framework/src
bcddf6b @theseer updated readme
authored
138
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
139 [theseer@rikka ~]$ phpab -b . --tolerant -o zf1_autoload.php -e '*/Test/*' Zend
2881cf0 @edorian Added examples showing how to automate the autoload file generation
edorian authored
140
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
141 ### Automation
2881cf0 @edorian Added examples showing how to automate the autoload file generation
edorian authored
142
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
143 When using *phpab* it is necessary to recreate the autoload file every time a new class is created.
144 This usually also happens after pulling from a repo or when switchting branches.
2881cf0 @edorian Added examples showing how to automate the autoload file generation
edorian authored
145 Using a git `post-checkout` hook placed in `.git/hooks/post-update` this can be automated for most cases.
146
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
147 ####Basic Sample:
2881cf0 @edorian Added examples showing how to automate the autoload file generation
edorian authored
148
149 ```bash
150 #!/bin/bash
151 phpab -c -o src/autoload.inc.php src
152 ```
153
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
154 ####Sample using an `ant build.xml` file.
2881cf0 @edorian Added examples showing how to automate the autoload file generation
edorian authored
155
156 ```bash
157 #!/bin/bash
158 if [ -f build.xml ]; then
159 ant -p | grep phpab > /dev/null
160
161 if [ $? -eq 0 ]; then
162 ant phpab > /dev/null &
163 fi
164 fi
165 ```
f98e288 @theseer Prepare release 1.10.0
authored
166
cc8cbde @theseer phar link
authored
167
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
168 ## Template Variables
169
170 The generated code is based uppon templates provided by default in the templates subfolder. The template engine
171 allows for simply replacing of name based placeholders. For now, only a few default variables are defined
172 but API hooks / CLI parameters exist to set custom variables.
173
174 Known variables are:
175 * ```___CREATED___``` Set to a timestamp of creation, format can be adjusted
176 * ```___CLASSLIST___``` The found list classes in form of a generated map
177 * ```___BASEDIR___``` If a Basedir is set, the value will get removed from the file path and get replaced by __DIR__
178
179 Used in PHAR Mode only:
5cfb856 @theseer Update README.md
authored
180 * ```___PHAR___``` The filename of the generated phar or it's alias when --alias is given (see src/templates/phar.php.tpl)
7cec568 @theseer Recreated README.md to be used as homepage, removed html file
authored
181
182 Custom variables as defined by passing --var name=value via cli are accessed by pre- and appending ___ to it:
183 * ```___name___``` Going to be replaced by the value provided via cli param
2b6877e @theseer Release 1.14.2
authored
184
185
186 ## Changelog
187
31b0113 @theseer Prepeare for release 1.16.1
authored
188 #####Release 1.16.1
189 * Fix minor issues with composer.json handling
190 * define date.timezone to avoid warning (in buildystem) [Remi]
191 * Pear installation now deploys as phar
192
983a9c0 @theseer Prepare Release 1.16.0
authored
193 #####Releaes 1.16.0
194
195 * Added whitelist/blacklist filter for classnames/namespaces
196 * Ensure ext/fileinfo is loaded
197
2377cdd @theseer Release 1.15.1
authored
198 #####Release 1.15.1
199
200 * Fix regression for sorted static require lists
201
5f0f3ce @theseer Update readme for release 1.15.0
authored
202 #####Release 1.15.0
203
204 * Added support for composer.json parsing
205 * Added (optional) caching
206 * Added explicit wildcard support for directory name matching
207 * Changed error messages on unit redeclarations
208 * Some code cleanup and refactoring of internals
209
2b6877e @theseer Release 1.14.2
authored
210 #####Release 1.14.2
211
212 * Fix Trait handling in PHP 5.3
213 * Changed file type for phpunit.xml.dist in pear package
214
215 #####Release 1.14.1
216
217 * Providing --alias in phar mode now sets ___PHAR___ accordingly
218 * Updated DirectoryScanner to 1.3.0
219
220 #####Release 1.14.0
221
222 * Added support for PHP 5.5's classname::class constant to parser
223
224 #####Release 1.13.1
225
226 * Fix Regression, make composer installs work again
227
228 #####Release 1.13.0
229
230 * Added alias support to phar mode building
231
232 #####Release 1.12.0
233
234 * Added composer support (Thanks to HCO)
235 * Made parser code more robust to not crash on invalid names
236
237 #####Release 1.11.0
238
239 * Added support for symlinks (Thanks to Jan Peterson)
240
241 #####Release 1.10.3
242
243 * Support empty indent
244 * Fixed Trait parsing
245
246 #####Release 1.10.2
247
248 * Fixed mode flag handling on phar mode
249
250 #####Release 1.10.1
251
252 * Various regression fixes after internal cleanup
253 * Use git version info for development checkouts
254
255 #####Release 1.10.0
256
257 * Added multi directory support
258 * Added compression support to phar mode
259 * Added support for openssl key signing of phars
260
261 #####Older Releases
262
263 Please refer to the git history log for details
Something went wrong with that request. Please try again.