定制 dejwcake/laravel-sms 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

dejwcake/laravel-sms

Composer 安装命令:

composer require dejwcake/laravel-sms

包简介

A Laravel and Lumen integration for dejwcake/sms-client to enable sending SMS messages

README 文档

README

SMS service provider for Laravel and Lumen. Uses SMS Client to enable sending SMS messages using the following drivers:

  • nexmo
  • clockwork
  • textlocal
  • twilio
  • O2SK
  • aws (requires installation of aws/aws-sdk-php)
  • mail (somewhat untested and may be too generic to be much use)

Also has the following drivers for testing purposes:

  • log
  • null
  • requestbin

Fork note

This project is a fork of Matthewbdaly\LaravelSMS. It is maintained and improved by David Běhal (DejwCake).

Namespace change

The library namespace has been updated from Matthewbdaly\LaravelSMS to DejwCake\LaravelSms. Backward compatibility with the old namespace has been removed; please update your imports accordingly.

Installation for Laravel

This package is only intended for Laravel 5.5 and up. Install it with the following command:

$ composer require dejwcake/laravel-sms

Then publish the config file:

$ php artisan vendor:publish

You will need to select the service provider Dejwcake\LaravelSms\LaravelSmsProvider. Then set your driver and any settings required in the .env file for your project:

SMS_DRIVER=nexmo
NEXMO_API_KEY=foo
NEXMO_API_SECRET=bar
CLOCKWORK_API_KEY=baz
TEXTLOCAL_API_KEY=baz
REQUESTBIN_PATH=foo
O2_SK_API_KEY=foo
AWS_SNS_API_KEY=foo
AWS_SNS_API_SECRET=bar
AWS_SNS_API_REGION=baz
MAIL_SMS_DOMAIN=my.sms-gateway.com
TWILIO_ACCOUNT_ID=foo
TWILIO_API_TOKEN=bar

Installation for Lumen

The installation process with Lumen is identical to that for Laravel, although if you wish to use the facade you will need to uncomment the appropriate section of bootstrap/app.php as usual.

Usage

Once the package is installed and configured, you can use the facade to send SMS messages:

use DejwCake\SmsClient\Facades\Sms;

$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
Sms::send($msg);

Or fetch it from the app:

$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$sms = app()['sms'];
$sms->send($msg);

Or resolve the interface DejwCake\SmsClient\Contracts\Client:

$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$sms = app()->make('DejwCake\SmsClient\Contracts\Client');
$sms->send($msg);

Here we use the app() helper, but you'll normally want to inject it into a constructor or method of another class.

How to develop this project

Composer

Update dependencies:

docker compose run --rm cli composer update

Composer normalization:

docker compose run --rm php-qa composer normalize

Run tests

Run tests with pcov:

docker compose run --rm test ./vendor/bin/phpunit -d pcov.enabled=1

Run code analysis tools (php-qa)

PHP compatibility:

docker compose run --rm php-qa phpcs --standard=.phpcs.compatibility.xml --cache=.phpcs.cache

Code style:

docker compose run --rm php-qa phpcs -s --colors --extensions=php

Fix style issues:

docker compose run --rm php-qa phpcbf -s --colors --extensions=php

Static analysis (phpstan):

docker compose run --rm php-qa phpstan analyse --configuration=phpstan.neon

Mess detector (phpmd):

docker compose run --rm php-qa phpmd ./src,./tests ansi phpmd.xml --suffixes php --baseline-file phpmd.baseline.xml

dejwcake/laravel-sms 适用场景与选型建议

dejwcake/laravel-sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 194 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sms」 「laravel」 「lumen」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dejwcake/laravel-sms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dejwcake/laravel-sms 我们能提供哪些服务?
定制开发 / 二次开发

基于 dejwcake/laravel-sms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-26