# 开始
欢迎!这份指南将帮助你在项目中使用PHP-DI.
在开始之前,你需要知道什么是[依赖注入](understanding-di.md).
如果你不知道,这一整篇文章就是为了它: 了解依赖注入.
## 安装
Install PHP-DI with [Composer](http://getcomposer.org/doc/00-intro.md):
```
composer require php-di/php-di
```
PHP-DI 需要 PHP 5.5以上版本.
## 基础应用
### 1. 使用依赖注入
第一,让我们写使用依赖注入的代码而不用其考虑PHP-DI
```php
class Mailer
{
public function mail($recipient, $content)
{
// send an email to the recipient
}
}
```
```php
class UserManager
{
private $mailer;
public function __construct(Mailer $mailer)
{
$this->mailer = $mailer;
}
public function register($email, $password)
{
// The