承接 karlmacz/chikka 相关项目开发

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

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

karlmacz/chikka

Composer 安装命令:

composer require karlmacz/chikka

包简介

Chikka API for Laravel 5

README 文档

README

Chikka SMS API package for Laravel 5.

Installation

Require this package in your project's composer.json file.

composer require karlmacz/chikka

Setup

Add the service provider to the providers array in your project's config/app.php file.

KarlMacz\Chikka\ChikkaServiceProvider::class,

Add CHIKKA_ACCESS_CODE, CHIKKA_CLIENT_ID, CHIKKA_SECRET_KEY, and CHIKKA_REQUEST_COSTin your project's .env file.

CHIKKA_ACCESS_CODE=your_short_code
CHIKKA_CLIENT_ID=your_client_id
CHIKKA_SECRET_KEY=your_secret_key
CHIKKA_REQUEST_COST=FREE

CHIKKA_REQUEST_COST's default value is FREE, so no need to add this to your project's .env file if you want chikka to decide how much credits will be deducted to the user's actual load.

Also, CHIKKA_STORE_TRANSACTIONS is available with a default value of false. When set to true, all incoming and outgoing sms will be stored in the database. After setting it to true, publish the migrations from this package.

php artisan vendor:publish

This will add 2017_04_08_000000_create_chikka_incoming_sms_table.php and 2017_04_08_000001_create_chikka_outgoing_sms_table.php to your project's database/migrations directory. After that, run the migrations.

php artisan migrate

Usage

Sending SMS to a user

To send an sms, make a HTTP POST Request to the /chikka/send path.

<form action="/chikka/send" method="POST">
    <input type="hidden" name="message_type" value="SEND">
    <input type="text" name="mobile_number" required autofocus>
    <textarea name="message" required></textarea>
    <input type="submit" value="Send Message">
</form>

message_type parameter's value must be set to SEND.

Replying to a SMS from users

To reply to an sms sent to you by the user, make a HTTP POST Request to the /chikka/send path with an additional paramater request_id.

<form action="/chikka/send" method="POST">
    <input type="hidden" name="message_type" value="REPLY">
    <input type="hidden" name="request_id" value="5048303030534D415254303030303032393230303032303030303030303133323030303036333933393932333934303030303030313331313035303735383137">
    <input type="text" name="mobile_number" required autofocus>
    <textarea name="message" required></textarea>
    <input type="submit" value="Send Message">
</form>

message_type parameter's value must be set to REPLY. Also, request_id parameter's value must be the same transaction ID indicated in the message you received.

/chikka/send's named route chikka.send is also available for you to use.

Receiving SMS from users

When CHIKKA_STORE_TRANSACTIONS is set to true in your project's .env file, all incoming sms will automatically be saved to the database.

All you have to do now is to add /chikka/receive path to the Message Receiver URL in the Chikka API Settings Page

Sample Image

Note

When making a HTTP POST Request to the /chikka/send path using a Standard HTTP Request, the response is converted to a flash session that you may display by using session()->get().

session()->get('flash_status')
session()->get('flash_message')

But, when making a HTTP POST Request to the /chikka/send path using AJAX, the response is encoded to JSON.

{ 'status': 'Success', 'message': 'Message sent.' }

License

This package is licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固