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

https://github.com/karser/mainsmsbundle

Bundle http://mainsms.ru/
https://github.com/karser/mainsmsbundle

Last synced: about 1 year ago
JSON representation

Bundle http://mainsms.ru/

Awesome Lists containing this project

README

          

Getting started with MainSMSBundle
=============

[MainSMS](http://mainsms.ru/)

## Prerequisites

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

## Installation

Installation is a quick 3 step process:

1. Download KarserMainSMSBundle using composer
2. Enable the Bundle
3. Configure the KarserMainSMSBundle

### Step 1: Download KarserMainSMSBundle using composer

Add KarserMainSMSBundle in your composer.json:

```js
{
"require": {
"karser/mainsms-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
get('karser.main_sms.model');
//or use getter trait
use \Karser\MainSMSBundle\Model\Getter;
$MainSMSModel = $this->getMainSmsModel($this->container);
//send message
$MainSMSModel->messageSend($number, $message, $sender);
```

You can check the balance by cli command:
```
$ app/console mainsms:balance
> Balance is 6.45
```

#### Schedule the message
Ensure that doctrine automapping is enabled:
``` yaml
doctrine:
orm:
auto_mapping: true
```
It maps the message to SMSTask entity and stores to the database.
``` php
$MainSMSManager = $this->get('karser.main_sms.manager');
//or use getter trait
use \Karser\MainSMSBundle\Manager\Getter;
$MainSMSManager = $this->getMainSmsManager($this->container);
//schedule message
$MainSMSManager->schedule($number, $message, $sender);
```
You can send it later by cli command:
```
$ app/console mainsms:send
> Balance is 6.45
> Messages to send 1
.
Done.
```