PHPackages                             joeydendron/fbase-alerts - 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. [Database &amp; ORM](/categories/database)
4. /
5. joeydendron/fbase-alerts

ActiveLibrary[Database &amp; ORM](/categories/database)

joeydendron/fbase-alerts
========================

PHP package to create alerts in a Firebase real-time database

020PHP

Since Oct 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/joeydendron/fbase-alerts)[ Packagist](https://packagist.org/packages/joeydendron/fbase-alerts)[ RSS](/packages/joeydendron-fbase-alerts/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

joeydendron/fbase-alerts
========================

[](#joeydendronfbase-alerts)

Intro
-----

[](#intro)

I'd written a simple Alerter class, so that during PHP project development I could send informative alerts to a Slack channel.

But occasionally there are situations where code peppers the Slack channel with multiple alerts, and it's annoying to have to wade through and delete them in Slack's UI.

So as an exercise in getting to know Firebase I thought I'd replicate the functionality but with a Firebase backend... so I can build something like a Vue front-end with quick and easy alert deletion.

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

[](#requirements)

- PHP &gt;= 7.3
- A Firebase project with a real-time database that has an *alerts* key at the top level.

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

[](#installation)

`composer require joeydendron/fbase-alerts`

Relies on env variables for Firebase credentials
------------------------------------------------

[](#relies-on-env-variables-for-firebase-credentials)

As per [kreait/firebase setup instructions](https://firebase-php.readthedocs.io/en/stable/setup.html), the package requires you to download from Firebase a private key JSON file, which you need to save to your server in a safe location. You'll also need your real-time database URI, which I found in a copy-paste Javascript snippet in the General tab of my project's Settings.

Using a package like vlucas/dotenv, or PHP's putenv() function:

- Put the path to the JSON file in an environment variable named JD\_FIREBASE\_PATH\_TO\_CREDENTIALS
- Put the real-time database URI into an environment variable named JD\_FIREBASE\_DB\_URI

### Why use env variables?

[](#why-use-env-variables)

It means I can create an instance of Alerter without any external parameters, for simplicity of use (see below).

How to Use
----------

[](#how-to-use)

There are 3 static functions. Each calls for an instance of Alerter, which contains a reference to a Firebase DB object, and pushes an alert onto the DB's alerts collection.

**`Alerter::alert($subject, $body)`**

`$body`can be a string, number, array or object. It's converted to a string via print\_r() if required.

Prepends server hostname to `$subject`.

Then a new alert is pushed... as an associative array:

`[ 'subject' => $subject, 'body' => $body, 'created_at' => mktime() ]`

Firebase creates an ordered, alphanumeric ID for the alert.

**`Alerter::alertThrowable($subject, Throwable $throwable, $extraContent = [])`**

Calls Alerter::alert() with `$body`set to a sringified version of the Throwable. You can pass an optional array of values, and these will also be displayed in the resulting alert. So... you can write something like

`Alerter::alertThrowable('Oh dear', $throwable, [ 'important_variable' => $myVar ]);`

**`Alerter::alertException($subject, Exception $e, $extraContent = [])`**

Calls `Alerter::alertThrowable($subject, $e)`.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 91.3% 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.

### Community

Maintainers

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

---

Top Contributors

[![joeydendron](https://avatars.githubusercontent.com/u/87903971?v=4)](https://github.com/joeydendron "joeydendron (21 commits)")[![almostalldave](https://avatars.githubusercontent.com/u/71327855?v=4)](https://github.com/almostalldave "almostalldave (2 commits)")

### Embed Badge

![Health badge](/badges/joeydendron-fbase-alerts/health.svg)

```
[![Health](https://phpackages.com/badges/joeydendron-fbase-alerts/health.svg)](https://phpackages.com/packages/joeydendron-fbase-alerts)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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