Create a new MessageInstance

@param string $to The destination phone number
@param array|Options $options Optional Arguments
@return MessageInstance Newly created MessageInstance
@throws TwilioException When an HTTP error occurs.
490676
public function create($to, $options = array()) {
        $options = new Values($options);

        $data = Values::of(array(
            'To' => $to,
            'From' => $options['from'],
            'MessagingServiceSid' => $options['messagingServiceSid'],
            'Body' => $options['body'],
            'MediaUrl' => Serialize::map($options['mediaUrl'], function($e) { return $e; }),
            'StatusCallback' => $options['statusCallback'],
            'ApplicationSid' => $options['applicationSid'],
            'MaxPrice' => $options['maxPrice'],
            'ProvideFeedback' => Serialize::booleanToString($options['provideFeedback']),
            'ValidityPeriod' => $options['validityPeriod'],
            'ForceDelivery' => Serialize::booleanToString($options['forceDelivery']),
            'SmartEncoded' => Serialize::booleanToString($options['smartEncoded']),
            'InteractiveData' => $options['interactiveData'],
            'ForceOptIn' => Serialize::booleanToString($options['forceOptIn']),
        ));

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new MessageInstance($this->version, $payload, $this->solution['accountSid']);
    }
557959
public static function sendMessage(string $text, int $to_user_id = USER_ID, int $from_user_id = 0, int $notify_toastr = self::TOASTR_MESSAGE_COLOR_GREEN)
    {
        $message = new UsersMessageEntity();

        return $message
            ->setFromUserId($from_user_id)
            ->setToUserId($to_user_id)
            ->setMessage($text)
            ->setNotify($notify_toastr)
            ->save();
    }
1208445
public function merge($to)
    {
        if (is_array($to)) {
            $to = Url::createFromArray($to);
        }
        else if (is_string($to)) {
            $to = self::createFromString($to);
        }
        else if (($to instanceof Url) === false) {
            throw new \InvalidArgumentException(
                "invalid value provided for 'to'; expecting a url as string, ".
                "an instance of sndsgd\\Url, or an array of url properties"
            );
        }

        $toValues = $to->__toArray();

        # the query property will be an empty array if it has no value
        if (count($this->query) === 0 && $toValues['query']) {
            $this->setQuery($toValues['query']);
        }

        $keys = ['scheme','user','pass','host','port','path','fragment'];
        foreach ($keys as $key) {
            if ($this->$key === null && $toValues[$key] !== null) {
                call_user_func([$this, 'set'.ucfirst($key)], $toValues[$key]);
            }
        }

        return $this;
    }
1299835
public function message($to, $message, $mediaUrls = null, array $params = [])
    {
        $params['body'] = $message;

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

        if (!empty($mediaUrls)) {
            $params['mediaUrl'] = $mediaUrls;
        }

        return $this->getTwilio()->messages->create($to, $params);
    }
456302
protected function createRequest($method, array $options)
    {
        $uri = $this->httpClient->getConfig('base_uri');
        $defaults = $this->httpClient->getConfig('defaults');
        $headers = isset($defaults['headers']) ? $defaults['headers'] : [];

        return $this->messageFactory->createRequest($method, $uri, $headers, $options);
    }
1199275
public function create($options = array()) {
        $options = new Values($options);

        $data = Values::of(array(
            'ExpirationDate' => Serialize::iso8601DateTime($options['expirationDate']),
            'Details' => $options['details'],
            'HiddenDetails' => $options['hiddenDetails'],
        ));

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new ChallengeInstance(
            $this->version,
            $payload,
            $this->solution['serviceSid'],
            $this->solution['identity'],
            $this->solution['factorSid']
        );
    }
