定制 yarcode/yii2-app-yarcode 二次开发

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

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

yarcode/yii2-app-yarcode

Composer 安装命令:

composer create-project yarcode/yii2-app-yarcode

包简介

Yii 2 YarCode Project Template

README 文档

README

Build Status

Yii 2 YarCode Project - is a skeleton Yii 2 application.

Differences from yii2-app-advanced

In contrast to the yii2-app-advanced this template out of the box has:

Requirements

The minimum requirement by this project template that your Web server supports PHP 7+.

Installation

Install composer.

You can then install this project template using the following command:

composer create-project --prefer-dist yarcode/yii2-app-yarcode yarcode 
сd yarcode 
php init 

Copy .env file

cp .env.example .env

Configure .env and apply migrations. Make sure that you are properly configured to connect to the database.

php yii migrate 

The template installation is now complete.

Quality Control

Travis CI

To automatically build and test the application in a template, use Travis CI. The configuration is located in the file .travis.yml in the project's root directory.

In the configuration file added PHP Coding Standards Fixer.

PHP Coding Standards Fixer

This tool allows us to automatically check the project code for compliance with standards and rules.

The configuration is in the file .php_cs in the project's root directory.

Execute the command to verify the code for compliance with the PSR-2 standard

vendor/bin/php-cs-fixer fix -v --dry-run 

Vrutalization

This template supports Docker technology

Base usage

Build your containers

docker-compose build

Create volume

docker volume create --name=yiidock_postgres_data

Init and apply migration:

cp docker-compose.override-example.yml docker-compose.override.yml
docker-compose run --rm workspace composer install
docker-compose run --rm workspace php init
docker-compose run --rm yii migrate

Start the containers:

docker-compose up -d

Now app must be working:

You can also start the services individually. Example, start only backend:

docker-compose up -d nginx-backend 

Test environment

Tests are in the test catalogs {application}/tests. They are developed with Codeception PHP Testing Framework. By default there are 2 test suites for each applications(api, frontend, backend):

  • unit
  • functional

For more information about testing Yii2 applications, read here

To run tests in a container can be used docker-compose.test.yml file. Follow these three simple steps:

  1. Create test volume: docker volume create --name=test_postgres_data
  2. Apply migration for test database: docker-compose -f docker-compose.test.yml run --rm yii_test migrate
  3. Run all the tests that are in the template: docker-compose -f docker-compose.test.yml run --rm codeception run

It is possible to run only unit or only functional tests for the application, for example

docker-compose -f docker-compose.test.yml run --rm codeception run unit -c backend 
docker-compose -f docker-compose.test.yml run --rm codeception run functional -c api 

Also you can run some specific test by specifying the path to it

docker-compose -f docker-compose.test.yml run --rm codeception run functional -c api v1/ApiCest 

For debugging, it can be convenient to run tests with the flags -f and --debug

docker-compose -f docker-compose.test.yml run --rm codeception run functional -c api v1/ApiCest -f --debug 

Template structure

The root directory contains the following subdirectories and files:

api                 web application implements simple REST API    
    component/           contains components api
    config/              contains api configurations
    models/              contains api-specific model classes
    runtime/             contains files generated during runtime
    tests/               contains tests for frontend application
    web/                 contains the entry script
    codeception.yaml     configuration file for Codeception
backend             backend web application
    assets/              contains application assets such as JavaScript and CSS
    config/              contains backend configurations
    controllers/         contains Web controller classes
    models/              contains backend-specific model classes
    runtime/             contains files generated during runtime
    tests/               contains tests for backend application    
    views/               contains view files for the Web application
    web/                 contains the entry script and Web resources
    codeception.yaml     configuration file for Codeception
common              files shared for the whole application
    component/           contains shared components
    config/              contains shared configurations
    fixtures/            contains fixtures
    mail/                contains view files for e-mails
    models/              contains model classes used in both backend and frontend
    tests/               contains tests for common classes        
console             console application
    config/              contains console configurations
    controllers/         contains console controllers (commands)
    migrations/          contains database migrations
    models/              contains console-specific model classes
    runtime/             contains files generated during runtime
environments/       contains environment-based overrides
frontend            frontend web application
    assets/              contains application assets such as JavaScript and CSS
    config/              contains frontend configurations
    controllers/         contains Web controller classes
    models/              contains frontend-specific model classes
    runtime/             contains files generated during runtime
    tests/               contains tests for frontend application
    views/               contains view files for the Web application
    web/                 contains the entry script and Web resources
    widgets/             contains frontend widgets
    codeception.yaml     configuration file for Codeception
tools/              contains helper for IDE       
vendor/             contains dependent 3rd-party packages
.env.example        dotenv file example
.env.travis         dotenv file for Tavis CI
.gitignore          contains a list of directories ignored by git version system. 
.php_cs             configuration file for PHP Coding Standards Fixer
.travis.yaml        configuration file for Travis CI 
codeception.yaml    cnfiguration file for Codeception 
composer.json       composer config described in Configuring Composer.
init                initialization script described in Configuration and environments.
init.bat            same for Windows.
LICENSE.md          license info. Put your project license there.
README.md           basic info about installing template (EN).
README-RU.md        basic info about installing template (RU).
requirements.php    Yii requirements checker.
yii                 console application bootstrap.
yii.bat             same for Windows.

yarcode/yii2-app-yarcode 适用场景与选型建议

yarcode/yii2-app-yarcode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 159 次下载、GitHub Stars 达 26, 最近一次更新时间为 2016 年 04 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「framework」 「advanced」 「yii2」 「project template」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 yarcode/yii2-app-yarcode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 yarcode/yii2-app-yarcode 我们能提供哪些服务?
定制开发 / 二次开发

基于 yarcode/yii2-app-yarcode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 26
  • Watchers: 2
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-04-26