PHPackages                             getmo/smartpush-php-connector - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. getmo/smartpush-php-connector

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

getmo/smartpush-php-connector
=============================

Php library to connect with Smartpush API services

v0.3.0(9y ago)019MITPHPPHP &gt;=5.5.9

Since Feb 5Pushed 9y ago3 watchersCompare

[ Source](https://github.com/Getmo-Inc/Smartpush-Php-Connector)[ Packagist](https://packagist.org/packages/getmo/smartpush-php-connector)[ Docs](https://github.com/Getmo-Inc/Smartpush-Php-Connector)[ RSS](/packages/getmo-smartpush-php-connector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)DependenciesVersions (9)Used By (0)

Smartpush PHP connector
=======================

[](#smartpush-php-connector)

Php library to connect with Smartpush API services.

Installation
------------

[](#installation)

```
composer require getmo/smartpush-php-connector
```

Platforms
---------

[](#platforms)

Use one of the these platforms when you see `$platform` on the docs above.

```
$platforms = ['IOS', 'ANDROID', 'WINDOWS', 'CHROME', 'SAFARI', 'FIREFOX'];
```

Usage
-----

[](#usage)

Import the Push class into your project.

```
use Smartpush\Push;
use Smartpush\Notification; // optional, use only if you will consult data from server
```

### Class: Push

[](#class-push)

---

**Description**: Create a new push instance.

**Example**:

```
$push = new Push(string $devid, string $when = 'now', string $alias = '');
```

> The second and thirth parameters are optional. The second `$when` parameter can handle this entry models: **'now'**, **'0000-00-00 00:00:00'**, **'00/00/000 00:00:00'**, or a valida UNIX timestamp. The thirth `$alias` paramenter sets a custom name for this Push Notification, so you can track it later on control panel.

#### Method: setEnvironment()

[](#method-setenvironment)

---

**Description**: (Optional) Set the environment you want to use to sent this Push Notification.

**Example**:

```
$push->setEnvironment(string $envinronment = '1'); # This method return $this, so you can chain it.
```

**Return**:

```
$this; # so you can chain methods!
```

> This method is optional. If you dont set the environment, the lib will guess you choose `production`. If you want to use `sandbox`, use this method with $environment = '0'.

#### Method: addNotification()

[](#method-addnotification)

---

**Description**: Add a notification to the Push payload.

**Example**:

```
$push->addNotification(string $appid, string $platform, array $params);
# or
$push->addNotification(string $appid, string $platform, object $params);
```

**Return**:

```
$this; # so you can chain methods!
```

> The thirth parameter, **$params**, must be an `array` or an `object` (If you pass in an array the lib will turn it into an object). The content schema variates according the platform. Consult the REST API docs to obtain the correct schema for the platform that you want to target.

#### Method: getNotifications()

[](#method-getnotifications)

---

**Description**: (Optional) Return an array of Notifications that you have previously configured to send.

**Example**:

```
$notifications = $push->getNotifications();
foreach ($notifications as $notification) {
    echo $notification->appid;
    echo $notification->platform;
    var_dump($notification->params);
}
```

**Return**:

```
array; # of objects
```

> This method can be used to inspect the Notifications data inside the Push object before sending.

#### Method: setFilterRange()

[](#method-setfilterrange)

---

**Description**: (Optional) Set the range days of which the filter will operate when the job is processed. The $range value can be one of there: `7`, `15`, `30`, `60`, `90`, `all`, otherwise it will fallback to default: `all`.

**Example**:

```
$push->setFilterRange(string $range);
```

**Return**:

```
$this; # so you can chain methods!
```

#### Method: setFilterOperator()

[](#method-setfilteroperator)

---

**Description**: (Optional) Set the operator of which the filter will use to do comparisons. The $operator value can be one of there: `AND`, `OR`, otherwise it will fallback to default: `AND`.

**Example**:

```
$push->setFilterOperator(string $operator);
```

**Return**:

```
$this; # so you can chain methods!
```

#### Method: addTag()

[](#method-addtag)

---

**Description**: Add a Tag to filter the Push Notification devices.

**Example**:

```
$push->addTag(string $key, string $value);
# or
$push->addTag(string $key, string $comparator, string $value);
```

**Return**:

```
$this; # so you can chain methods!
```

> The thirth parameter is optional. If you suppress the `$comparator` parameter the lib will guess you want to `Equal` (=) this entry. The complete list of comparators you find out in the REST API docs.

#### Method: getTags()

[](#method-gettags)

---

**Description**: (Optional) Return an `array` of Tags that you have previously configured to send.

**Example**:

```
$tags = $push->getTags();
foreach ($tags as $tag) {
    var_dump($tags);
}
```

**Return**:

```
array; # of tags
```

> This method can be used to inspect the Notifications data inside the Push object before sending.

#### Method: getPayload()

[](#method-getpayload)

---

**Description**: (Optional) Return the complete payload that you have previously configured to send. If you pass `true` in the first parameter, the method will return a JSON string, otherwise an array.

**Example**:

```
var_dump($push->getPayload()); # array
# or
var_dump($push->getPayload(true)); # JSON string
```

**Return**:

```
'{...}' || array; # JSON string or array
```

> This method can be used to inspect the data inside every notification before sending it.

#### Method: send()

[](#method-send)

---

**Description**: Send the Push Notification previously configured. If the inputs dont validate this methos will return `false`, otherwise `true`.

**Example**:

```
if ($push->send()) {
    # ...
} else {
    # ...
}
```

**Return**:

```
true || false;
```

> If this method return `false` probably you forgot to config a notification or a tag.

#### Method: getResult()

[](#method-getresult)

---

**Description**: Grab the server response after send a Push Notification. One of the most important information that returns in the JSON string is the **pushid**.

**Example**:

```
$result = $push->getResult();
$data = json_decode($result);
echo $data->pushid;
```

**Return**:

```
'{...}'; # JSON string
```

#### Method: getInfo()

[](#method-getinfo)

---

**Description**: Consult server for the status (and more information) about a Push Notification.

**Example**:

```
$info = $push->getInfo(string $pushid);
$data = json_decode($info);

var_dump($data->notifications); # array of information about all notifications of this push.
foreach ($data->notifications as $notification) {
    echo $notification->appid;
    echo $notification->status;
    # if push was sent the follow property will be available.
    echo $notification->sent_at;
}
...
# if push was configured to be sent at a future moment in time, this two properties will be available.
echo $data->{'time-left'};
echo $data->date;
```

**Return**:

```
'{...}'; # JSON string
```

#### Method: cancel().

[](#method-cancel)

---

**Description**: Cancel and Consult server for the status (and more information) about a Push Notification.

**Example**:

```
$push->cancel(string $pushid);
# or
$info = $push->cancel(string $pushid);
# Here, $info get the same result as getInfo() mention above.
```

**Return**:

```
'{...}'; # JSON string
```

> You can only cancel Push Notifications which were not sent.

#### Method: hide().

[](#method-hide)

---

**Description**: Cancel and Consult server for the status (and more information) about a Push Notification.

**Example**:

```
$push->hide(string $pushid);
# or
$info = $push->hide(string $pushid);
# Here, $info get the same result as getInfo() mention above.
```

**Return**:

```
'{...}'; # JSON string
```

### Class: Notification

[](#class-notification)

---

**Description**: Create a new notification instance.

**Example**:

```
$notification = new Notification(string $devid, string $appid, string $platform);
```

#### Method: getLastNotifications()

[](#method-getlastnotifications)

---

**Description**: Get the last ten (10) notifications of a specific `hwid`.

**Example**:

```
$result = $notification->getLastNotifications(string $hwid, array $options);
```

**Return**:

```
'{...}'; # JSON string
```

> The second parameter, **$options**, is optional. It must be an `array` and can have the following keys: `show`, `startingDate`, `dateFormat`. Consult the REST API docs to get more information about there optional arguments.

#### Method: getLastUnreadNotifications()

[](#method-getlastunreadnotifications)

---

**Description**: Get the last ten (10) unread notifications of a specific `hwid` (device).

**Example**:

```
$result = $notification->getLastUnreadNotifications(string $hwid, array $options);
```

**Return**:

```
'{...}'; # JSON string
```

> The second parameter, **$options**, is optional. It must be an `array` and can have the following keys: `show`, `startingDate`, `dateFormat`. Consult the REST API docs to get more information about there optional arguments.

#### Method: getExtraPayload()

[](#method-getextrapayload)

---

**Description**: Get the extra payload for a specific `pushid`.

**Example**:

```
$result = $notification->getExtraPayload(string $pushid);
```

**Return**:

```
'{...}'; # JSON string
```

#### Method: readOneNotification()

[](#method-readonenotification)

---

**Description**: Mark one Push Notification as READ for a specific `hwid` (device).

**Example**:

```
$notification->readOneNotification(string $hwid, string $pushid);
```

#### Method: readAllNotifications()

[](#method-readallnotifications)

---

**Description**: Mark all Push Notifications as READ for a specific `hwid` (device).

**Example**:

```
$notification->readAllNotifications(string $hwid);
```

#### Method: hideHwidNotification()

[](#method-hidehwidnotification)

---

**Description**: Hide one Push Notification for a specific `hwid` (device).

**Example**:

```
$notification->hideHwidNotification(string $hwid, string $pushid);
```

### Support

[](#support)

Jonathan Martins, `webmaster@getmo.com.br`
------------------------------------------

[](#jonathan-martins-webmastergetmocombr)

> Developed by Getmo

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~34 days

Total

7

Last Release

3599d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/df52d610b41e6ab418dfdb8a4b7607ebdf39dc129d60b452788827267b123985?d=identicon)[jonathanpmartins](/maintainers/jonathanpmartins)

---

Top Contributors

[![getmo-technology](https://avatars.githubusercontent.com/u/12748986?v=4)](https://github.com/getmo-technology "getmo-technology (24 commits)")[![jonathanpmartins](https://avatars.githubusercontent.com/u/6137992?v=4)](https://github.com/jonathanpmartins "jonathanpmartins (12 commits)")

---

Tags

phpapipushnotificationservicesaassmartpush

### Embed Badge

![Health badge](/badges/getmo-smartpush-php-connector/health.svg)

```
[![Health](https://phpackages.com/badges/getmo-smartpush-php-connector/health.svg)](https://phpackages.com/packages/getmo-smartpush-php-connector)
```

###  Alternatives

[ladumor/one-signal

Laravel Wrapper for OneSignal.

125331.3k](/packages/ladumor-one-signal)[joetannenbaum/phpushbullet

PHP API wrapper for Pushbullet.

3146.4k4](/packages/joetannenbaum-phpushbullet)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[sly/pushover

A PHP library for easy PushOver service use: send real-time notifications to your Android and iOS devices.

3431.6k2](/packages/sly-pushover)[leonardoteixeira/pushover

A simple PHP library for the Pushover service

1827.7k3](/packages/leonardoteixeira-pushover)[dropfan/onesignal-server-api

OneSignal server API for PHP, you can push notifications to any platform. (iOS/APNS, Android/GCM/FCM, WP, Web/Chrome/Safari...etc.) No third-party dependency that you can use this library in any project or framework.

169.2k](/packages/dropfan-onesignal-server-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
