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/
- Host: GitHub
- URL: https://github.com/karser/mainsmsbundle
- Owner: karser
- Created: 2013-01-02T15:01:36.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2014-02-08T11:54:47.000Z (over 12 years ago)
- Last Synced: 2025-02-14T04:47:57.955Z (over 1 year ago)
- Language: PHP
- Size: 203 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.
```