src/Twilio.php
protected function sendSmsMessage(TwilioSmsMessage $message, $to)
    {
        $params = [
            'body' => trim($message->content),
        ];

        if ($messagingServiceSid = $this->getMessagingServiceSid($message)) {
            $params['messagingServiceSid'] = $messagingServiceSid;
        }

        if ($from = $this->getFrom($message)) {
            $params['from'] = $from;
        }

        if (! $from && ! $messagingServiceSid) {
            throw CouldNotSendNotification::missingFrom();
        }

        $this->fillOptionalParams($params, $message, [
            'statusCallback',
            'statusCallbackMethod',
            'applicationSid',
            'maxPrice',
            'provideFeedback',
            'validityPeriod',
        ]);

        if ($message instanceof TwilioMmsMessage) {
            $this->fillOptionalParams($params, $message, [
                'mediaUrl',
            ]);
        }

        return $this->twilioService->messages->create($to, $params);
    }
protected function sendSmsMessage(TwilioSmsMessage $message, $to)
    {
        $params = [
            'body' => trim($message->content),
        ];

        if ($messagingServiceSid = $this->getMessagingServiceSid($message)) {
            $params['messagingServiceSid'] = $messagingServiceSid;
        }

        if ($from = $this->getFrom($message)) {
            $params['from'] = $from;
        }

        if (! $from && ! $messagingServiceSid) {
            throw CouldNotSendNotification::missingFrom();
        }

        $this->fillOptionalParams($params, $message, [
            'statusCallback',
            'statusCallbackMethod',
            'applicationSid',
            'maxPrice',
            'provideFeedback',
            'validityPeriod',
        ]);

        if ($message instanceof TwilioMmsMessage) {
            $this->fillOptionalParams($params, $message, [
                'mediaUrl',
            ]);
        }

        return $this->twilioService->messages->create($to, $params);
    }
protected function sendSmsMessage ( TwilioSmsMessage $ message , $ to ) { $ params = [ 'body' => trim ( $ message -> content ) , ] ; if ( $ messagingServiceSid = $ this -> getMessagingServiceSid ( $ message ) ) { $ params [ 'messagingServiceSid' ] = $ messagingServiceSid ; } if ( $ from = $ this -> getFrom ( $ message ) ) { $ params [ 'from' ] = $ from ; } if ( ! $ from && ! $ messagingServiceSid ) { throw CouldNotSendNotification :: missingFrom ( ) ; } $ this -> fillOptionalParams ( $ params , $ message , [ 'statusCallback' , 'statusCallbackMethod' , 'applicationSid' , 'maxPrice' , 'provideFeedback' , 'validityPeriod' , ] ) ; if ( $ message instanceof TwilioMmsMessage ) { $ this -> fillOptionalParams ( $ params , $ message , [ 'mediaUrl' , ] ) ; } return $ this -> twilioService -> messages -> create ( $ to , $ params ) ; }
Send an sms message using the Twilio Service.

@param TwilioSmsMessage $message
@param string $to
@return \Twilio\Rest\Api\V2010\Account\MessageInstance
Send an sms message using the Twilio Service .