| title | Using Plugins |
|---|---|
| order | 200 |
Plugins are standard Composer packages. Install them like any other Laravel package:
composer require vendor/nativephp-plugin-nameThe plugin's PHP service provider will be auto-discovered by Laravel, but the native code won't be included in builds until you explicitly register it.
Premium plugins from the NativePHP Plugin Marketplace are served via a private Composer repository. You'll need to configure Composer before you can install them.
1. Add the NativePHP plugins repository:
composer config repositories.nativephp-plugins composer https://plugins.nativephp.com2. Configure your credentials:
composer config http-basic.plugins.nativephp.com your-email@example.com your-license-keyYou can find your credentials on your Purchased Plugins dashboard.
3. Install the plugin:
Once configured, install premium plugins just like any other:
composer require vendor/nativephp-premium-pluginFor security, plugins must be explicitly registered before their native code is compiled into your app. This prevents transitive dependencies from automatically including native code without your consent.
First, ensure you've published the NativeServiceProvider:
php artisan vendor:publish --tag=nativephp-plugins-providerThen register the plugin:
php artisan native:plugin:register vendor/nativephp-plugin-nameThis adds the plugin to your app/Providers/NativeServiceProvider.php file.
Check that NativePHP sees your plugin:
php artisan native:plugin:listYou'll see the plugin name, version, and what it provides (bridge functions, events, hooks).
After installing a plugin, rebuild to compile its native code:
php artisan native:runThe plugin's Swift and Kotlin code gets compiled into your app automatically.
Each plugin provides its own facade for interacting with native functionality.
use Vendor\PluginName\Facades\PluginName;
// Call a native function
$result = PluginName::doSomething(['option' => 'value']);Plugins dispatch events to your Livewire components. Use the #[OnNative] attribute to listen for them:
use Native\Mobile\Attributes\OnNative;
use Vendor\PluginName\Events\SomethingCompleted;
#[OnNative(SomethingCompleted::class)]
public function handleCompletion($result)
{
// React to the event
}Each plugin should document its available methods, events, and any required permissions. Look for a README or docs in the plugin's repository.
Some plugins require additional permissions. These are declared in the plugin's manifest and automatically merged into your app's configuration during build.
If a plugin needs camera access, microphone, or other sensitive permissions, you'll see them listed when you run
native:plugin:list.
To completely uninstall a plugin:
php artisan native:plugin:uninstall vendor/nativephp-plugin-nameThis command:
- Unregisters the plugin from your
NativeServiceProvider - Removes the package via Composer
- Removes the path repository from
composer.json(if applicable) - Optionally deletes the plugin source directory (for local path repositories)
Use --force to skip confirmation prompts, or --keep-files to preserve the source directory when uninstalling
a local plugin.
Find ready-made plugins for common use cases, or get the Dev Kit to build your own. Visit the NativePHP Plugin Marketplace →