hexonthebeach/laravel-cmtext-provider

在 Laravel Service Provider 中使用 CM.com TextClient。

2.0.0 2020-10-02 09:22 UTC

This package is auto-updated.

Last update: 2024-08-29 05:06:53 UTC


README

提供者以注入 CMText\TextClient

需求

  • laravel 5

设置

  • 将此包加载到项目中
composer require hexonthebeach/laravel-cmtext-provider
  • 将包含的配置发布到 config/cmtext.php
php artisan vendor:publish "hexonthebeach\LaravelCMTextProvider\CMTextProvider"
  • CM_API_KEY 添加到项目 .env 文件中,其值应为您的 API 密钥

  • 最后,将此提供者添加到 config/app.php 文件中提供者的列表中

'providers' => [
    ... ,
    hexonthebeach\LaravelCMTextProvider\CMTextProvider::class,
],

代码示例

<?php namespace App\Http\Controllers;

use CMText\TextClient;

class CMTextController extends Controller
{
    public function index(TextClient $textClient)
    {
        $textClient->SendMessage( ... );
    }
}