This package provides easy and painless integration of Codec Messaging Platform API into your Laravel projects.
Laravel >= 5.3
PHP >= 5.6.4
To get started, you should add the hayrican/laravel-codec-fastsms
Composer dependency to your project:
composer require hayrican/laravel-codec-fastsms
Register provider on your config/app.php
file.
'providers' => [
...,
HayriCan\CodecFastSms\CodecFastSmsServiceProvider::class,
]
You should publish vendor for configuration file which has API Credentials and other configs.
$ php artisan vendor:publish --provider="HayriCan\CodecFastSms\CodecFastSmsServiceProvider"
Navigate to config/codecfastsms.php
and enter your Codec API credentials in this file.
[
'username'=> "CODEC_USERNAME",
'password'=> "CODEC_PASSWORD",
'sender'=> "CODEC_SENDER",
]
Default router prefix is api
and middleware is api
. In this section you can change prefix and middleware.
[
'route_prefix'=> 'api',
'middleware'=> ['api'],
]
Default value of record comes false
and it means you sms requests are not going to save on database.
If you want to save you requests on database, you can make this field true
as shown below
[
'record'=> true
]
After changed the record value to true
on config/codecfastsms.php
file, you should migrate the migration.
$ php artisan migrate
And sms_records_table
will appear on your database.
You can send sms via a POST
request to /codec-fastsms
Key | Value | Description |
---|---|---|
phone |
5XXXXXXXXX | Phone number(s) to send multiple numbers you should put ~ between numbers. eg. 5XXXXXXXXX~5YYYYYYYYY |
messageContent |
Message Text | Message content(s) if you want to send different messages to different numbers you should put ~ between message contents. eg. MessageContent1~MessageContent2 . NOTE: If you use this property, you should have equal number of phone and messageContent |
Key | Value | Description |
---|---|---|
msgSpecialId |
Message_Title | This field use for searching on the Codec system records |
headerCode |
Header_Code | You can use this field for tracking messages from Codec Customer Service |
optionalParameters |
OPTIONAL_PARAM | Optional parameters |
$ php artisan fastsms:send --phone='5XXXXXXXXX' --messageContent='Message Text'
$ php artisan fastsms:send --phone='5XXXXXXXXX~5YYYYYYYYY~5ZZZZZZZZZ' --messageContent='Message Text'
$ php artisan fastsms:send --phone='5XXXXXXXXX~5YYYYYYYYY~5ZZZZZZZZZ' --messageContent='Message Text~Message Text2~Message Text3'
Key | Value | Description |
---|---|---|
--phone |
5XXXXXXXXX | Phone number(s) to send multiple numbers you should put ~ between numbers. eg. 5XXXXXXXXX~5YYYYYYYYY |
--messageContent |
Message Text | Message content(s) if you want to send different messages to different numbers you should put ~ between message contents. eg. MessageContent1~MessageContent2 . NOTE: If you use this property, you should have equal number of phone and messageContent |
Key | Value | Description |
---|---|---|
--msgSpecialId |
Message_Title | This field use for searching on the Codec system records |
--headerCode |
Header_Code | You can use this field for tracking messages from Codec Customer Service |
--optionalParameters |
OPTIONAL_PARAM | Optional parameters |
Hayri Can BARÇIN
Email: Contact Me
This project is licensed under the MIT License - see the License File for details