pushinbr / pam-native-toast
Optional native toast for PAM Native.
Package info
github.com/push-in/pam-native-toast
Language:Swift
Type:pam-native-plugin
pkg:composer/pushinbr/pam-native-toast
Requires
- php: ^8.5
- pushinbr/pam-native: ^1.53.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Optional native toast for PAM Native.
Moved out of the PAM Native core in 1.46.6: install it only when your app shows toasts. Without this plugin the host ships no toast renderer.
Install · Quick example · Platforms · Migration · Docs · Issues
Install
Inside a PAM Native project (PAM Native 1.46.6 or later):
pam composer require pushinbr/pam-native-toast pam doctor --fix
Composer and the PAM launcher discover pam-native.plugin.json, register the PHP provider and compile the native sources; there is no manual module installation. Rebuild the native host after adding the package.
New to PAM? Create a project with pam init my-app --template native (see the PAM Native overview).
Quick example
use Pam\Native\Toast\{Toast, ToastPosition, ToastType}; Toast::show('Saved'); Toast::message('Saved', 'Changes completed.', type: ToastType::Success, position: ToastPosition::Bottom, durationMs: 2200, offset: 140, );
ARGB colors, fonts, icons, border, radius, dimensions and variants keep the same parameters as the previous core API (borderColor, borderWidth, cornerRadius, accentWidth, elevation, paddings, minHeight, titleLines, fitContent, icon, iconFont, iconColor, iconSize). ToastType (Success, Error, Info) and ToastPosition (Top, Bottom) are sequential integer enums starting at 1. You can also call NativeModules::call('toast', 'show', $values, $callback) directly.
Platform support
| Platform | Support | Notes |
|---|---|---|
| Android | API 24+ | Kotlin, androidx.core:core-ktx 1.17.0 |
| iOS | 15.0+ | UIKit, CoreText, ImageIO |
| PAM Native | 1.46.6 to < 2.0.0 | From pam-native.plugin.json; PHP 8.5+ |
Behavior
- At most one toast is visible. Replacement, host dismissal and backgrounding cancel the presentation and its timers.
- Icons are decoded at a bounded size; fonts have a bounded cache.
- Position respects the safe area and follows the keyboard.
- No permissions are declared.
Migration and compatibility
The historical NativeOperation::Toast is only forwarded by the core to toast.show in the generic module registry.
The old core names (Pam\Native\System\Toast, ToastType, ToastPosition) are MovedToPlugin shims for one minor version. With the plugin installed they become aliases and emit a deprecation; without it, the error tells you to install pushinbr/pam-native-toast. Migrate imports to Pam\Native\Toast. This plugin imposes no dependency on other apps.
Testing
PHP regressions live in tests/core-compat.php; Android tests in android/src; Swift tests in ios/Tests. How to run each and what device validation must cover: docs/testing.md.
Docs
Part of the PAM ecosystem
PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.
| PAM | PAM Desktop | PAM Native | Ecosystem |
|---|---|---|---|
| the runtime and CLI | native desktop apps in PHP | native Android and iOS apps in PHP | every official package and plugin |
Docs: push-in.github.io/pam-docs · Issues
Apache License 2.0 · Made in Brazil by Pushin