Download the PHP package ssh/amqp without Composer

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

AMQP

AMQP library wrapper for php-amqplib,基于 php-amqplib 封装的 RabbitMQ 客户端组件。

安装

或者手动安装:

配置

在 webman 框架中创建配置文件 config/plugin/webman/amqp/amqp.php

发送消息

方式一:静态调用

方式二:实例调用

方式三:发送带属性的消息

消费消息

创建消费者类

创建一个实现 Consumer 接口的类:

带交换机和路由键的消费者

在 webman 中配置消费者进程

config/plugin/webman/amqp/process.php 中添加:

消费者工作流程

当消费者进程启动后,会执行以下步骤:

  1. 扫描消费者类:扫描指定目录下的所有 PHP 文件,查找实现了 ssh\Amqp\Consumer 接口的类
  2. 设置消费者:为每个消费者类创建 AMQP 连接、声明交换机和队列、绑定关系
  3. 启动消息循环:进入无限循环,持续监听消息并调用相应的消费者处理
  4. 自动重连:如果连接断开,会自动尝试重连
  5. 异常处理:消息处理过程中的异常会被捕获并记录,同时根据配置决定是否重新入队

消费者接口说明

必须实现的方法

可选属性

可选方法

高级用法

手动声明交换机和队列

批量消费消息

消息属性

消费者接收的 $properties 数组包含以下可能的字段:

异常处理

异常类

组件提供了以下异常类:

发送消息时的异常处理

消费者中的异常处理

消费者进程会自动处理消息处理过程中的异常,并记录日志。如果消费者实现了 shouldRequeue 方法,可以控制失败的消息是否重新入队:

连接管理

Client 类提供了以下方法来管理连接:

配置日志

在消费者进程中可以配置日志记录器:

API 参考

Client 类方法

静态方法

实例方法

回调参数说明

依赖

License

MIT


All versions of amqp with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
php-amqplib/php-amqplib Version ^3.5
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 ssh/amqp contains the following files

Loading the files please wait ...