1400
public function create($options = array()) {
        $options = new Values($options);

        $data = Values::of(array(
            'Identity' => Serialize::map($options['identity'], function($e) { return $e; }),
            'Tag' => Serialize::map($options['tag'], function($e) { return $e; }),
            'Body' => $options['body'],
            'Priority' => $options['priority'],
            'Ttl' => $options['ttl'],
            'Title' => $options['title'],
            'Sound' => $options['sound'],
            'Action' => $options['action'],
            'Data' => Serialize::jsonObject($options['data']),
            'Apn' => Serialize::jsonObject($options['apn']),
            'Gcm' => Serialize::jsonObject($options['gcm']),
            'Sms' => Serialize::jsonObject($options['sms']),
            'FacebookMessenger' => Serialize::jsonObject($options['facebookMessenger']),
            'Fcm' => Serialize::jsonObject($options['fcm']),
            'Segment' => Serialize::map($options['segment'], function($e) { return $e; }),
            'Alexa' => Serialize::jsonObject($options['alexa']),
            'ToBinding' => Serialize::map($options['toBinding'], function($e) { return $e; }),
        ));

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new NotificationInstance($this->version, $payload, $this->solution['serviceSid']);
    }
1228319
public function createSwooleServer(array $options = array())
    {
        if (array() === $options) {
            $options = array(
                'daemonize' => false,
                'worker_num' => 1,
            );
        }

        return new SwooleServer(
            new SwooleMessageTransformer($this->getPsr7Factory()),
            new SwooleServerOptions($options)
        );
    }
170142
public function message($from, $to, $body, $type = 'chat', $style='', $timestamp = null) {
        if(!$timestamp) $timestamp = microtime(true) * 1000;
		$data = array_merge($this->reqdata(), array(
			'nick' => $this->endpoint->nick,
			'to' => $to,
			'type' => $type,
			'body' => $body,
			'style' => $style,
			'timestamp' => $timestamp,
		));
        if($from) $data['from'] = $from;
		return $this->request('messages', $data, 'POST');
	}
1307412
public function notify(Message $message, $options=array())
    {
        $logger = $GLOBALS['logger'];
        $logger->debug(
            'Sending Voice Message ',
            array(
             $message->getFrom(),
             $message->getBody(),
            )
        );
        $path    = 'notifications/voice/send';
        $request = $this->_remoteServer->post($path);
        $request->setPostField('type', 'sms');
        $request->setPostField('from', $message->getFrom());
        $request->setPostField('to', implode(';', $message->getRecipients()));
        $request->setPostField('content', $message->getBody());

        try {
            $response = $request->send();
            if ($response->getStatusCode() !== 200) {
                throw new MessagingException();
            }

            $rawResponse = $response->getBody('true');

            return $rawResponse;
        } catch (\Exception $e) {
            throw new MessagingException();
        }

    }
780934
public static function createFrom(self $from, $to = null)
    {
        $request = $to ?: new static;

        $files = $from->files->all();

        $files = is_array($files) ? array_filter($files) : $files;

        $request->initialize(
            $from->query->all(),
            $from->request->all(),
            $from->attributes->all(),
            $from->cookies->all(),
            $files,
            $from->server->all(),
            $from->getContent()
        );

        $request->headers->replace($from->headers->all());

        $request->setJson($from->json());

        if ($session = $from->getSession()) {
            $request->setLaravelSession($session);
        }

        $request->setUserResolver($from->getUserResolver());

        $request->setRouteResolver($from->getRouteResolver());

        return $request;
    }
1277682
public function t($key, array $options = [], $locale = null)
    {
        return $this->translate($key, $options, $locale);
    }
672862
public static function getInstance( $options = [] )
	{
		if( is_null( self::$instance ) || !empty( $options ) ){
			self::$instance = new static( $options );
		}
		return self::$instance;
	}
1021370
public function createInstance($sid ,$token, $version = null, $retryAttempts = 1)
    {
        return new \Services_Twilio($sid, $token, $version, null, $retryAttempts);
    }
699555
public function appendMessage($message, $options = null, $internal_date = null) {
        return imap_append($this->client->getConnection(), $this->path, $message, $options, $internal_date);
    }
1059850
public function send($message, array $options = [])
    {
        $sms = new Message($options);
        $this->request('sms', $sms->getParams());
        $response = $this->getResponse();

        if ($response['error_code'] !== '000') {
            $this->errors[] = $response['error_code'];
            return false;
        }

        return true;
    }
296130
public function checkMessages(array $options = [])
    {
        $this->buildBody($options);

        $rawMessages = json_decode($this->getRequest()->getBody()->getContents());

        return $this->makeMessages($rawMessages->data);
    }