Howto: Package Dependencies
There are not many out there, but if you happen to be one of those, you can bundle your dependencies with your ext.phar.
Have the dependencies listed in your PECL package.xml and just create the extension PHARs of the dependencies prior running pharext
in the root of your source directory.
Example with pecl_http
Install pharext
:
█ http.git<git=master...origin/master>$ composer require --dev m6w6/pharext
Output:
Using version ~3.0 for m6w6/pharext
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing m6w6/pharext (v2.0.0)
Downloading: 100%
Writing lock file
Generating autoload files
Package raphf
dependency:
█ http.git<git=master...origin/master>$ ./vendor/bin/pharext -vps ../raphf.git
Output:
Creating phar /var/folders/_m/gz8t5ljn43d0hbk5x0cfs12r0000gn/T/54feb22f9bc16.phar ...
Packaging pharext_install.php
Packaging ../raphf.git//CREDITS
Packaging ../raphf.git//LICENSE
Packaging ../raphf.git//Doxyfile
Packaging ../raphf.git//config.m4
Packaging ../raphf.git//config.w32
Packaging ../raphf.git//php_raphf.h
Packaging ../raphf.git//php_raphf.c
Packaging ../raphf.git/tests/http001.phpt
Packaging ../raphf.git/tests/http002.phpt
Packaging ../raphf.git/tests/http003.phpt
Packaging ../raphf.git/tests/http004.phpt
Created executable phar /var/folders/_m/gz8t5ljn43d0hbk5x0cfs12r0000gn/T/54feb22f9bc16.phar
Finalizing ./raphf-1.0.5.ext.phar ... OK
Package propro
dependency:
█ http.git<git=master...origin/master>$ ./vendor/bin/pharext -vps ../propro.git
Output:
Creating phar /var/folders/_m/gz8t5ljn43d0hbk5x0cfs12r0000gn/T/54feb2390ceb0.phar ...
Packaging pharext_install.php
Packaging ../propro.git//CREDITS
Packaging ../propro.git//LICENSE
Packaging ../propro.git//Doxyfile
Packaging ../propro.git//config.m4
Packaging ../propro.git//config.w32
Packaging ../propro.git//php_propro.h
Packaging ../propro.git//php_propro.c
Packaging ../propro.git/tests/001.phpt
Packaging ../propro.git/tests/002.phpt
Created executable phar /var/folders/_m/gz8t5ljn43d0hbk5x0cfs12r0000gn/T/54feb2390ceb0.phar
Finalizing ./propro-1.0.1.ext.phar ... OK
Now package pecl_http
itself:
█ http.git<git=master...origin/master>$ ./vendor/bin/pharext -vps .
Output:
Creating phar /var/folders/_m/gz8t5ljn43d0hbk5x0cfs12r0000gn/T/54feb254d44ff.phar ...
Packaging /Users/Mike/Sources/http.git/raphf-1.0.5.ext.phar
Packaging /Users/Mike/Sources/http.git/propro-1.0.1.ext.phar
Packaging pharext_install.php
Packaging .//LICENSE
Packaging [...lots of files that have been stripped from output...]
Created executable phar /var/folders/_m/gz8t5ljn43d0hbk5x0cfs12r0000gn/T/54feb254d44ff.phar
Finalizing ./pecl_http-2.4.0dev.ext.phar ... OK
Installing
Installing the PHAR should then look similar to:
█ http.git<git=master...origin/master>$ ./pecl_http-2.4.0dev.ext.phar -i /etc/php.ini -s
Output:
Installing propro-1.0.1.ext.phar ...
Running phpize ... OK
Running configure ... OK
Running make ... OK
Running install ...
Password:OK
Extension already activated
Cleaning up /var/folders/_m/gz8t5ljn43d0hbk5x0cfs12r0000gn/T/propro-1.0.1.ext.phar.54feb4e5b3610 ...
Installing raphf-1.0.5.ext.phar ...
Running phpize ... OK
Running configure ... OK
Running make ... OK
Running install ... OK
Extension already activated
Cleaning up /var/folders/_m/gz8t5ljn43d0hbk5x0cfs12r0000gn/T/raphf-1.0.5.ext.phar.54feb4e5b3a43 ...
Installing pecl_http-2.4.0dev.ext.phar ...
Running phpize ... OK
Running configure ... OK
Running make ... OK
Running install ... OK
Extension already activated
Cleaning up /var/folders/_m/gz8t5ljn43d0hbk5x0cfs12r0000gn/T/pecl_http-2.4.0dev.ext.phar.54feb4e5b3279 ...