Download the PHP package stcer/syar without Composer

On this page you can find all versions of the php package stcer/syar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package syar

为何用swoole来实现 Yar server

Requirements

  1. php5.4+
  2. ext-swoole 1.8.8+
  3. ext-msgpack 如果yar使用msgpack编码方式

Installation

Example

服务端 example\server.php

example/service/Test.php

命令行启动server.php

客户端

简单性能测试(benchmark)

测试脚本 example/benchmark/testSimple.php, 测试环境(虚拟机)

脚本一共完成44次接口调用:

  1. 简单接口调用 2次
  2. 数据库查询接口调用2次
  3. 并发简单接口调用 20次
  4. 并发数据库查询接口调用 20次

在当前测试环境下,在使用syar批量接口请求,fpm环境下的执行时间大概是syar下的3 -- 6倍左右,

简单压力测试

测试脚本 example/benchmark/testConcurrent.php, 50%接口随机查询数据库(10000条数据, 主要为测试接口通信性能)

扩展特性

接口批量请求

客户端请求示例:

Protocol插件与Dispatcher插件

应用示例参考 example/server_plug.php, client_plug.php

Protocol触发事件:

  1. Protocol::EVENT_REQUEST_BEFORE, 请求开始触发, 可以提前响应客户端, 中断正常解析流程
  2. Protocol::EVENT_RESPONSE_AFTER, 请求结束触发, 可以适用请求结束之后的处理工作,比如写日志等

Dispatcher触发事件:

  1. Dispatcher::EVENT_REQUEST_BEFORE, Api接口执行前触发
  2. Dispatcher::EVENT_REQUEST_AFTER, Api接口执行后触发

投递任务到task进程异步执行

应用示例参考 example/taskManagerServer.php

已知问题

  1. 未完成文档解析, 可使用自带的yar server显示文档
  2. 由于代码是从私有框架独立出来,可能存在未知bug

All versions of syar with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.16
ext-swoole Version >=1.8.8
ext-msgpack Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package stcer/syar contains the following files

Loading the files please wait ....