public function testCreate() { $dispatchers = $this->getMessageDispatchers(); foreach ($dispatchers as $dispatcher) { $class = 'Omnimessage\\MessageDispatcher\\' . $dispatcher; $omni = Omnimessage::create($dispatcher); $this->assertInstanceOf($class, $omni); } }
<?php require_once dirname(__DIR__) . '/vendor/autoload.php'; use Omnimessage\Omnimessage; $url = ''; $web = Omnimessage::create('Web'); $web->setUrl($url)->setBody(array('message' => 'hello world'))->send(); if ($web->isSuccessful()) { echo "Message sent\n"; } else { echo "Message not sent\n"; }
<?php require_once dirname(__DIR__) . '/vendor/autoload.php'; use Omnimessage\Omnimessage; $slack = Omnimessage::create('Slack'); $token = 'token'; $channel = 'channel'; $username = '******'; $team = 'team'; $slack->setToken($token)->setTeam($team)->setChannel($channel)->setUsername($username)->setBody('Test sms')->send(); if ($slack->isSuccessful()) { echo "Message sent\n"; } else { echo "Message not sent\n"; }
<?php require_once dirname(__DIR__) . '/vendor/autoload.php'; use Omnimessage\Omnimessage; $twilio = Omnimessage::create('Twilio'); $account_sid = 'account_sid'; $auth_token = 'auth_token'; $from = 'from number'; $to = 'to number'; $twilio->setAccountSid($account_sid)->setAuthToken($auth_token)->setFrom($from)->setTo($to)->setBody('Test sms')->send(); if ($twilio->isSuccessful()) { echo "Message sent\n"; } else { echo "Message not sent\n"; }
<?php require_once dirname(__DIR__) . '/vendor/autoload.php'; use Omnimessage\Omnimessage; $token = 'token'; $room = 'room'; $hipchat = Omnimessage::create('HipChat'); $hipchat->setToken($token)->setRoom($room)->setBody('hello world')->send(); if ($hipchat->isSuccessful()) { echo "Message sent\n"; } else { echo "Message not sent\n"; }
<?php require_once dirname(__DIR__) . '/vendor/autoload.php'; use Omnimessage\Omnimessage; $email = Omnimessage::create('Email'); // Set smtp transport $email->setTransport('smtp', array('host' => 'localhost', 'port' => 25)); // Set mail transport (PHP mail) // $email->setTransport('mail'); // Set send mail transport (Default send mail command is: /usr/sbin/sendmail -bs) // $email->setTransport('send_mail'); // Create the message $email->setSubject('Test message')->setFrom('*****@*****.**')->setTo('*****@*****.**')->setReplyTo('*****@*****.**')->setBody('This is a test message')->send(); if ($email->isSuccessful()) { echo "Message sent\n"; } else { echo "Message not sent\n"; }