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

Use

  1. Create project

    Create the tars project directory structure (scripts、src、tars),put Laravel/Lumen project in src directory.

  2. Install Laravel Tars

    Update Composer

    or add requirement to composer.json

    add ServiceProvider,edit src/bootstrap/app.php

    Initialization Laravel Tars

  3. edit proto in src/config/tars.php ,change appName、serverName、objName

  4. If you use the HTTP protocol, you need to automatically register to the gateway (now only support Kong),edit src/config/tars.php

  5. 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

  6. If you use the HTTP protocol, code in a framework native way

  7. 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

  8. 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

  9. Package the project in the tars PHP development environment(run php artisan tars:deploy in src)

  10. 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