PHPackages                             nativephp/mobile-clipboard - 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. nativephp/mobile-clipboard

ActiveNativephp-plugin

nativephp/mobile-clipboard
==========================

System clipboard access (copy/paste text) for NativePHP Mobile

1.0.0(1mo ago)27071MITPHPPHP ^8.2

Since Jul 16Pushed 1mo agoCompare

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

READMEChangelog (2)Dependencies (6)Versions (4)Used By (0)

Clipboard Plugin for NativePHP Mobile
=====================================

[](#clipboard-plugin-for-nativephp-mobile)

System clipboard access (copy/paste plain text) for NativePHP Mobile applications.

Overview
--------

[](#overview)

The Clipboard API reads and writes plain text on the system clipboard. Two methods, no permissions, no events.

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

[](#installation)

```
composer require nativephp/mobile-clipboard
php artisan native:plugin:register nativephp/mobile-clipboard
```

Usage
-----

[](#usage)

```
use NativePHP\Clipboard\Facades\Clipboard;

// Copy text to the clipboard
$copied = Clipboard::writeText('Hello from NativePHP!');   // true on success

// Read text from the clipboard
$text = Clipboard::readText();   // string, or null if the clipboard has no text

if ($text !== null) {
    // Use the pasted text
}
```

Methods
-------

[](#methods)

### `writeText(string $text): bool`

[](#writetextstring-text-bool)

Writes plain text to the system clipboard. Returns `true` once the text is on the clipboard, `false` on failure.

### `readText(): ?string`

[](#readtext-string)

Reads plain text from the system clipboard. Returns `null` when the clipboard is empty or holds no text.

Both methods degrade gracefully when the native bridge isn't available (running tests, CI): `writeText()` returns `false` and `readText()` returns `null` — no exception is thrown.

Testing
-------

[](#testing)

The plugin extends the NativePHP testing suite with clipboard-specific helpers, so your app tests can fake and assert clipboard activity without knowing any bridge internals:

```
use Native\Mobile\Testing\Native;

it('copies the invite link', function () {
    Native::fakeBridge()->withClipboard();

    Native::test(ShareSheet::class)
        ->tap('Copy link')
        ->assertCopied('https://example.com/invite/abc');
});

it('pastes into the form', function () {
    Native::fakeBridge()->withClipboard('+1 555 0100');

    Native::test(SignupScreen::class)
        ->tap('Paste number')
        ->assertSet('phone', '+1 555 0100');
});
```

### Helpers

[](#helpers)

- `withClipboard(string $text = '')` — fake the clipboard's contents. Reads return the current text; writes succeed and update it, so copy-then-paste flows behave like a real clipboard.
- `assertCopied(?string $text = null)` — assert something was copied, or exactly `$text` when given.
- `assertNothingCopied()` — assert no write happened.

The helpers are available on `Native::fakeBridge()` and chain directly off `Native::test(...)`. They register automatically while running tests (requires a core with a macroable FakeBridge; on older cores they simply don't register).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance91

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Total

2

Last Release

43d ago

Major Versions

0.0.1 → 1.0.02026-07-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/16cc4d562d3f6f302901f1c65eb3ce819c0fb24ab2616241c605126102812ca4?d=identicon)[shanerbaner82](/maintainers/shanerbaner82)

---

Top Contributors

[![shanerbaner82](https://avatars.githubusercontent.com/u/5580860?v=4)](https://github.com/shanerbaner82 "shanerbaner82 (6 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/nativephp-mobile-clipboard/health.svg)

```
[![Health](https://phpackages.com/badges/nativephp-mobile-clipboard/health.svg)](https://phpackages.com/packages/nativephp-mobile-clipboard)
```

###  Alternatives

[nativephp/mobile-starter

The skeleton application for NativePHP for Mobile.

273.9k](/packages/nativephp-mobile-starter)

PHPackages © 2026

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