From 371e113a91e4ba54e9a4f6e5a3c5b4b7405a24ac Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 8 Jan 2014 23:12:03 -0500 Subject: [PATCH] Added a note about VersionEye for Composer --- _posts/04-02-01-Composer-and-Packagist.md | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/_posts/04-02-01-Composer-and-Packagist.md b/_posts/04-02-01-Composer-and-Packagist.md index fc67e0b..8cafc09 100644 --- a/_posts/04-02-01-Composer-and-Packagist.md +++ b/_posts/04-02-01-Composer-and-Packagist.md @@ -36,16 +36,18 @@ The path `$HOME/local/bin` (or a directory of your choice) should be in your `$P When you come across documentation that states to run Composer as `php composer.phar install`, you can substitute that with: composer install + +This section will assume you have installed composer globally. ### How to Define and Install Dependencies -Composer keeps track of your project's dependencies in a file called `composer.json`. You can manage it by hand if you like, or use Composer itself. The `php composer.phar require` command adds a project dependency and if you don't have a `composer.json` file, one will be created. Here's an example that adds [Twig][2] as a dependency of your project. Run it in your project's root directory where you've downloaded `composer.phar`: +Composer keeps track of your project's dependencies in a file called `composer.json`. You can manage it by hand if you like, or use Composer itself. The `composer require` command adds a project dependency and if you don't have a `composer.json` file, one will be created. Here's an example that adds [Twig][2] as a dependency of your project. - php composer.phar require twig/twig:~1.8 + composer require twig/twig:~1.8 -Alternatively the `php composer.phar init` command will guide you through creating a full `composer.json` file for your project. Either way, once you've created your `composer.json` file you can tell Composer to download and install your dependencies into the `vendors/` directory. This also applies to projects you've downloaded that already provide a `composer.json` file: +Alternatively the `composer init` command will guide you through creating a full `composer.json` file for your project. Either way, once you've created your `composer.json` file you can tell Composer to download and install your dependencies into the `vendors/` directory. This also applies to projects you've downloaded that already provide a `composer.json` file: - php composer.phar install + composer install Next, add this line to your application's primary PHP file; this will tell PHP to use Composer's autoloader for your project dependencies. @@ -62,14 +64,20 @@ Composer creates a file called `composer.lock` which stores the exact version of This is most useful when you define your version requirements flexibly. For instance a version requirement of ~1.8 means "anything newer than 1.8.0, but less than 2.0.x-dev". You can also use the `*` wildcard as in `1.8.*`. Now Composer's `php composer.phar update` command will upgrade all your dependencies to the newest version that fits the restrictions you define. +### Update Notifcations + +To receive notifications about new version releases you can sign up for [VersionEye][3], a web service that can monitor +your GitHub and BitBucket accounts for `composer.json` files and send emails with new package releases. + ### Checking your dependencies for security issues -The [Security Advisories Checker][3] is a web service and a command-line tool, both will examine your `composer.lock` file and tell you if you need to update any of your dependencies. +The [Security Advisories Checker][4] is a web service and a command-line tool, both will examine your `composer.lock` file and tell you if you need to update any of your dependencies. -* [Learn about Composer][4] +* [Learn about Composer][5] [1]: http://packagist.org/ [2]: http://twig.sensiolabs.org -[3]: https://security.sensiolabs.org/ -[4]: http://getcomposer.org/doc/00-intro.md +[3]: https://www.versioneye.com/ +[4]: https://security.sensiolabs.org/ +[5]: http://getcomposer.org/doc/00-intro.md