purrweb/yii2-heroku
Composer 安装命令:
composer require purrweb/yii2-heroku
包简介
Generate yii2 environments for easy deployment on heroku
README 文档
README
This extension allows you to generate environment files into your yii2 advanced application for easy deployment on Heroku. The extension may be helpful if you don't have stage or test server and you need to show somebody how your app works. Before using the extension make sure you have a Heroku account and you know how to create an app and work with it.
Installation
php composer.phar require --dev --prefer-dist purrweb/yii2-heroku "*"
or add in composer.json (require-dev section)
"purrweb/yii2-heroku": "*"
Usage
Add the following in console/config/main-local.php:
<?php return [ ... 'controllerMap' => [ 'heroku' => [ 'class' => 'purrweb\heroku\HerokuGeneratorController', ], ], ... ];
Now you can run next console command to generate files that Heroku needs:
$ php yii heroku
You will be asked to overwrite index.php in the environment directory. If you did not change that file you can answer Yes, overwrite. If you did change that file you should merge the file from this extension and file from your application manually. The command will generate 3 files in application root folder and a directory "heroku" with environment files in your environments directory.
In your application root directory you will see new untracked files:
- "Procfile", simple Heroku's Procfile that runs nginx web-server on heroku
- "nginx.conf", simple nginx config that allows backend and fronted apps to work on one Heroku's dyno
- "post-install-cmd.sh", bash script that will start automatically after you do git push on Heroku
Next step you need to add in your composer.json following script section:
"scripts": {
"post-install-cmd": [
"sh post-install-cmd.sh"
]
}
In your environments directory, you can open new files and edit them. After that run "git add" and "git commit" commands manually to add all generated files into your repository. Now you can push into Heroku. If everything goes well, you will be able to follow the URL given by Heroku. To run your yii2 backend app just follow the link: {your app URL}/backend.
If you use third party libraries, don't forget include it into your composer.json file. For example, if you use php5-imagick library, add next line into "require" section in the composer.json:
"ext-imagick": "*"
If you're gonna use database on Heroku (e.g. "cleardb"), make sure that it's properly described in the environments/heroku/common/config/main-local.php (by default this file is configured to connect to a "cleardb" database). If you need to run the "migrate" command, you can do that easily through Heroku's bash. Just run Heroku's bash
$ heroku run bash
and do migrate command
$ php yii migrate
purrweb/yii2-heroku 适用场景与选型建议
purrweb/yii2-heroku 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.84k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2015 年 06 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「deploy」 「extension」 「yii2」 「heroku」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 purrweb/yii2-heroku 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 purrweb/yii2-heroku 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 purrweb/yii2-heroku 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
A custom URL rule class for Yii 2 which allows to create translated URL rules
blueways deployer recipes
The Laragoon utility package
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
A Highly Opinionated Symfony3/4 Deployer Recipe
统计信息
- 总下载量: 9.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-29