revealit/laravel-azure-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

revealit/laravel-azure-sdk

最新稳定版本:1.0.4

Composer 安装命令:

composer require revealit/laravel-azure-sdk

包简介

A PHP Laravel wrapper for the Microsoft Azure REST API

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package aims to wrap the Azure REST API.

At the moment, the following is supported:

Service Bus

  • Push messages into a queue

Installation

You can install the package via composer:

composer require revealit/laravel-azure-sdk

You can publish the config file with:

php artisan vendor:publish

and then entering the number of the ServiceProvider

This is the contents of the published config file:

return [

    /*
     * The Application (client) ID
     */
    "client_id" => "",

    /*
     * Directory (tenant) ID
     */
    "tenant_id" => "",

    /*
     * The apps secret value. This value is only visible immediately after creation,
     * so be sure to note it down.
     */
    "client_secret_value" => ""
    
    /*
     * The default service bus to use.
     */
    "default_service_bus_namespace" => ""

];

Usage

Edit azure-sdk.php in the Laravel config folder, and enter your Apps keys and secret.

use Revealit\AzureSdk\Facades\AzureSdk;

// Define an array
$message = [
    "title" => "Hello World!"
];

// Send a message to a queue
return AzureSdk::pushToQueue("test_queue", $message)->status();

This will generate a token and send a message to the queue specified in the first parameter.

You can also send a message to a different service bus:

use Revealit\AzureSdk\Facades\AzureSdk;

// Send a message to a queue in a different service bus
return AzureSdk::pushToQueue("test_queue", ["msg" => "Hello World!"], "different_service_bus")->status();

If you want to send multiple messages, you can generate a token first and pass it in as an optional forth parameter:

use Revealit\AzureSdk\Facades\AzureSdk;

$token = AzureSdk::getAPIToken();
$serviceBus = config("azure-sdk.default_service_bus_namespace");
$message1 = ["url" => "https:www.github.com"];

// Send messages to different queues using the same token
AzureSdk::pushToQueue("test_queue", $message1, $serviceBus, $token)->status();
AzureSdk::pushToQueue("test_queue_2", ["title" => "Azure SDK"], $serviceBus, $token)->status();

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-31