Download the PHP package atendwa/nativephp-sms-reader without Composer

On this page you can find all versions of the php package atendwa/nativephp-sms-reader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nativephp-sms-reader

atendwa/nativephp-sms-reader

A NativePHP Mobile plugin for Laravel that lets your Android app read SMS messages from the device inbox and listen for incoming SMS in real time.


Introduction

atendwa/sms-reader bridges the Android SMS ContentProvider and BroadcastReceiver into your Laravel application. It provides:

The plugin only operates inside the NativePHP Android runtime. On the web, in Artisan, or on iOS it returns empty results rather than throwing, so your code runs safely in all environments.


Requirements

Requirement Version
PHP 8.3+
Laravel 11+
NativePHP Mobile 3.0+
Android API 26+ (Android 8.0)

Installation

1. Add the package via Composer

2. Register the plugin with NativePHP

NativePHP requires every plugin to be explicitly registered as a security measure — it prevents transitive Composer dependencies from silently bundling native code into your app.

This adds the service provider to app/Providers/NativeServiceProvider.php:

3. Rebuild the app

Plugin changes require a full rebuild:


Verifying the Installation

Check the plugin is registered

You should see atendwa/sms-reader in the output.

Validate the plugin manifest

Test the bridge on-device

Add a temporary debug button in a Livewire component to confirm the bridge is reachable:

If the bridge is working you will see a JSON string like:

If nativephp_call() does not exist (e.g. you are running on the web), the method returns a descriptive string rather than throwing.


Usage

Reading inbox messages

Available options:

Option Type Description
sender string Filter by originating address (exact match)
limit int Maximum number of messages to return (default 500)
since int Only return messages newer than this Unix timestamp in milliseconds

Reading from multiple senders

Results are merged and sorted by timestamp descending.

Listening for incoming SMS (real time)

Use the #[OnNative] attribute in any Livewire component:

Livewire v3 & v4: The #[OnNative] attribute is provided by NativePHP Mobile and works with both Livewire v3 and v4.


JavaScript Usage

For Vue, React, Inertia, or vanilla JS apps, import directly from the package's JS file:

TypeScript definitions are included at resources/js/smsReader.d.ts.

Reading inbox messages

Reading from multiple senders

Listening for incoming SMS (real time)

If you prefer to use NativePHP's own JS event bus directly, the exported constant SMS_RECEIVED_EVENT holds the fully-qualified event class name:

Vue 3 (Composition API)

React


Permissions

The plugin declares the required permissions automatically via nativephp.json. You do not need to add them manually.

Permission Purpose
READ_SMS Query the inbox ContentProvider
RECEIVE_SMS Listen for incoming messages via BroadcastReceiver

On Android 6.0+ these are runtime permissions. The plugin requests them automatically the first time getMessages() is called. If the user has not granted them yet, a RuntimeException is thrown with the message:

SmsReader bridge error [PERMISSION_REQUIRED]: READ_SMS permission has not been granted...

Show the user a prompt and retry after they grant the permission.


Error Handling

getMessages() throws a RuntimeException in these situations:

Condition Exception message
nativephp_call not in registry SmsReader.GetMessages not found in bridge registry
Bridge returned invalid JSON SmsReader bridge returned invalid JSON: ...
Permission not granted SmsReader bridge error [PERMISSION_REQUIRED]: ...
Permission denied by system SmsReader bridge error [PERMISSION_DENIED]: ...
Any other native error SmsReader bridge error [ERROR_CODE]: ...

The JavaScript getMessages() function throws an Error with the same message format:


Testing

The package ships with a Pest test suite that covers all three methods and the SmsReceived event. Because the bridge only exists inside the NativePHP Android runtime, tests use a thin subclass that overrides two protected hook methods (isOnDevice() and callBridge()) to simulate on-device behaviour without requiring a real device.


Support

Found a bug or have a question? Open an issue on GitHub or reach out directly:

Email: [email protected]


License

MIT — Copyright © 2026 Anthony Tendwa


All versions of nativephp-sms-reader with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^11.0|^12.0
nativephp/mobile Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package atendwa/nativephp-sms-reader contains the following files

Loading the files please wait ...