Closes #240: Explain how to manage PEAR dependencies with Composer

This commit is contained in:
Phil Sturgeon
2013-04-12 12:12:36 -04:00
parent d51edbad92
commit 04ae71568b
2 changed files with 45 additions and 1 deletions

View File

@@ -33,7 +33,51 @@ installing. See the [Using channel docs][4] for more information on this topic.
* [Learn about PEAR][1]
### Handling PEAR dependencies with Composer
If you are already using [Composer][5] and you would like to install some PEAR code too, you can use
Composer to handle your PEAR dependencies. This example will install code from `pear2.php.net`:
{% highlight json %}
{
"repositories": [
{
"type": "pear",
"url": "http://pear2.php.net"
}
],
"require": {
"pear-pear2/PEAR2_Text_Markdown": "*",
"pear-pear2/PEAR2_HTTP_Request": "*"
}
}
{% endhighlight %}
The first section `"repositories"` will be used to let Composer know it should "initialise"
(or "discover" in PEAR terminology) the pear repo. Then the require section will prefix the package
name like this:
> pear-channel/Package
The "pear" prefix is hardcoded to avoid any conflicts, as a pear channel could be the same as another packages vendor name for example, then the channel short name (or full URL) can be used
to reference which channel the package is in.
When this code is installed it will be available in your vendor directory and automatically
available through the Comoser autoloader:
> vendor/pear-pear2.php.net/PEAR2_HTTP_Request/pear2/HTTP/Request.php
To use this PEAR package simply reference it like so:
{% highlight php %}
$request = new pear2\HTTP\Request();
{% endhighlight %}
* [Learn more about using PEAR with Composer][6]
[1]: http://pear.php.net/
[2]: http://pear.php.net/manual/en/installation.getting.php
[3]: http://pear.php.net/packages.php
[4]: http://pear.php.net/manual/en/guide.users.commandline.channels.php
[5]: /#composer_and_packagist
[6]: http://getcomposer.org/doc/05-repositories.md#pear

View File

@@ -26,7 +26,7 @@
* [PagodaBox](https://pagodabox.com/)
* [AppFog](https://appfog.com/)
* [Heroku](https://heroku.com)
(PHP support is undocumented but based on stable Facebook partnership [[link]](http://net.tutsplus.com/tutorials/php/quick-tip-deploy-php-to-heroku-in-seconds/))
(PHP support is undocumented but based on stable Facebook partnership [link](http://net.tutsplus.com/tutorials/php/quick-tip-deploy-php-to-heroku-in-seconds/))
* [fortrabbit](http://fortrabbit.com/)
* [Engine Yard Orchestra PHP Platform](http://www.engineyard.com/products/orchestra/)
* [Red Hat OpenShift Platform](http://www.redhat.com/products/cloud-computing/openshift/)