Onion, The fast approach to make/install/bundle PEAR packages for PHP.
Onion is able to generate a PEAR2-compatible package.xml file from a very simple config file, you can release your PEAR package very quickly!
And through Onion, you can also install PEAR dependencies into local bundle (just like Ruby Bundler).
Onion is not target to replace other package manager, its target is to make current PEAR ecosystem easier.
Let's keep hard long PEAR package.xml away! :-)
- Build PEAR, PECL package easily, quickly.
- Install PEAR dependencies into local project directory. (like Ruby Bundler)
nrk:
its own package.ini file looks simple enough to edit and maintain.
It's been super-easy to get up and running and I haven't encountered any real
problems. Onion looks good already.
2011-12-18 https://github.com/nrk/predis/commit/104cd1eae7f3fb2bff3ccd3193c3e31b8502af56
- PHP 5.3
- simplexml extension
- DOMDocument extension
- curl
[package]
name = Onion
desc = package description
version = 0.0.1
author = Yo-An Lin <[email protected]>
channel = pear.php.net
Get and install onion:
$ curl -s http://install.onionphp.org/ | sh
Please make sure your directory structure:
src/ # contains php source code
doc/ # documentation files (optional)
tests/ # unit testing files
Fill your package.ini
file:
[package]
name = Onion
desc = package description
version = 0.0.1
channel = pear.php.net
author = Yo-An Lin <[email protected]>
To generate a package.xml 2.0 spec file for PEAR and build a PEAR package, just run:
$ onion build --pear
Then Your PEAR package is out!
The --pear
flag is optional.
See:
$ onion help build
[package]
name = Onion
desc = package description
version = 0.0.1
author = Yo-An Lin <[email protected]>
channel = pear.php.net
[require]
php = 5.3
pearinstaller = 1.4
pear.php.net/PackageName = 0.0.1
Install PEAR dependencies into vendor/ directory
$ onion install
An example, we use onion to compile our executable file onion
:
$ onion compile \
--executable \
--classloader \
--bootstrap scripts/onion.embed \
--lib src \
--lib ../CLIFramework/src \
--lib ../GetOptionKit/src \
--output onion
Simple put a extension attribute:
[package]
...
extension = yourext
please checkout doc/SPEC.md
version naming standard from PEAR group: http://pear.php.net/manual/en/rfc.version-naming.standard.php
There are many built-in roles so that you don't need to define it by yourself, built-in roles are:
- src/ php role
- docs/ doc role
- tests/ test role
- *.md doc role
But you can add custom roles by yourself.
[roles]
path/to/data = data
path/to/library = php
path/to/doc = doc
[package]
name = your package name
desc = package description
summary = .... # optional, default to Description
homepage = http://your.web.com # optional
license = PHP # optional, default to PHP
version = 0.0.1
version.api = 0.0.1 # optional, default to "version"
channel = pear.php.net # default
; lead developer
author = Yo-An Lin <[email protected]>
; other authors
authors[] = Yo-An Lin <[email protected]>
authors[] = Yo-An Lin
; contributors ...
contributors[] = ... # optional
maintainers[] = ... # optional
[require]
php = '> 5.3'
pearinstaller = '1.4.1'
; pear package based on channel
pear.channel.net/package = 1.1
; pear package based on URI
package = http://www.example.com/Foo-1.3.0
package = conflicts
extension/reflection =
extension/ctype =
extension/pcre =
[roles]
; mapping files to role
your_script = bin
; glob is supported.
*.md = doc
*.php = php
[optional remoteshell]
hint = Add support for Remote Shell Operations
channel/test = 0.1
channel/foo = 0.2
extensions[] = ssh2
Make a fork from Onion and clone it:
$ git clone [email protected]:c9s/Onion.git
$ cd Onion
Run onion to install dependencies
$ ./onion install
To run unit tests:
$ phpunit
To test onion command:
$ scripts/onion help
To compile onion:
$ scripts/compile.sh
Current install
command does not support PEAR special features like:
- PEAR Task: like replace content, rename ... etc
- PECL installation
If you have questions about Onion or want to help out, come and join us in the #onion-dev channel on irc.freenode.net
.