PHPackages                             yiisoft/yii2-composer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. yiisoft/yii2-composer

ActiveComposer-plugin[Framework](/categories/framework)

yiisoft/yii2-composer
=====================

The composer plugin for Yii extension installer

2.0.11(1y ago)8628.8M—4.3%3120BSD-3-ClausePHPCI passing

Since Dec 1Pushed 3mo ago17 watchersCompare

[ Source](https://github.com/yiisoft/yii2-composer)[ Packagist](https://packagist.org/packages/yiisoft/yii2-composer)[ GitHub Sponsors](https://github.com/yiisoft)[ Fund](https://opencollective.com/yiisoft)[ RSS](/packages/yiisoft-yii2-composer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (16)Used By (20)

 [ ![](https://camo.githubusercontent.com/f57d6c3ed05f6cfe55f6b070dafcccd2a5b14f5f0484b53cb2f76b2e4c98a02e/68747470733a2f2f676574636f6d706f7365722e6f72672f696d672f6c6f676f2d636f6d706f7365722d7472616e73706172656e74332e706e67) ](https://getcomposer.org/)

Yii 2 Composer Installer
========================

[](#yii-2-composer-installer)

This is the composer installer for [Yii framework 2.0](https://www.yiiframework.com) extensions. It implements a new composer package type named `yii2-extension`, which should be used by all Yii 2 extensions if they are distributed as composer packages.

For license information check the [LICENSE](LICENSE.md)-file.

[![Latest Stable Version](https://camo.githubusercontent.com/7f6bbf0b0c57c805c5c008b0eae66f4d63b04db878dd5587af780dd27e795558/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f796969322d636f6d706f7365722f762f737461626c652e706e67)](https://packagist.org/packages/yiisoft/yii2-composer)[![Total Downloads](https://camo.githubusercontent.com/2d7bc0a04fcba081999035a2d21a4aa0b8ab24a9d031b15ed1dff7b4e1524a8a/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f796969322d636f6d706f7365722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/yiisoft/yii2-composer)[![Build status](https://github.com/yiisoft/yii2-composer/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-composer/actions?query=workflow%3Abuild)[![codecov](https://camo.githubusercontent.com/46ea14299bf5aba1b411c7a905d87da8874b90db87b349339a8341d034c40361/68747470733a2f2f636f6465636f762e696f2f67682f796969736f66742f796969322d636f6d706f7365722f67726170682f62616467652e737667)](https://codecov.io/gh/yiisoft/yii2-composer)

Usage
-----

[](#usage)

The Yii 2 Composer Installer is automatically installed with when installing the framework via Composer.

To use Yii 2 composer installer, simply set the package `type` to be `yii2-extension` in your `composer.json`, like the following:

```
{
    "type": "yii2-extension",
    "require": {
        "yiisoft/yii2": "~2.0.0"
    },
    ...
}
```

You may specify a bootstrapping class in the `extra` section. The `init()` method of the class will be executed each time the Yii 2 application is responding to a request. For example,

```
{
    "type": "yii2-extension",
    ...,
    "extra": {
        "bootstrap": "yii\\jui\\Extension"
    }
}
```

The `Installer` class also implements a static method `postCreateProject()` that can be called after a Yii 2 project is created, through the `post-create-project-cmd` composer script. A similar method exists for running tasks after each `composer install` call, which is `postInstall()`. These methods allow to run other `Installer` class methods like `setPermission()` or `generateCookieValidationKey()`, depending on the corresponding parameters set in the `extra` section of the `composer.json` file. For example,

```
{
    "name": "yiisoft/yii2-app-basic",
    "type": "project",
    ...
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::postCreateProject"
        ],
        "post-install-cmd": [
            "yii\\composer\\Installer::postInstall"
        ]
    },
    "extra": {
        "yii\\composer\\Installer::postCreateProject": {
            "setPermission": [
                {
                    "runtime": "0777",
                    "web/assets": "0777",
                    "yii": "0755"
                }
            ]
        },
        "yii\\composer\\Installer::postInstall": {
            "copyFiles": [
                {
                    "config/templates/console-local.php": "config/console-local.php",
                    "config/templates/web-local.php": "config/web-local.php",
                    "config/templates/db-local.php": "config/db-local.php",
                    "config/templates/cache.json": ["runtime/cache.json", true]
                }
            ],
            "generateCookieValidationKey": [
                "config/web-local.php"
            ]
        }
    }
}
```

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance64

Regular maintenance activity

Popularity64

Solid adoption and visibility

Community46

Growing community involvement

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~292 days

Recently: every ~603 days

Total

15

Last Release

459d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/261a6249c6f605f3956a2fae40fbb813f6b2e1e6f2bf806180c851a965426e54?d=identicon)[cebe](/maintainers/cebe)

![](https://www.gravatar.com/avatar/fc29e4e7068a00fe9b9db37b8aadda1db6020adcacef810461e47b99c2b150e6?d=identicon)[samdark](/maintainers/samdark)

![](https://www.gravatar.com/avatar/23416c58e0dce33a8369451a4ca0e28666373594027debc10184b37ade6a926b?d=identicon)[qiangxue](/maintainers/qiangxue)

---

Top Contributors

[![qiangxue](https://avatars.githubusercontent.com/u/993322?v=4)](https://github.com/qiangxue "qiangxue (1907 commits)")[![cebe](https://avatars.githubusercontent.com/u/189796?v=4)](https://github.com/cebe "cebe (756 commits)")[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (634 commits)")[![klimov-paul](https://avatars.githubusercontent.com/u/1482054?v=4)](https://github.com/klimov-paul "klimov-paul (320 commits)")[![creocoder](https://avatars.githubusercontent.com/u/896494?v=4)](https://github.com/creocoder "creocoder (148 commits)")[![resurtm](https://avatars.githubusercontent.com/u/100198?v=4)](https://github.com/resurtm "resurtm (123 commits)")[![Ragazzo](https://avatars.githubusercontent.com/u/1748844?v=4)](https://github.com/Ragazzo "Ragazzo (75 commits)")[![lucianobaraglia](https://avatars.githubusercontent.com/u/374554?v=4)](https://github.com/lucianobaraglia "lucianobaraglia (44 commits)")[![suralc](https://avatars.githubusercontent.com/u/730039?v=4)](https://github.com/suralc "suralc (42 commits)")[![pmoust](https://avatars.githubusercontent.com/u/2493339?v=4)](https://github.com/pmoust "pmoust (36 commits)")[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (26 commits)")[![slavcodev](https://avatars.githubusercontent.com/u/757721?v=4)](https://github.com/slavcodev "slavcodev (20 commits)")[![LarryUllman](https://avatars.githubusercontent.com/u/1674823?v=4)](https://github.com/LarryUllman "LarryUllman (18 commits)")[![kartik-v](https://avatars.githubusercontent.com/u/3592619?v=4)](https://github.com/kartik-v "kartik-v (16 commits)")[![tarasio](https://avatars.githubusercontent.com/u/1010578?v=4)](https://github.com/tarasio "tarasio (12 commits)")[![crtlib](https://avatars.githubusercontent.com/u/4428231?v=4)](https://github.com/crtlib "crtlib (12 commits)")[![bwoester](https://avatars.githubusercontent.com/u/309565?v=4)](https://github.com/bwoester "bwoester (12 commits)")[![gevik](https://avatars.githubusercontent.com/u/434535?v=4)](https://github.com/gevik "gevik (10 commits)")[![sensorario](https://avatars.githubusercontent.com/u/820248?v=4)](https://github.com/sensorario "sensorario (9 commits)")[![gonimar](https://avatars.githubusercontent.com/u/756571?v=4)](https://github.com/gonimar "gonimar (9 commits)")

---

Tags

composerhacktoberfestyiiyii2composeryii2extension installer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yiisoft-yii2-composer/health.svg)

```
[![Health](https://phpackages.com/badges/yiisoft-yii2-composer/health.svg)](https://phpackages.com/packages/yiisoft-yii2-composer)
```

###  Alternatives

[yiisoft/config

Composer plugin and a library for config assembling

34368.9k27](/packages/yiisoft-config)[yidas/yii2-bower-asset

Bower Assets for Yii 2 app provided via Composer repository

331.2M30](/packages/yidas-yii2-bower-asset)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
