Download the PHP package ttlphp/workerman-annotation without Composer

On this page you can find all versions of the php package ttlphp/workerman-annotation. 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 workerman-annotation

workerman-annotation

基于GatewayWorker注解处理,通过注解解析绑定各模块调用,并且提供HTTP协议支持。

目录

Installation

使用composer安装(推荐)

使用GIT安装

使用GIT命令下载程序包。

修改自动加载配置

打开 vendor/composer/autoload_psr4.php 添加命令空间加载目录:

打开 vendor/composer/autoload_static.php 添加命令空间加载目录,此文件有多处需要添加,暂不示例

打开 vendor/composer/autoload_files.php 添加助手函数加载:

use

使用前准备

固定应用目录:

如何使用

内置注解

内置注解主要用于完成基本服务运行,如果不能满足要求还可以自定义注解处理器。 注意:函数必需是非静态并且公有使用注解才会被解析生效

@Register(class=string)

内置固定注解处理器,注册要使用的注解,使用注解前必需进行注册,注册后的注解能向下延续(即子类中可以使用)。

@DefineUse(function=bool, class=bool)

内置固定注解处理器,注解处理类专用注解,用来指定为注解处理类可使用位置

@DefineParam(name=string, type=string, default=mixed)

内置固定注解处理器,注解处理类专用注解,用来指定注解处理类参数,多个参数需要使用多次此注解。

@BindCall(name=string)

绑定调用注解,可以注册 bind-call.name 的索引调用,等待特殊调用。此注解主要用于服务路由不匹配或服务部分事件处理。

@HttpRouter(path=string)

HTTP请求路由处理注册,指定后就可以在服务处理事件时调用路由,完成请求操作。如果是静态文件需要存放在 public/ 目录下。

@HttpMethod(type=string, name=string)

HTTP请求方法路由注册,指定后此方法就可以通过路由调用。

@WebsocketRouter(path=string, route=string)

WebSocket请求路由处理注册,指定后就可以在服务处理事件时调用路由,完成请求操作。内置xml、json两种数据通信,会自动进行匹配,默认json。

@WebsocketMethod(name=string)

WebSocket请求方法路由注册,指定后此方法就可以通过路由调用。

@Middleware(name=string)

中间件注册,注册后可通过使用中间件注解进行绑定切入调用。

@UseWmiddleware(name=string)

使用中间件,指定后就可以绑定指定中间件处理器。

@Provide(action=string, name=string)

三方外部扩展包注解加载处理,使用外部扩展时可通过注解进行加载,同一类型扩展加载成功一个即停止加载其它相同扩展。

@Cache(timeout=int, name=string)

缓存函数返回值专用注解,此注解会截取函数返回值并进行缓存,下次调用时在缓存有效期内直接返回缓存值而不需要调用函数。

@Transaction(name=string)

事务注解,可以函数调用时自动开启事务,当有报错时事务回滚否则事务提交。

@Timer(id=int, interval=int, persistent=bool)

定时器注解,多进程时可以绑定指定进程号上运行,方便管理各定时器,如果只有一个进程运行时进程号无效。

@Validator(name=string, value=mixed, rules=string, title=string)

验证参数注解,用来验证函数的第一个参数(必需是数组)。

@SessionCache(type=string)

缓存session数据,进程中会保存session数据,当session有变化时会更新到缓存中(配置缓存时有效) 当业务进程异常重启时能自动通过缓存恢复session数据,能有效解决高并发时session不同步的问题 控制器中已经默认绑定好,启用只需要配置好缓存即可,HTTP协议无效 注意:网关的路由应该使用默认绑定模式,否则session会有同步时差。

自定义注解

当内置注解不够用时可以自定义注解处理器。每个注解均有对应一个处理类,这个类必需继承接口 WorkermanAnnotation\Annotations\iAnnotation 。 通过DefineUse和DefineParam注解进行绑定参数和使用位置。

attention

ttlphp/workerman-fast 是 workerman-annotation 专用应用层,通过 ttlphp/workerman-fast 能实现快速运行使用 workerman-annotation。


All versions of workerman-annotation with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
workerman/gateway-worker Version ^3.0
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 ttlphp/workerman-annotation contains the following files

Loading the files please wait ....