Package Data | |
---|---|
Maintainer Username: | KarlMacz |
Maintainer Contact: | karljarren0308@gmail.com (Karl T. Macadangdang) |
Package Create Date: | 2017-04-09 |
Package Last Update: | 2017-04-10 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-07 15:00:12 |
Package Statistics | |
---|---|
Total Downloads: | 9 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Chikka SMS API package for Laravel 5.
Require this package in your project's composer.json
file.
composer require karlmacz/chikka
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_COST
in 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
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
.
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.
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
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.' }
This package is licensed under the MIT License.