yii2
Introduction
Yii2 in Tars
Support Packing code
Support Yii2 develop
Support TarsConfig
Support TarsLog
Support tars register
Support Request start(tarsRequesting)、Request end(tarsRequested) event
Support echo content
Support http & tars Protocol
Limited by the design of the framework itself, it does not support cooperation
Related
Yii2Tars (https://github.com/luoxiaojun1992/yii2-tars)
Yii2TarsDemo (https://github.com/luoxiaojun1992/yii2-tars-demo)
TARSPHP (https://github.com/TarsPHP)
TARSPHP DOCKER (https://github.com/tangramor/docker-tars)
Use
Create project
Create the tars project directory structure(scripts、src、tars),put Yii2 project in src directory
Install Yii2 Tars
Update Composer
or add requirement to composer.json
Initialization Yii2 Tars
Edit
proto
in src/config/params.php ,changeappName、serverName、objName
If you use the HTTP protocol, you need to automatically register to the gateway (now only support Kong),edit src/config/params.php
TarsConfig & TarsLog,edit
tars
in src/config/params.phpThe configuration will be pulled automatically when the service starts,If you need to log,can use
Yii::info('test log');
If you need to specify the minimum log level for Tarslog logging,edit src/config/params.php
If you need to specify the recording frequency of tarslog,edit
tars
in src/config/params.phpIf you use HTTP protocol and write code in the framework native way, there is no special requirement for routing
If you use the tasrsprotocol
Write the tars interface description file in the tars directory,edit proto in src/config/params.php,add tarsFiles
Executing compilation script in scripts directory to generate interface code
Create interface implementation class in src/app/Tars/impl directory and write business logic code
Edit services in src/config/params.php,replace interface and interface implementation namespace
Setting up the development environment of TarsPHP
If using the HTTP protocol, refer toTARS-PHP-HTTP Server and client development
If using the tars protocol, refer toTARS-PHP-TCP Server and client development
Package the project in the tars PHP development environment(run
./yii tars/deploy
in src)Publish the project in the tars management background, please refer to TARS-PHP-TCP Server and client development),test
curl 'http://{ip}:{port}/{api_route}'
Continuous integration
Jenkins Pipeline Configuration example (modified according to actual situation)
Last updated