Map-based autoloader across php and phar resources

⌈⌋ ⎇ branch:  Canonic Autoloader


Check-in [18e74838b1]

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

Overview
Comment:Build in trigger script for DPKG and RPM (untested).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1: 18e74838b1b23544afbaaf8d913fc1d3776aba0e
User & Date: mario 2015-01-22 21:58:36
Context
2015-01-22
21:58
Build in trigger script for DPKG and RPM (untested). Leaf check-in: 18e74838b1 user: mario tags: trunk
20:16
Test build of 0.3.4 check-in: 2c46bdbe2d user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14






15

16














17



#!/bin/sh


#-- bump version
VERSION=$(version  read stub.php  bump show  write::2 stub.php)

#-- create plain phar
xpm -s src -t phar --phar-format zip-gz --phar-stub stub.php -f stub.php

# compact
chmod +x shared.phar
ln -f shared.phar single/
php single/shared.phar









#-- deb + rpm














xpm -s dir -t deb,rpm -n php-shared-autoloader -v $VERSION shared.phar=/usr/share/php/shared.phar










|

|
<



>
>
>
>
>
>

>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
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
#!/bin/sh


#-- bump version
VERSION=$(version  read stub.php  bump show  write::2 stub.php)

#-- create plain phar
xpm -s src -t phar --phar-format zip-gz --phar-stub stub.php --phar-x -f stub.php

# test update classmap

ln -f shared.phar single/
php single/shared.phar

#-- deb + rpm
xpm -s dir -u man -t deb,rpm -f -v $VERSION -n php-shared-autoloader -a all \
--description "Canonic Autoloader / shared.phar
Provides a unified autoloader for /usr/share/php. It scans identifiers
in php scripts, but also makes phar collections first class citizens.
It's easily used from PHP:

   include_once('shared.phar');

It comes with a custom trigger for autoupdating the classmap on dpkg
installation, and falls back on 'phpab' generation if available. Class
identifiers are matched case-insensitively (as PHP expects it).
Also it's preparing for https://wiki.php.net/rfc/function_autoloading
in any future PHP version.

The shared autoloader is self-contained in a phar file, which eases
copying it onto and used in local project directories as well. Can be
split up into its individual scripts (autoloader, updater, classmap)
though." \
--url 'http://fossil.include-once.org/canonic' --category 'php' --vendor 'io' --maintainer 'mario#include-once:org' \
--depends php5-common --deb-suggests phpab \
--deb-interest /usr/share/php/ --after-install=deb_rpm_trigger \
--rpm-trigger-after-install '[-f ^./usr/share/php/]: deb_rpm_trigger' \
shared.phar=/usr/share/php/shared.phar \
manpage.1=/usr/share/man/man1/shared.phar.1 \


Changes to stub.php.

1
2
3
4

5
6
7
8
9
10
11

12
13
14
15
16
17
18
<?php
/**
 * id: shared
 * api: php

 * title: Canonic Autoloader / shared.phar
 * description: Map-based autoloader across .php and .phar resources.
 * version: 0.3.4-9
 * depends: php:phar | php >= 5.3
 * category: cli
 * license: Public Domain
 * url: https://fossil.include-once.org/canonic_autoloader/

 * architecture: all
 * main: .phar/stub.php
 * pack: stub.php=, autoload.update.php, autoload.map.php
 *
 *
 * Self-contained autoloader which provides .php and .phar class
 * loading based on a map.


<

>


|
|



>







1
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**

 * api: php
 * id: shared
 * title: Canonic Autoloader / shared.phar
 * description: Map-based autoloader across .php and .phar resources.
 * version: 0.3.4-31
 * depends: php:phar | php (>= 5.3)
 * category: cli
 * license: Public Domain
 * url: https://fossil.include-once.org/canonic_autoloader/
 * author: mario#include-once:org
 * architecture: all
 * main: .phar/stub.php
 * pack: stub.php=, autoload.update.php, autoload.map.php
 *
 *
 * Self-contained autoloader which provides .php and .phar class
 * loading based on a map.