First-Party Plugins

NativePHP Plugin

The first-party NativePHP plugin lints NativePHP Mobile Blade views before the native compiler receives them. Its rules cover element structure, supported attributes and events, native styling, bindings, callbacks, identity, themes, and accessibility conventions.

#Requirements

The plugin supports the following versions:

Dependency Supported version
PHP 8.4 or 8.5
Sheath 1.x
NativePHP Mobile 4.x

Native rules are disabled when the resolved compiler is outside the supported 4.x line.

#Installation

Install the package as a development dependency. Laravel discovers its service provider automatically:

composer require --dev fortephp/sheath-nativephp

Add nativephp after your Core preset in config/sheath.php:

<?php
return [
'preset' => ['recommended', 'nativephp'],
];

Preset order matters because nativephp supplies scoped overrides for a few Core HTML rules that do not apply to native layouts. Listing recommended after nativephp would replace those overrides.

You can also select the preset for one run:

php artisan sheath:lint --preset=nativephp

#Native View Detection

By default, a rule runs only when the file is under resources/views/native or the template uses tags that only the native renderer understands. Ordinary web views remain under Core's HTML and Blade rules.

If native views live elsewhere, configure the same paths on the native rules:

<?php
return [
'rules' => [
'native-unknown-element' => ['error', [
'nativeViewPaths' => ['resources/views/mobile'],
]],
'native-dead-class' => ['warning', [
'nativeViewPaths' => ['resources/views/mobile'],
]],
],
];

Setting nativeViewPaths switches detection to paths only, preventing web components with native-looking names from being classified as native views.

Mirror the same location in any Core exclude overrides that your project adds for native markup. See the universal exclude option.

#Rule Reference

The nativephp preset enables the plugin rules with severities chosen for the compiler behavior or interface guidance they model.

Search by rule name or behavior, or filter by rule family, severity, or auto-fix support. Open a rule for its examples and constraints.

You can override any severity or disable individual rules through the ordinary rules configuration.

#Compiler-Derived Behavior

The plugin uses the installed compiler's elements, components, attributes, events, enum values, navigation transitions, theme tokens, and native class support. This keeps findings aligned with the compiler configured by the application.

If the plugin cannot resolve required compiler information, it skips only the checks that depend on that information. An application without the nativephp/mobile package does not receive NativePHP diagnostics.

#Component-Aware Rules

Callback and model rules resolve the Blade component that owns a native view. They validate public methods, required arguments, component properties, and locked state without invoking the component.

Changes to component source, themes, native registries, or compiler state invalidate the affected cached findings.

#Dynamic Configuration

When a result depends on dynamic plugin registries, unresolved component ownership, opaque callback expressions, or runtime-generated values, the native rules skip the check unless the installed compiler state proves the defect.

#See Also