承接 outhebox/laravel-ibmq 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

outhebox/laravel-ibmq

最新稳定版本:0.1

Composer 安装命令:

composer require outhebox/laravel-ibmq

包简介

This is my package laravel-ibmq

README 文档

README

Features | Requirements | Installation | Usage | Changelog

Latest Stable Version Tests Total Downloads PHP from Packagist Laravel Version

A Laravel package to connect with IBM MQ, allowing for sending and receiving messages. This package supports multiple queues for inbound and outbound messages, with advanced error handling and logging.

Features

  • Easy-to-use API for interacting with IBM MQ.
  • Separate queues for inbound and outbound messaging.
  • Fluent API for sending and receiving messages.
  • Configurable via environment variables.

Requirements

  • PHP 8.1+ with ext-sockets extension enabled
  • Laravel 10 or higher
  • IBM MQ instance

Installation

You can install the package via composer:

composer require outhebox/laravel-ibmq

You can publish the config file with:

php artisan vendor:publish --tag="laravel-ibmq-config"

This is the contents of the published config file:

return [
    'host' => env('IBM_MQ_HOST', 'your-host'),
    'port' => env('IBM_MQ_PORT', 1414),
    'queue_manager' => env('IBM_MQ_QUEUE_MANAGER', 'your-queue-manager'),
    'username' => env('IBM_MQ_USERNAME', null),
    'password' => env('IBM_MQ_PASSWORD', null),

    'queues' => [
        'inbound' => env('IBM_MQ_INBOUND_QUEUE', 'your-inbound-queue'),
        'outbound' => env('IBM_MQ_OUTBOUND_QUEUE', 'your-outbound-queue'),
    ],
];

Usage

Sending Messages

use Outhebox\LaravelIBMQ\Facades\LaravelIBMQ;
use Outhebox\LaravelIBMQ\Exceptions\IBMQException;

$ibmQueue = new LaravelIBMQ();

try {
    $ibmQueue->sendMessage('Hello, IBM MQ!');
    echo "Message sent successfully!";
} catch (IBMQException $e) {
    echo "Failed to send message: " . $e->getMessage();
}

Listening to Messages

use Outhebox\LaravelIBMQ\Facades\LaravelIBMQ;
use Outhebox\LaravelIBMQ\Exceptions\IBMQException;

$ibmQueue = new LaravelIBMQ();

try {
    $ibmQueue->listenToMessages(function ($messageBody) {
        echo "Received message: " . $messageBody;
    });
} catch (IBMQException $e) {
    echo "Failed to receive messages: " . $e->getMessage();
}

Closing Connections

Connections are automatically closed when the object is destroyed or the application ends. However, you can explicitly close the connection if needed:

use Outhebox\LaravelIBMQ\Facades\LaravelIBMQ;

$ibmQueue = new LaravelIBMQ();

$ibmQueue->close();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-17