Code Monkey home page Code Monkey logo

yii2-composer's Introduction

Yii 2 Composer Installer

This is the composer installer for Yii framework 2.0 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-file.

Latest Stable Version Total Downloads

Usage

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

{
    "type": "yii2-extension",
    "require": {
        "yiisoft/yii2": "*"
    },
    ...
}

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. The method allows 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"
            ]
        }
    }
}

yii2-composer's People

Contributors

qiangxue avatar cebe avatar samdark avatar klimov-paul avatar creocoder avatar resurtm avatar tonydspaniard avatar ragazzo avatar lucianobaraglia avatar suralc avatar pmoust avatar schmunk42 avatar slavcodev avatar larryullman avatar kartik-v avatar bwoester avatar crtlib avatar tarasio avatar gevik avatar gonimar avatar sensorario avatar rob006 avatar egorpromo avatar ext4yii avatar rinatio avatar lancecoder avatar mohorev avatar andersonamuller avatar nineinchnick avatar qiansen1386 avatar

Watchers

杜鹏 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.