承接 mujhtech/sendchamp 相关项目开发

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

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

mujhtech/sendchamp

Composer 安装命令:

composer require mujhtech/sendchamp

包简介

Laravel package for sendchamp api

README 文档

README

A Laravel Package for sendchamp api

Latest Stable Version Latest Unstable Version Build Status Scrutinizer Code Quality Code Coverage Total Downloads License

Installation

To get the latest version of Sendchamp, simply require it

composer require mujhtech/sendchamp

Or add the following line to the require block of your composer.json file.

"mujhtech/sendchamp": "1.0.*"

Once Laravel Sendchamp is installed, you need to register the service provider. Open up config/app.php and add the following to the providers key.

'providers' => [
 ...
 Mujhtech\SendChamp\SendChampServiceProvider::class,
 ...
]

If you use Laravel >= 5.5 you can skip this step and go to configuration

  • SendChamp\SendChamp\SendChampServiceProvider::class

Also, register the Facade like so:

'aliases' => [
 ...
 'SendChamp' => Mujhtech\SendChamp\Facades\SendChamp::class,
 ...
]

Configuration

You can publish the configuration file using this command:

php artisan vendor:publish --provider="Mujhtech\SendChamp\SendChampServiceProvider"

A configuration-file named sendchamp.php with some sensible defaults will be placed in your config directory:

<?php

return [

    /**
     * Mode
     * live or test
     *
     */
    'mode' => 'live', // test mode has been removed, the user must buy testing credit on the platform

    /**
     * Public Key
     *
     */
    'publicKey' => getenv('SENDCHAMP_PUBLIC_KEY'),

];

Lumen Configuration

  • Open your bootstrap/app.php
  • Register your service provider
  • Add your Facade
  • Register the config
$app->register(Mujhtech\SendChamp\SendChampServiceProvider::class);
$app->withFacades(true, [
    SendChamp::class => 'SendChamp',
]);
$app->configure('sendchamp');

Usage

Open your .env file and add your api key like so:

SENDCHAMP_PUBLIC_KEY=sendchamp_xxxxxxxxxxx

If you are using a hosting service like heroku, ensure to add the above details to your configuration variables.

Use Case

/**
 * Get wallet report
 * @return array
 */
SendChamp::getWalletReport()

/**
 * Alternatively, use the helper.
 */
sendchamp()->getWalletReport();


/**
* Create or update contact
* @param string $lastname
* @param string $firstname
* @param string $phone
* @param string $email
* @param string $reference
* @return array
*/
SendChamp::createOrUpdateContact($lastname, $firstname, $phone, $email, $reference)

/**
 * Alternatively, use the helper.
 */
sendchamp()->createOrUpdateContact($lastname, $firstname, $phone, $email, $reference);


/**
 * Delete contact
 * @param string $id 
 * @return array
*/
SendChamp::deleteContact($id)

/**
 * Alternatively, use the helper.
 */
sendchamp()->deleteContact($id);


/**
 * * Create sms sender
 * * @param string $send_name
 * * @param string $use_case
 * * You should pass either of the following: Transactional, Marketing, or Transactional & Marketing
 * * @param string $sample_message
 * * @return array
*/
SendChamp::createSmsSender($sender_name, $use_case, $sample_message)

/**
 * Alternatively, use the helper.
 */
sendchamp()->createSmsSender($sender_name, $use_case, $sample_message);


/**
     * Send sms
     * @param string $message
     * @param string $sender_name
     * Represents the sender of the message.
     * This Sender ID must have been requested
     * via the dashboard or use "Sendchamp" as default
     * @param array $numbers
     * This represents the destination phone number.
     * The phone number(s) must be in the international format
     * (Example: 23490126727). You can also send to multiple numbers.
     * To do that put numbers in an array
     * (Example: [ '234somenumber', '234anothenumber' ]).
     * @param string $route e.g ['non_dnd', 'dnd', 'international']
     * @return array
     * 
    */
SendChamp::sendSms($message, $sender_name, $numbers, $route)

/**
 * Alternatively, use the helper.
 */
sendchamp()->sendSms($message, $sender_name, $numbers, $route);


/**
     * Get sms status
     * @param string $sms_id 
     * ID of the SMS that was sent
     * @return array
    */
SendChamp::fetchSmsStatus($sms_id)

/**
 * Alternatively, use the helper.
 */
sendchamp()->fetchSmsStatus($sms_id);



/**
     * Send voice
     * @param string $message
     * @param string $sender_name
     * Represents the sender of the message.
     * This Sender ID must have been requested via
     * the dashboard or use "Sendchamp" as default
     * @param string $number
     * The number represents the destination phone number.
     * The number must be in international format (E.g. 2348012345678)
     * @return array
    */
SendChamp::sendVoice($message,  $sender_name,  $number)

/**
 * Alternatively, use the helper.
 */
sendchamp()->sendVoice($message, $sender_name, $number);


/**
     * Send whatsapp otp
     * @param string $template_code
     * You can find this on the template page under Whatsapp Channel of your Sendchamp dashboard
     * @param string $sender_number
     * Your approved Whatsapp number on Sendchamp.
     * You can use our phone number if you have not registered a number 2347067959173
     * @param string $recipient
     * Whatsapp number of the customer you are sending the message to
     * @param string $message
     * @return array
    */
SendChamp::sendWhatsappOtp($template_code, $message, $sender_number, $recipient)

/**
 * Alternatively, use the helper.
 */
sendchamp()->sendWhatsappOtp($template_code, $message, $sender_number, $recipient);



/**
     * Send otp message
     * @param string $channel
     * @param string $token_type // numeric or alphanumeric
     * @param int $token_length 
     * The length of the token you want to send to your customer. Minimum is 5
     * @param int $expiry_day
     * How long you want to the to be active for in minutes. (E.g. 10 means 10 minutes )
     * @param string $customer_email 
     * @param string $customer_mobile_number 
     * @param array $meta_data can be empty but you need to pass array like ['data' => []]
     * @param string $sender
     * Specify the sender you want to use. This is important
     * when using SMS OR Whatsapp Channel or we will select a
     * default sender from your account. Eg: KUDA OR +234810000000
     * @return array
    */
SendChamp::sendOtp($channel, $token_type, $token_length, $expiry_day, $customer_email $customer_mobile_number, $meta_data, $sender)

/**
 * Alternatively, use the helper.
 */
sendchamp()->sendOtp($channel, $token_type, $token_length, $expiry_day, $customer_email $customer_mobile_number, $meta_data, $sender);



/**
     * Confirm otp
     * @param string $reference
     * The unique reference that was returned as response when the OTP was created
     * @param string $otp
     * The OTP that was sent to the customer.
     * @return array
    */
SendChamp::confirmOtp($reference, $otp)

/**
 * Alternatively, use the helper.
 */
sendchamp()->confirmOtp($reference, $otp);

Code Quality

  • Run vendor/bin/pint

License

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

mujhtech/sendchamp 适用场景与选型建议

mujhtech/sendchamp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.81k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2021 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 mujhtech/sendchamp 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-04