This skill provides understanding of NativePHP Mobile internals. Use when the user asks about "how NativePHP works", "god method", "nativephp_call", "bridge functions", "bridge registration", "EDGE system", "element definition", "native events", "event dispatching", "WebView communication", or how PHP communicates with native iOS/Android code.
/plugin marketplace add NativePHP/ClaudePlugins/plugin install nativephp-plugin-dev@nativephp-mobile-pluginThis skill inherits all available tools. When active, it can use any tool Claude has access to.
NativePHP Mobile enables Laravel developers to build native iOS and Android applications. This skill explains the core architecture.
nativephp_callThe foundation of NativePHP's native communication is the "god method" - nativephp_call. This single function handles ALL PHP-to-native communication.
// PHP side - calling native functionality
$result = nativephp_call('Dialog.Alert', [
'title' => 'Hello',
'message' => 'Welcome to NativePHP!'
]);
The call flows through:
nativephp_call('Method.Name', $params)Native bridge functions must be registered before they can be called. Registration maps method names to implementation classes.
Android (Kotlin):
fun registerBridgeFunctions(activity: FragmentActivity, context: Context) {
val registry = BridgeFunctionRegistry.shared
// Core NativePHP functions
registry.register("Dialog.Alert", DialogFunctions.Alert(activity))
registry.register("QrCode.Scan", QrCodeFunctions.Scan(activity))
registry.register("Network.Status", NetworkFunctions.Status(context))
// Plugin functions get registered here too
registry.register("MyPlugin.Execute", MyPluginFunctions.Execute(activity))
}
iOS (Swift):
func registerBridgeFunctions() {
let registry = BridgeFunctionRegistry.shared
registry.register("Dialog.Alert", DialogFunctions.Alert())
registry.register("QrCode.Scan", QrCodeFunctions.Scan())
registry.register("Network.Status", NetworkFunctions.Status())
// Plugin functions
registry.register("MyPlugin.Execute", MyPluginFunctions.Execute())
}
Bridge function names follow Namespace.Action pattern:
Dialog.Alert - Show an alert dialogCamera.Capture - Capture a photoHaptics.Vibrate - Trigger haptic feedbackMyPlugin.DoSomething - Plugin-specific actionEDGE is NativePHP's system for rendering native UI elements from PHP/Blade templates. Instead of rendering HTML, EDGE creates native iOS/Android UI.
// In a Blade template
<x-native::bottom-nav>
<x-native::bottom-nav-item
icon="home"
label="Home"
route="home"
/>
<x-native::bottom-nav-item
icon="settings"
label="Settings"
route="settings"
/>
</x-native::bottom-nav>
This generates a JSON structure that native code interprets to render a real native bottom navigation bar.
| Aspect | EDGE (Native) | WebView |
|---|---|---|
| Rendering | Native UIKit/Jetpack | HTML/CSS |
| Performance | Native speed | Web performance |
| Look & Feel | Platform native | Web-like |
| Use Case | Navigation, tabs, dialogs | App content |
When native code needs to notify PHP (e.g., photo captured, scan completed), it dispatches events.
import android.os.Handler
import android.os.Looper
import org.json.JSONObject
// MUST dispatch on main thread for JavaScript execution
Handler(Looper.getMainLooper()).post {
val payload = JSONObject().apply {
put("path", filePath)
put("mimeType", "image/jpeg")
}
NativeActionCoordinator.dispatchEvent(
activity,
"Native\\Mobile\\Events\\Camera\\PhotoCaptured",
payload.toString()
)
}
// Already on main thread typically
let payload: [String: Any] = [
"path": filePath,
"mimeType": "image/jpeg"
]
LaravelBridge.shared.send?(
"Native\\Mobile\\Events\\Camera\\PhotoCaptured",
payload
)
// Event class - simple POJO, no broadcasting
class PhotoCaptured
{
use Dispatchable, SerializesModels;
public function __construct(
public string $path,
public string $mimeType = 'image/jpeg'
) {}
}
// Livewire component listening for the event
class PhotoUploader extends Component
{
#[On('native:Native\Mobile\Events\Camera\PhotoCaptured')]
public function handlePhotoCaptured($path, $mimeType = null)
{
// Process the captured photo
$this->photoPath = $path;
}
}
ShouldBroadcast, no channels#[On('native:...')] - The native: prefix is requiredNativePHP apps run inside a WebView that loads PHP-rendered HTML:
┌─────────────────────────────────────┐
│ Native App Shell │
│ ┌───────────────────────────────┐ │
│ │ EDGE Native Elements │ │
│ │ (Bottom Nav, Status Bar) │ │
│ ├───────────────────────────────┤ │
│ │ │ │
│ │ WebView │ │
│ │ (PHP/Laravel Content) │ │
│ │ │ │
│ │ ┌─────────────────────┐ │ │
│ │ │ JavaScript Bridge │ │ │
│ │ │ (nativephp_call) │ │ │
│ │ └─────────────────────┘ │ │
│ │ │ │
│ └───────────────────────────────┘ │
│ │
│ ┌───────────────────────────────┐ │
│ │ Bridge Function Registry │ │
│ │ (Native Kotlin/Swift) │ │
│ └───────────────────────────────┘ │
└─────────────────────────────────────┘
During NativePHP installation, PHP binaries are downloaded that contain:
nativephp_callThese binaries are platform-specific and handle the low-level communication between PHP and native code.
| Concept | Purpose |
|---|---|
nativephp_call | PHP function to invoke native code |
| Bridge Functions | Native classes that handle nativephp_call requests |
| Bridge Registry | Maps method names to bridge function classes |
| EDGE | Native UI rendering from Blade components |
| Event Dispatching | Native-to-PHP communication via JavaScript injection |
| WebView | Container for PHP-rendered content |
$status = nativephp_call('Network.Status', []);
// Returns: ['connected' => true, 'type' => 'wifi']
$result = nativephp_call('Camera.Capture', ['quality' => 80]);
// Returns: ['id' => 'uuid-here']
// Later: native:Native\Mobile\Events\Camera\PhotoCaptured event fires
nativephp_call('Haptics.Vibrate', ['pattern' => 'success']);
// Returns: ['success' => true]
// No follow-up event
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.