PHPackages                             ably/ably-php-laravel - 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. ably/ably-php-laravel

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

ably/ably-php-laravel
=====================

Ably realtime REST PHP library wrapper for Laravel

1.0.8(3y ago)30319.6k↓11.1%6[1 issues](https://github.com/ably/ably-php-laravel/issues)[1 PRs](https://github.com/ably/ably-php-laravel/pulls)1Apache-2.0PHPPHP ^7.2 || ^8.0CI passing

Since Jul 11Pushed 8mo ago22 watchersCompare

[ Source](https://github.com/ably/ably-php-laravel)[ Packagist](https://packagist.org/packages/ably/ably-php-laravel)[ Docs](https://www.ably.com/)[ RSS](/packages/ably-ably-php-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (13)Used By (1)

[![Ably Pub/Sub PHP Laravel Header](images/LaravelSDK-github.png)](images/LaravelSDK-github.png)[![Latest Stable Version](https://camo.githubusercontent.com/46c9cf6a10a7c53e7095ad8d26a446f12fd19c183db097a9db503f7e5695a55d/68747470733a2f2f706f7365722e707567782e6f72672f61626c792f61626c792d7068702d6c61726176656c2f762f737461626c65)](https://packagist.org/packages/ably/ably-php-laravel)[![License](https://camo.githubusercontent.com/eb1257812525c26c5c8e5696d19fa84169ba2bd45b33acc1c466d516d95a80e9/68747470733a2f2f706f7365722e707567782e6f72672f61626c792f61626c792d7068702d6c61726176656c2f6c6963656e7365)](https://github.com/ably/ably-php-laravel/blob/main/LICENSE)

---

Ably Pub/Sub PHP Laravel SDK
============================

[](#ably-pubsub-php-laravel-sdk)

Build using Ably’s Pub/Sub PHP Laravel SDK, supported on all popular platforms and frameworks.

This Laravel package provides a clean integration with the [Ably PHP](https://github.com/ably/ably-php) SDK. It includes a Facade and an injectable `AblyService` that wrap a singleton Ably instance, with configuration automatically loaded from your environment variables or config files. Additionally, the `AblyFactory` class lets you create new Ably instances with custom parameters when needed.

This SDK provides REST-only functionality for Laravel. For full-featured Laravel integration including real-time capabilities, Ably recommend using [Ably's Laravel Broadcaster](https://github.com/ably/laravel-broadcaster).

Ably Pub/Sub provides flexible APIs that deliver features such as pub-sub messaging, message history, presence, and push notifications. Utilizing Ably’s realtime messaging platform, applications benefit from its highly performant, reliable, and scalable infrastructure.

Find out more:

- [Ably Pub/Sub docs.](https://ably.com/docs/basics)
- [Ably Pub/Sub examples.](https://ably.com/examples?product=pubsub)

---

Getting started
---------------

[](#getting-started)

Everything you need to get started with Ably:

- [Getting started in Pub/Sub using PHP.](https://ably.com/docs/getting-started/php?lang=php)
- [SDK Setup for PHP.](https://ably.com/docs/getting-started/setup?lang=php)

---

Supported platforms
-------------------

[](#supported-platforms)

Ably aims to support a wide range of platforms. If you experience any compatibility issues, open an issue in the repository or contact [Ably support](https://ably.com/support).

The PHP client library currently targets the [Ably 1.1 client library specification](https://www.ably.com/docs/client-lib-development-guide/features/).

Note

See [laravel-broadcaster](https://packagist.org/packages/ably/laravel-broadcaster/), if you're using Laravel and want to support Realtime broadcasting and events.

Important

PHP SDK versions &lt; 1.1.9 will be [deprecated](https://ably.com/docs/platform/deprecate/protocol-v1) from November 1, 2025.

---

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

[](#installation)

Install the package using [Composer](https://getcomposer.org/):

```
composer require ably/ably-php-laravel
```

Add the service provider in `config/app.php` to the `providers` array.

```
Ably\Laravel\AblyServiceProvider::class
```

Optionally add a reference to the facade in `config/app.php` to the `aliases` array.

```
'Ably' => Ably\Laravel\Facades\Ably::class
```

---

### Configuration

[](#configuration)

After registering the service provider, publish the configuration file using Artisan:

```
php artisan vendor:publish
```

Update the created file `config/ably.php` with your key or [other options](https://www.ably.com/docs/rest/usage#client-options). You can also set the key using an environment variable named `ABLY_KEY`.

Usage
-----

[](#usage)

The following sections demonstrates two ways to use Ably in Laravel: via a [Facade](#facade) or through [dependency injection](#dependency-injection).

Facade
------

[](#facade)

Use the Laravel facade to access the Ably client.

Facade usage details.The facade always returns a singleton instance created with options defined in the config file. Any methods available on an AblyRest class are available through the facade. Due to PHP limitations, properties must be accessed as methods, for example `Ably::auth()`):

```
use Ably;

echo Ably::time(); // 1467884220000
$token = Ably::auth()->requestToken([ 'clientId' => 'client123', ]); // Ably\Models\TokenDetails
Ably::channel('testChannel')->publish('testEvent', 'testPayload', 'testClientId');
```

Dependency injection
--------------------

[](#dependency-injection)

Use the dependency injection to access the Ably client.

Dependency injection usage details.You can use `Ably\Laravel\AblyService` instead of the facade, which acts as a 1:1 wrapper for an AblyRest singleton instance created with default options. `Ably\Laravel\AblyFactory` lets you instantiate new AblyRest instances with (optional) custom options.

```
use Ably\Laravel\AblyService;
use Ably\Laravel\AblyFactory;

function ablyExamples(AblyService $ably, AblyFactory $ablyFactory) {
	echo $ably->time(); // 1467884220000
	echo $ably->auth->clientId; // null
	$tokenDetails = $ably->auth->requestToken([ 'clientId' => 'client123', ]); // Ably\Models\TokenDetails
	$ably->channel('testChannel')->publish('testEvent', 'testPayload', 'testClientId');

	$ablyClient = $ablyFactory->make([ 'tokenDetails' => $tokenDetails ]);
	echo $ablyClient->auth->clientId; // 'client123'
}
```

---

Releases
--------

[](#releases)

The [CHANGELOG.md](CHANGELOG.md) contains details of the latest releases for this SDK. You can also view all Ably releases on [changelog.ably.com](https://changelog.ably.com).

---

Contributing
------------

[](#contributing)

Read the [CONTRIBUTING.md](./CONTRIBUTING.md) guidelines to contribute to Ably.

---

Support, feedback, and troubleshooting
--------------------------------------

[](#support-feedback-and-troubleshooting)

For help or technical support, visit the [Ably Support page](https://ably.com/support).

### Ably REST API

[](#ably-rest-api)

This SDK currently supports only the [Ably REST API](https://www.ably.com/docs/rest). If you need to subscribe to realtime events in PHP, consider using the [MQTT adapter](https://www.ably.com/docs/mqtt) to leverage [Ably's Realtime features](https://www.ably.com/docs/realtime).

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance41

Moderate activity, may be stable

Popularity45

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~225 days

Recently: every ~50 days

Total

11

Last Release

1341d ago

Major Versions

0.9.0 → 1.0.02017-03-07

PHP version history (2 changes)0.8.0PHP &gt;=5.4

1.0.3PHP ^7.2 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![owenpearson](https://avatars.githubusercontent.com/u/48608556?v=4)](https://github.com/owenpearson "owenpearson (30 commits)")[![sacOO7](https://avatars.githubusercontent.com/u/16723785?v=4)](https://github.com/sacOO7 "sacOO7 (24 commits)")[![mattheworiordan](https://avatars.githubusercontent.com/u/43789?v=4)](https://github.com/mattheworiordan "mattheworiordan (10 commits)")[![bladeSk](https://avatars.githubusercontent.com/u/4263742?v=4)](https://github.com/bladeSk "bladeSk (5 commits)")[![QuintinWillison](https://avatars.githubusercontent.com/u/8318344?v=4)](https://github.com/QuintinWillison "QuintinWillison (4 commits)")[![franrob-projects](https://avatars.githubusercontent.com/u/111994975?v=4)](https://github.com/franrob-projects "franrob-projects (3 commits)")[![robbydooo](https://avatars.githubusercontent.com/u/3592735?v=4)](https://github.com/robbydooo "robbydooo (2 commits)")[![Srushtika](https://avatars.githubusercontent.com/u/5900152?v=4)](https://github.com/Srushtika "Srushtika (2 commits)")[![niksilver](https://avatars.githubusercontent.com/u/149467?v=4)](https://github.com/niksilver "niksilver (1 commits)")

---

Tags

client-librarylaravelphpsdklaravelrestmessagingably

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ably-ably-php-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/ably-ably-php-laravel/health.svg)](https://phpackages.com/packages/ably-ably-php-laravel)
```

###  Alternatives

[lomkit/laravel-rest-api

A package to build quick and robust rest api for the Laravel framework.

59152.2k](/packages/lomkit-laravel-rest-api)[francescomalatesta/laravel-api-boilerplate-jwt

An API Boilerplate to create a ready-to-use REST API in seconds.

1.2k7.5k](/packages/francescomalatesta-laravel-api-boilerplate-jwt)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[tartanlegrand/laravel-openapi

Generate OpenAPI Specification for Laravel Applications

38178.7k2](/packages/tartanlegrand-laravel-openapi)[xtend-packages/rest-presenter

REST API Presenter &amp; Generator for Laravel

771.5k](/packages/xtend-packages-rest-presenter)[api-skeletons/laravel-api-problem

Problem Details for HTTP APIs for Laravel

118.4k1](/packages/api-skeletons-laravel-api-problem)

PHPackages © 2026

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