laravel
Introduction
Laravel in Tars with ci
Support Packing code
Support Laravel/Lumen develop
Support TarsConfig
Support TarsLog
Support tars register
Support Request start(laravel.tars.requesting)、Request end(laravel.tars.requested) event
Support echo content
Support http & tars Protocol
Support zipkin (Removed,can uselaravel-zipkin)
Limited by the design of the framework itself, it does not support cooperation
Related
LaravelTars (https://github.com/luoxiaojun1992/laravel-tars)
LaravelTarsDemo (https://github.com/luoxiaojun1992/laravel-tars-demo)
LumenTarsDemo (https://github.com/luoxiaojun1992/lumen-tars-demo)
Laravel5.x (https://github.com/laravel/framework)
Lumen5.x (https://github.com/laravel/lumen)
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 Laravel/Lumen project in src directory.
Install Laravel Tars
Update Composer
or add requirement to composer.json
add ServiceProvider,edit src/bootstrap/app.php
Initialization Laravel Tars
edit
proto
in src/config/tars.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/tars.php
TarsConfig & TarsLog
The configuration will be pulled automatically when the service starts,If you need to log,can use
Log::info('test log');
If you need to specify the minimum log level for Tarslog logging,edit src/config/tars.php
If you use the HTTP protocol, code in a framework native way
If you use the tasrsprotocol
Write the tars interface description file in the tars directory,edit proto in src/config/tars,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/tars.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
php artisan tars:deploy
in src)Publish the project in the tars management background, please refer to TARS-PHP-TCP Server and client development),测试
curl 'http://{ip}:{port}/{api_route}'
Continuous integration
Jenkins Pipeline Configuration example (modified according to actual situation)
Laravel:
Lumen:
Last updated