pushinbr / pam-native-contacts
Device contacts and the SMS composer for PAM Native: paged contact reads, the new contact form and prefilled SMS.
Package info
github.com/push-in/pam-native-contacts
Type:pam-native-plugin
pkg:composer/pushinbr/pam-native-contacts
Requires
- php: ^8.5
- pushinbr/pam-native: ^1.53.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Device contacts and the SMS composer for PAM Native apps.
Paged contact reads, the system new-contact form and a prefilled SMS composer, from PHP.
Install · Quick example · Platforms · Permissions · Docs · Issues
Install
Inside a PAM Native project, add only this capability:
pam composer require pushinbr/pam-native-contacts pam doctor --fix
Requires pushinbr/pam-native 1.46 or newer (plugin hooks WatchChannel and ActivityResultHost). The plugin is discovered from Composer; no manual registration is needed. New to PAM? Create a project with pam init my-app --template native (see the PAM Native overview).
Quick example
use Pam\Native\Contacts\Contact; use Pam\Native\Contacts\Contacts; use Pam\Native\Contacts\Sms; Contacts::all(static function (array $contacts): void { // list<Contact>: displayName, phoneNumbers, emailAddresses }); Contacts::openNewContactForm(static function (bool $saved): void { // true when the user saved a contact }); Sms::compose(['+5511999999999'], 'Hi!', static function (): void {});
Contacts::all() reads the address book in pages of 250 and calls back once with every Contact (id, displayName, givenName, familyName, phoneNumbers, emailAddresses). Sms::compose() opens the platform composer; it never sends a message automatically.
Platform support
| Platform | Support | Notes |
|---|---|---|
| Android | API 24+ | Modules contacts and sms; no extra dependencies |
| iOS | 15.0+ | Contacts, ContactsUI, MessageUI |
| PAM Native | 1.46.0 to < 2.0.0 | From pam-native.plugin.json; PHP 8.5+ |
Permissions and requirements
| Platform | Declared by the plugin |
|---|---|
| Android | android.permission.READ_CONTACTS; package visibility (<queries>) for SENDTO smsto: |
| iOS | NSContactsUsageDescription ("Find people you know.") |
The new-contact form needs no contacts permission (Android ACTION_INSERT, iOS CNContactViewController).
The plugin manifest makes the SMS composer visible on Android 11+, so Sms works without the app declaring smsto in android.queries (PAM Native 1.54 removed it from the host manifest).
Migrating from the core
Moved out of the PAM Native core in 1.46: the core keeps only the base every app needs, and this feature ships as a plugin. The native module name and its wire payloads did not change.
The 1.46 core keeps the old class names (Pam\Native\System\... and the top-level value types) as deprecated aliases of this plugin's classes; they are removed in 1.47. Replace the imports with the Pam\Native\Contacts\... names above.
Tests
php tests/run.php # after composer install
PAM_NATIVE_SRC=../pam-native/packages/native/src php tests/run.php
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