定制 janisto/yii2-environment 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

janisto/yii2-environment

最新稳定版本:1.3.0

Composer 安装命令:

composer require janisto/yii2-environment

包简介

Environment class for Yii 2, used to set configuration for console and web apps depending on the server environment.

README 文档

README

Environment class for Yii 2, used to set configuration for console and web apps depending on the server environment.

Software License Build Status Code Quality Code Coverage Packagist Version Total Downloads

Installation

If you do not have Composer, you may install it by following the instructions at getcomposer.org.

You can then install this package using the following command:

php composer.phar require "janisto/yii2-environment" "*"

or add

"janisto/yii2-environment": "*"

to the require section of your application's composer.json file.

Usage

web index.php

<?php
require(dirname(__DIR__) . '/vendor/autoload.php');

$env = new \janisto\environment\Environment(dirname(__DIR__) . '/config');
$env->setup();
(new yii\web\Application($env->web))->run();

or if you have multiple configuration locations

<?php
require(dirname(__DIR__) . '/vendor/autoload.php');

$env = new \janisto\environment\Environment([
    dirname(__DIR__) . '/common/config',
    dirname(__DIR__) . '/backend/config'
]);
$env->setup();
(new yii\web\Application($env->web))->run();

console yii

#!/usr/bin/env php
<?php

require(__DIR__ . '/vendor/autoload.php');

// fcgi doesn't have STDIN and STDOUT defined by default
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w'));

$env = new \janisto\environment\Environment(__DIR__ . '/config');
$env->setup();
$exitCode = (new yii\console\Application($env->console))->run();
exit($exitCode);

Use yii

export YII_ENV='dev' && ./yii

Documentation

See examples/.

Contributing

Please see CONTRIBUTING for details.

Credits

License

Public domain. Please see License File for more information.

统计信息

  • 总下载量: 34.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 21
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 20
  • Watchers: 8
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: public
  • 更新时间: 2014-10-24