phalcon

Introduction

Phalcon in Tars

  • Support Packing code

  • Support Phalcon develop

  • Support TarsConfig

  • Support http & tars Protocol

  • Limited by the design of the framework itself, it does not support cooperation

Thanks

Project Directory Structure

  • component: Common base class of Controller

  • conf: The configuration required by the business

  • controller: The C layer in the MVC model

  • database: Database connection configuration

  • libs: Common libs、server/model extensions、utils

  • models: The model file for the database table

  • servant: Client code generated by tars2php, this directory name is completely customizable, just need to be distinguished when using them

  • services: Business Logic Code

  • tasks: Console commands of business, for making debugging easier, can also be used as a timed task

  • composer.json: Description of the project's dependencies

  • index.php: The entrance of the service, the file name can be customized, but you must change the private template on the platform and add the field of entrance under the server

  • services.php: Declare the base namespaceName of the entire project

Use

  1. Create project

    Clone code example

    git clone git@github.com:iamloso/tars-php-phalcon.git

    Install composer dependencies

    cd src && composer install -vvv
  2. Basic service config

    Change appName、serverName、objName in tars/tars.proto.php

  3. If you use the tasrsprotocol

    Write the tars interface description file in the tars directory,tars/tars.proto.php,add tarsFiles

    Executing compilation script in scripts directory to generate interface code

    /bin/bash tars2php.sh

    Create interface implementation class in src/services directory and write business logic code

    Edit services in src/services.php,replace interface and interface implementation namespace

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

  5. Package the project in the tars PHP development environment(run composer run-script deploy in src)

  6. Publish the project in the tars management background, please refer to TARS-PHP-TCP Server and client development),testcurl 'http://{ip}:{port}/{api_route}'

Last updated