Download the PHP package xaviertony/xavier-swoole without Composer

On this page you can find all versions of the php package xaviertony/xavier-swoole. 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 xavier-swoole

ThinkPHP 5.0 Swoole 扩展

参考官方think-swoole2.0和easyswoole开发基于TP5.0的swoole扩展包

增加异步任务投递 QQ群194870448

配置文件

第三方包的配置文件必须在application/extra下,文件名为swoole.php

注意:\think\Request 增加如下静态方法。 由于TP运行在Apache或者NGINX下,是每次请求后都会销毁,所以这里的单例并不会造成什么问题,但是在Swoole下,由于常驻内存,所以请求单例一旦实例化则不会改变,所以这里就将其删除,每次请求后重新实例化

目前TP官方已经支持如下方法,已经不需要修改,但目前尚未合并到5.0分支,如需要可以下载官方master分支

修改如下代码,由于采用命令行模式运行无论什么请求都会被认为是get

启动命令

守护启动

停止服务

Demo

定时器

如下是定时器接口的实现

只需要在定时器配置中配置定时任务的时间

同时定时任务支持在任务进程执行

不建议在任意进程随意使用定时器,建议使用系统配置的定时器,请注意自定义定时器使用和销毁

系统配置的定时器,在第一个worker创建一个定时器,根据任务是否到期需要执行来进行异步任务投递,并不是对当前进程造成阻塞 但是需要配置task_work_num

----------------------2018-08-24-------------------------

和think-swoole 官方统一类的命名空间

xavier-swoole会和官方think-swoole保持同步更新

接口文件统一存放在 xavier\swoole\template命名空间下

自定义服务启动

该方法等同于swoole onWorkerStart

使用方法

在swoole.php中配置

//闭包方式

基于SwooleTable的高速跨进程缓存,只需要更改如下配置,Cache即可变身高速缓存

------------------2018-10-04--------------------------------

1.支持websocket服务 2.编写websocket测试JS库

注:websocket模式,为测试开发阶段,如采用websocket命令启动服务,xavier-swoole的较多特性无法启用,稍后更新中会将http服务和websocket服务整合

启动命令

配置文件,WebsSocket的配置文件为server.php,路径和swoole.php路径相同

WebSocket通讯数据结构

详解

客户端JS可以参考example里websocketclient.js

服务端发送数据

---------------------------------2018-10-09------------------------------------------

新增队列支持

think-queue,是一个非常好用的队列服务,xavier-swoole的队列服务依赖于think-queue,使用方法和think-queue保持一致

主要增加如下功能

  1. 采用多进程模式运行或采用Task异步执行
  2. 可以指定同时消耗队列任务的进程数量
  3. Task模式和Server共享Task进程,充分利用资源
  4. Process模式采用进程模式,各个任务之间相互隔离,执行一定次数后,重启进程,防止内存泄露

如果任务较多且复杂,推荐采用Process模式

手册 https://www.kancloud.cn/xavier007/xavier_swoole


All versions of xavier-swoole with dependencies

PHP Build Version
Package Version
Requires ext-swoole Version >=1.8
guzzlehttp/guzzle Version ^6.3
jeremeamia/superclosure Version ^2.4
xavier/xcron-expression Version ^0.11
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 xaviertony/xavier-swoole contains the following files

Loading the files please wait ....