Map-based autoloader across php and phar resources

⌈⌋ ⎇ branch:  Canonic Autoloader


Update of "AUTOLOADER_UPDATE"

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

Overview

Artifact ID: 86c05822ddf105dc46095febae138b16012f8c9a
Page Name:AUTOLOADER_UPDATE
Date: 2014-02-12 02:18:43
Original User: mario
Mimetype:text/x-markdown
Next 05b438f2398694592d578cf862fd85f9f9f4dca3
Content

automatic classmap updating

The disadvantage of map-based autoloaders is the rebuilding step.

It however only comes into play for development. While the update is undeniably easy, it's also redundant mostly.

You can declare a locally-installed shared.phar autoloader to update itself on undefined and unlocalizable classes (= newly added code).

.htaccess

With

SetEnv AUTOLOADER_UPDATE 1

in your .htaccess you can trigger the auto update run.

In code

Or just override it prior inclusion of the autoloader:

$_SERVER["AUTOLOADER_UPDATE"] = TRUE;
include_once("./vendor/shared.phar");

Adapt the stub

Some installations may wish to update the shared.phar`s stub itself.

It contains a setting:

    // Try to rebuild map on missing identifiers.
    public $auto_update = 0;

Which could be predeclared to 1 obviously.

Needs unpacking and repacking the phar just once.