定制 frostiede/silex-environment-serviceprovider 二次开发

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

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

frostiede/silex-environment-serviceprovider

Composer 安装命令:

composer require frostiede/silex-environment-serviceprovider

包简介

README 文档

README

Build Status Code Climate

ServiceProvider for Silex which empowers use of environments like prod, dev etc. Environments can be changed using an environment variable.

Installation

$ composer require frostiede/silex-environment-serviceprovider

Afterwards, register the ServiceProvider:

$app->register(new EnvironmentServiceProvider());

Usage

You can now use $app['env'] to get the current environment. Also, you can use $app['cli'] to detect whether the current application is invoked by command line (in this case, it is set to true, false otherwise).

CLI

When invoking any command from CLI (e.g. using the Command extension), you should prepend the target environment:

$ APP_ENV=dev php bin/console your:command

Webserver

Create two separate PHP endpoint files (index.php and dev.php) and set your environment variable according to the file. For example, dev.php should contain putenv("APP_ENV=dev") to make all requests from dev.php run in dev-environment.

Note: Ensure dev.php is not accessible in production!

Configuration

You can set the environment variable which this extension evaluates. As default, APP_ENV is used but you change it to whatever you want using the constructor:

$app->register(new EnvironmentServiceProvider('ENV'));

Contribution

Any help is welcomed. Feel free to create issues and merge requests :-)

License

MIT License

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固