PHPackages                             mp091689/turbosms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. mp091689/turbosms

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mp091689/turbosms
=================

Package for TurboSms gateway based on SQL connection

v1.0.0(8y ago)040MITPHPPHP &gt;=5.4.0

Since Jul 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mykytapopov/TurboSms)[ Packagist](https://packagist.org/packages/mp091689/turbosms)[ Docs](https://github.com/mp091689/TurboSms)[ RSS](/packages/mp091689-turbosms/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

\#Installation

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require mp091689/turbosms
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

\#Usage Create new instance of TurboSms lib to send sms, check status, receive list, delete scheduled sms. TurboSms server is `94.249.146.189`, database `users`, the table name same as login of gateway connection.

```
new \mp091689\TurboSms\TurboSms($host, $db_name, $user, $password);

```

\##Sending

Send sms to specified number with specified text.

```
send(string $number, string $message, string $sign = 'Msg', timestamp $time = null, string $wappush = '', boolean $is_flash = false);

```

Returns an object that contains params of sent message.

\######Arguments

**number** - string, contains phone number in international format only digits *(38050123456789)*.

**message** - string, the text of sent message. [Read the rules of composing messages](https://turbosms.ua/guide.html).

**sign** - string, alpha-name must be registered on the service.

**time** - timestamp, the sms will be sent at the set time. The datetime format 'YYYY-MM-DD HH:MM'.

**wappush** - string, link WapPush, including http://

**is\_flash** - boolean, flash flag of the message

\######Response

Returns an object with the parameters of the sent message.

```
object(mp091689\TurboSms\SmsEntity)
  private 'id' => string '856' (length=3)
  private 'msg_id' => null
  private 'number' => string '380501234567' (length=12)
  private 'sign' => string 'Msg' (length=3)
  private 'message' => string 'Hello world!' (length=12)
  private 'wappush' => string '' (length=0)
  private 'is_flash' => string '0' (length=1)
  private 'cost' => null
  private 'balance' => null
  private 'added' => string '2017-07-14 18:42:50' (length=19)
  private 'send_time' => string '2017-07-14 18:45' (length=19)
  private 'sended' => null
  private 'received' => null
  private 'error_code' => null
  private 'status' => null

```

- The fields are populated by the server after the message is processed. If NULL is specified in the field values, then processing has not yet been performed.
- Some phone models do not support wappush and flash messages.
- Date format for all datetime fields: YYYY-MM-DD HH:MM, the time zone based on connection.

\######Examples

```
// Create new TurboSms instance
$turbo = new \mp091689\TurboSms\TurboSms('94.249.146.189', 'users', '', '');

// Send sms
$result = $turbo->send('380507095075', 'Hello world!');

// Send sms with specified alpha-name
$result = $turbo->send('380507095075', 'Hello world!', 'Msg');

// Send sms at set time
$result = $turbo->send('380507095075', 'Hello world!', 'Msg', '2017-07-14 18:50');

```

\##Retrieving data

\###Find one instance of sms by id.

```
findById(integer $id)

```

Returns an object of sms.

\######Arguments

**id** - integer, identifier of wanted instance.

\######Response

```
object(mp091689\TurboSms\SmsEntity)
  private 'id' => string '1' (length=2)
  private 'msg_id' => string '499514b3-56c7-e1f4-5159-e607425c776c' (length=36)
  private 'number' => string '380501234567' (length=12)
  private 'sign' => string 'Msg' (length=10)
  private 'message' => string 'Hello World!' (length=12)
  private 'wappush' => string '' (length=0)
  private 'is_flash' => string '0' (length=1)
  private 'cost' => string '1.00' (length=4)
  private 'balance' => string '139.00' (length=6)
  private 'added' => string '2017-07-14 20:50:08' (length=19)
  private 'send_time' => null
  private 'sended' => string '2016-02-19 20:56:09' (length=19)
  private 'received' => string '2016-02-19 20:56:15' (length=19)
  private 'error_code' => string '0' (length=1)
  private 'status' => string 'DELIVRD' (length=7)

```

\######Examples

```
// Create new TurboSms instance
$turbo = new \mp091689\TurboSms\TurboSms('94.249.146.189', 'users', '', '');

// Find sms by id
$result = $turbo->find(1);

```

\###Find list of sms by conditions.

```
find(array $conditions = [], array $orderBy = [], integer $limit = null, integer $page = null)

```

Returns an array of an objects.

\######Arguments

**conditions** - array, the associative array `$key => $value`where the `$key` is equals to column name in the table and `$value` is wanted string.

**orderBy** - array, the associative array `$key => $value`where the `$key` is equals to column name in the table for ordering and `$value` is method of ordering `ASC/DESC`.

**limit** - integer, limit the number of records returned based on a limit value.

**page** - integer, for pagination, works only if limit is specified.

\######Response

```
[
  ...,
  object(mp091689\TurboSms\SmsEntity),
  ...
]

```

\######Examples

```
