Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/karser/smsbundle


https://github.com/karser/smsbundle

Last synced: 9 days ago
JSON representation

Awesome Lists containing this project

README

        

Getting started with SMSBundle
=============

## Prerequisites

This version of the bundle requires Symfony 2.1+ and Doctrine ORM 2.2+

## Installation

### Step 1: Download KarserSMSBundle using composer

Add KarserSMSBundle in your composer.json:

```js
{
"require": {
"karser/sms-bundle": "dev-master",
}
}
```

Now tell composer to download the bundle by running the command:

``` bash
$ php ./composer.phar update
```

Composer will install the bundle to your project's `vendor/karser` directory.

### Step 2: Enable the bundle

Enable the bundle in the kernel:

``` php
createdAt = new \DateTime();
}

/**
* @param string $sessionId
*/
public function setSessionId($sessionId)
{
$this->sessionId = $sessionId;
}

/**
* @return string
*/
public function getSessionId()
{
return $this->sessionId;
}

/**
* @param int $userId
*/
public function setUserId($userId)
{
$this->userId = $userId;
}

/**
* @return int
*/
public function getUserId()
{
return $this->userId;
}

/**
* @param string $ipAddress
*/
public function setIpAddress($ipAddress)
{
$this->ipAddress = $ipAddress;
}

/**
* @return string
*/
public function getIpAddress()
{
return $this->ipAddress;
}

/**
* Set createdAt
*
* @param \DateTime $createdAt
* @return SmsTask
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;

return $this;
}

/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
}
```

### Step 5: Available backends

- [MainSMS](http://mainsms.ru/): [KarserMainSMSBundle](https://github.com/karser/MainSMSBundle)
- [SMSVesti](http://smsvesti.ru/): [KarserSMSVestiBundle](https://github.com/karser/SMSVestiBundle)

### Usage Steps
``` php
$task = new \Your\Module\Entity\SmsTask();
$task->setPhoneNumber('+799999999999');
$task->setMessage('ni hao');
$task->setSender('your_friend');

$handler = $container->get('karser.sms.manager')->getDefaultHandler();
$msg_id = $handler->send($task);
$status = $handler->checkStatus($task->getMessageId());
if ($status === SMSTaskInterface::STATUS_PROCESSING) {
//is sent
}
```