PHP code example of maymeow / cakephp-twilio

1. Go to this page and download the library: Download maymeow/cakephp-twilio library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

maymeow / cakephp-twilio example snippets


//add into bootstrap function
$this->addPlugin('CakephpTwilio');

$this->loadComponent('CakephpTwilio.Twilio');

[
//... other configuration

    /**
     * Twilio SMS gate configuration
     */
    'Twilio' => [
        /**
         * From: use mobile phone number or string A-Za-z1-0 max length 11 characters
         * @see https://www.twilio.com/docs
         */
        'From' => '_NUMBER_OR_TEXT_',
        'Sid' => '_YOUR_SID_',
        'Token' => '_YOUR_TOKEN_'
    ],

// ... end of file
];

use CakephpTwilio\Model\Message;

$this->Twilio
    ->send(new Message('PhoneNumber', "Text"));

$this->Twilio
    ->send(new Message('PhoneNumber', "Text", "NumberOrText"));