PHPackages                             voicecode-bv/nativephp-badge - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. voicecode-bv/nativephp-badge

ActiveNativephp-plugin[Utility &amp; Helpers](/categories/utility)

voicecode-bv/nativephp-badge
============================

Set the app icon badge counter from JS/PHP for NativePHP Mobile

v1.0.3(1mo ago)00MITKotlinPHP ^8.2

Since May 26Pushed 1mo agoCompare

[ Source](https://github.com/voicecode-bv/nativephp-badge)[ Packagist](https://packagist.org/packages/voicecode-bv/nativephp-badge)[ RSS](/packages/voicecode-bv-nativephp-badge/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

voicecode-bv/nativephp-badge
============================

[](#voicecode-bvnativephp-badge)

A small NativePHP Mobile plugin that sets the **app icon badge counter**(the red number on the app icon) from JavaScript.

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

[](#installation)

```
composer require voicecode-bv/nativephp-badge
```

The JS bridge is published under the `@voicecode-bv/nativephp-badge` import. Point your bundler at it (the package is installed into `vendor/voicecode-bv/nativephp-badge`):

```
// vite.config.ts
'@voicecode-bv/nativephp-badge': path.resolve(
    __dirname,
    'vendor/voicecode-bv/nativephp-badge/resources/js/index.ts',
),
```

```
// tsconfig.json
"paths": {
    "@voicecode-bv/nativephp-badge": ["./vendor/voicecode-bv/nativephp-badge/resources/js/index.ts"]
}
```

Why
---

[](#why)

iOS sets the icon badge automatically from the `aps.badge` field of an incoming push payload, but it does **not** decrement the badge when the user reads notifications inside the app. This plugin exposes a `Badge.Set` bridge function so the SPA can keep the badge in sync with the unread-notifications count.

Usage (JS)
----------

[](#usage-js)

```
import { setBadge } from '@voicecode-bv/nativephp-badge';

await setBadge(3); // show "3" on the app icon
await setBadge(0); // clear the badge
```

Platform notes
--------------

[](#platform-notes)

- **iOS**: sets the exact badge number via `UNUserNotificationCenter.setBadgeCount`.
- **Android**: numeric icon badges are launcher-dependent with no reliable launcher-agnostic API. `Badge.Set` only handles clearing (count `0`, via `NotificationManager.cancelAll()`); positive counts are a no-op and rely on the FCM push payload's `notification_count`.

Bridge function
---------------

[](#bridge-function)

NameParamsReturns`Badge.Set``{ count: int }``{ success: bool }`License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE). Copyright (c) Voicecode BV.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance88

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

4

Last Release

59d ago

### Community

Maintainers

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

---

Top Contributors

[![voicecode-bv](https://avatars.githubusercontent.com/u/4598259?v=4)](https://github.com/voicecode-bv "voicecode-bv (5 commits)")

### Embed Badge

![Health badge](/badges/voicecode-bv-nativephp-badge/health.svg)

```
[![Health](https://phpackages.com/badges/voicecode-bv-nativephp-badge/health.svg)](https://phpackages.com/packages/voicecode-bv-nativephp-badge)
```

PHPackages © 2026

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