PHPackages                             sqmk/pushy - 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. sqmk/pushy

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

sqmk/pushy
==========

A PHP client for Pushover.net

v1.4.3(4y ago)4315.5k2[1 PRs](https://github.com/sqmk/Pushy/pulls)2BSD-3-ClausePHPPHP &gt;=5.4.0

Since May 21Pushed 4y ago2 watchersCompare

[ Source](https://github.com/sqmk/Pushy)[ Packagist](https://packagist.org/packages/sqmk/pushy)[ Docs](http://github.com/sqmk/Pushy)[ RSS](/packages/sqmk-pushy/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (3)Versions (12)Used By (2)

Pushy - Pushover.net client for PHP
===================================

[](#pushy---pushovernet-client-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/f16b3262b17e008a785dced223fb76790bdc8113593f9e05c8bdd6b0f99a65b9/68747470733a2f2f706f7365722e707567782e6f72672f73716d6b2f50757368792f76657273696f6e)](https://packagist.org/packages/sqmk/Pushy)[![Build Status](https://camo.githubusercontent.com/188dc92ed17e9865728644abf90f6d348b57c037ac393c29433641d2b6cc23d2/68747470733a2f2f6170692e7472617669732d63692e6f72672f73716d6b2f50757368792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sqmk/Pushy)

Introduction
------------

[](#introduction)

Pushy is a PHP client that makes communicating with [Pushover.net](https://pushover.net)'s API simple.

Pushy makes full use of Pushover's API. This includes sending messages, validating users, and retrieving message statuses.

Interested in sending real-time mobile notifications to your iOS or Android device(s) from your web app? Take a look at [Pushover.net](https://pushover.net). API usage is free, and extremely easy to use with Pushy!

Requirements
------------

[](#requirements)

- PHP 5.4+
- cURL extension

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

[](#installation)

You can install Pushy by using [composer](http://getcomposer.org). Simply add the dependency to your `composer.json` configuration:

```
{
  "require": {
    "sqmk/pushy": "dev-master"
  }
}
```

See [composer](http://getcomposer.org) and [packagist](https://packagist.org) for more information.

Usage
-----

[](#usage)

Assuming your composer generated or custom autoloader can load Pushy files properly, using it is simple!

For those interested in the complete API, you can check out the auto-generated documentation at [GitApiDoc](http://gitapidoc.com/api/sqmk/Pushy/).

### Initializing client

[](#initializing-client)

In order to send a message, verify a user, or get a message status, you'll first need an application API key. You can get an API key by registering a new application on [Pushover.net](https://pushover.net).

Once you acquire your application key, you can now instantiate a Pushy Client object.

```
// Instantiate a client object with application key
$pushy = new Pushy\Client('KzGDORePK8gMaC0QOYAMyEEuzJnyUi');
```

### Sending messages

[](#sending-messages)

You have a client instantiated, now you can send a message. But first, you want to build a user object for the receiving user.

You'll need to get your user identifier (or user key) at [Pushover.net](https://pushover.net). You'll also want a registered device name if you want to send a message to a single device. You can now create a user object with these details.

```
// Instantiate a user object (targets all devices)
$user = new Pushy\User('pQiRzpo4DXghDmr9QzzfQu27cmVRsG');

// Alternatively, instantiate a user object with a targeted device
$user = new Pushy\User('pQiRzpo4DXghDmr9QzzfQu27cmVRsG', 'droid2');

// Setting properties by chaining is also possible
$user = (new Pushy\User('pQiRzpo4DXghDmr9QzzfQu27cmVRsG'))
  ->setDeviceName('droid2');
```

After creating a user, you have enough to start creating a message.

```
// Instantiate a message object with a message body
$message = new Pushy\Message('Your message body');

// Set the recipient of the message
$message->setUser($user);

// Set the title
$message->setTitle('You message title');

// Set a priority (defaults to NormalPriority)
$message->setPriority(
  new Pushy\Priority\LowPriority
);

// Set a sound (defaults to PushoverSound)
$message->setSound(
  new Pushy\Sound\AlienSound
);

// Set a supplementary URL and title
$message->setUrl(
  'http://example.org'
);

$message->setUrlTitle(
  'Example.org'
);

// Set a custom sent timestamp
$message->setTimestamp(1369111110);

// All methods above are chainable
$message = (new Pushy\Message)
  ->setMessage('Your message body')
  ->setTitle('Your message title')
  ->setUser($user);
```

To send the message, pass the message object to the client.

```
// Send the previous created message
$pushy->sendMessage($message);
```

If no exceptions are thrown, the message was sent successfully. No data is returned by the sendMessage method unless the message has an emergency priority.

#### Emergency priority messages

[](#emergency-priority-messages)

You can send a message with an emergency priority and get a receipt id. Emergency priorities also have additional options.

```
// Create a message with emergency priority
$message = (new Pushy\Message)
  ->setMessage('Important message')
  ->setTitle('Important subject')
  ->setUser($user)
  ->setPriority(
    (new Pushy\Priority\EmergencyPriority)
      // Resend message to user every X seconds
      ->setRetry(30)
      // Expire message after X seconds
      ->setExpire(3600)
      // Set callback URL to hit when user acknowledges message
      ->setCallback('http://example.org/api')
  );

// Send message and get receipt id
$receiptId = $pushy->sendMessage($message);
```

With a receipt Id, you can cancel messages with an emergency priority:

```
$pushy->cancelEmergency($receiptId);
```

#### Priorities

[](#priorities)

The list of available priorities in Pushy\\Priority:

- LowestPriority
- LowPriority
- NormalPriority (default)
- HighPriority
- EmergencyPriority

#### Sounds

[](#sounds)

The list of available sounds in Pushy\\Sound:

- AlienSound
- BikeSound
- BugleSound
- CashregisterSound
- ClassicalSound
- ClimbSound
- CosmicSound
- EchoSound
- FallingSound
- GamelanSound
- IncomingSound
- IntermissionSound
- MagicSound
- MechanicalSound
- NoSound
- PersistentSound
- PianobarSound
- PushoverSound (default)
- SirenSound
- TugboatSound
- UpdownSound

### Verifying a user

[](#verifying-a-user)

A user object can be verified with Pushover prior to sending out messages.

```
// Pass previous instantiated user object to the client
try {
  $pushy->verifyUser($user);

  echo 'User is valid';
} catch (Pushy\Transport\Exception\ApiException $e) {
  echo 'User is not valid';
}
```

### Getting message status

[](#getting-message-status)

When using an emergency priority with a message, you get a receipt code after sending the message successfully. You can get the status of the message by sending the receipt code by way of `getMessageStatus`.

```
// Get message with the receipt code
$messageStatus = $pushy->getMessageStatus($receiptCode);

// Was the message acknowledged? (true or false)
$messageStatus->isAcknowledged();

// When the message was acknowledged (DateTime or null)
$messageStatus->acknowledgedAt();

// When the message was last delivered (DateTime or null)
$messageStatus->lastDeliveredAt();

// Is the message expired? (true or false)
$messageStatus->isExpired();

// When the message expired (DateTime or null)
$messageStatus->expiresAt();

// Has Pushover contacted the callback URL? (true or false)
$messageStatus->hasCalledBack();

// When Pushover contacted the callback URL (DateTime or null)
$messageStatus->calledBackAt();
```

Getting application limitations
-------------------------------

[](#getting-application-limitations)

[Pushover.net](https://pushover.net) allows you to send 7,500 messages per month for each application you own. Sending more than that limit will result in rejected requests from the service.

Pushy provides 3 convenience methods on the client to retrieve your app's message limit, remaining messages, and timestamp for when the limit is reset. These values are available after making any other request to Pushover.

```
// Call limit for the application per month.
$pushy->getAppLimit();

// Calls remaining for the month.
$pushy->getAppRemaining();

// Timestamp for when calls remaining is reset to limit.
$pushy->getAppReset();
```

Command-line Interface
----------------------

[](#command-line-interface)

Included in Pushy is a convenient script to send messages from the command line.

You can call it like so:

```
$ bin/pushy --token=yourtokenhere --user-id=useridhere --message="Message here" --title="Title here" --url="http://example.org" --url-title="Example.org" --timestamp=123456 --sound=echo --priority=high
```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 98.6% 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 ~304 days

Recently: every ~616 days

Total

11

Last Release

1746d ago

Major Versions

v0.1.0 → v1.0.02013-08-30

PHP version history (2 changes)v0.1.0PHP 5.4.\*

v1.0.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/93f56df734dcca5f2f998e5203f3146c7de9d7c18dd3e0ca68f7a31e73bc22f4?d=identicon)[sqmk](/maintainers/sqmk)

---

Top Contributors

[![sqmk](https://avatars.githubusercontent.com/u/279474?v=4)](https://github.com/sqmk "sqmk (211 commits)")[![martinlindhe](https://avatars.githubusercontent.com/u/181531?v=4)](https://github.com/martinlindhe "martinlindhe (3 commits)")

---

Tags

clientpushoverpushy

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/sqmk-pushy/health.svg)

```
[![Health](https://phpackages.com/badges/sqmk-pushy/health.svg)](https://phpackages.com/packages/sqmk-pushy)
```

###  Alternatives

[php-http/httplug

HTTPlug, the HTTP client abstraction for PHP

2.6k319.6M745](/packages/php-http-httplug)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k334.1M1.5k](/packages/php-http-discovery)[php-http/client-common

Common HTTP Client implementations and tools for HTTPlug

1.1k233.5M629](/packages/php-http-client-common)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78127.2M458](/packages/react-http)[mashape/unirest-php

Unirest PHP

1.3k9.9M163](/packages/mashape-unirest-php)[smi2/phpclickhouse

PHP ClickHouse Client

84711.1M81](/packages/smi2-phpclickhouse)

PHPackages © 2026

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