Download the PHP package nativephp/mobile-clipboard without Composer
On this page you can find all versions of the php package nativephp/mobile-clipboard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nativephp/mobile-clipboard
More information about nativephp/mobile-clipboard
Files in nativephp/mobile-clipboard
Package mobile-clipboard
Short Description System clipboard access (copy/paste text) for NativePHP Mobile
License MIT
Informations about the package mobile-clipboard
Clipboard Plugin for NativePHP Mobile
System clipboard access (copy/paste plain text) for NativePHP Mobile applications.
Overview
The Clipboard API reads and writes plain text on the system clipboard. Two methods, no permissions, no events.
Installation
Usage
Methods
writeText(string $text): bool
Writes plain text to the system clipboard. Returns true once the text is on the clipboard, false on failure.
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
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:
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$textwhen 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).