nativemobile / laravel-mobile-ui
PHP-first mobile UI package for Android WebView β Alpine.js + Livewire v4 components
Requires
- php: ^8.2
Requires (Dev)
- laravel/framework: ^12.0
- livewire/livewire: ^4.0
- orchestra/testbench: ^9.0
- pestphp/pest: ^2.0
README
<<<<<<< HEAD
php-mobile-ui β Laravel Mobile UI Package
======= <<<<<<< HEAD
Laravel Native Mobile UI
46a38dd77910e6d7e54f8f3015560b957cfdd758
A PHP-first, mobile-native UI component library for Laravel + Livewire v4 Built by Elegant Media for Android WebView and NativePHP applications.
π― One-Year Vision
This package powers the mobile storefront experience for two Elegant Media brands:
| Brand | Product | Goal |
|---|---|---|
| Elegant Media | Internal tooling & client apps | A premium PHP component SDK that competes with Flutter's widget philosophy, without leaving Laravel |
| The Appliance Store | Consumer-facing mobile commerce | A high-performance product browsing, cart, and checkout UI entirely driven by Livewire v4 components |
π¦ Installation
composer require nativemobile/laravel-mobile-ui
The package auto-discovers its service provider via Laravel's package auto-discovery.
πΊοΈ Phased Roadmap
β Phase 1 β Foundation (Q1 2026)
Goal: Solid base that all future components inherit from.
Widgetβ Abstract base class with fluent CSS API andHtmlableintegration:- Spacing:
->padding(),->paddingX(),->paddingY(),->margin(),->marginX(),->marginY() - Appearance:
->background(),->color(),->borderRadius(),->opacity(),->shadow() - Layout:
->width(),->height(),->overflow() - Identity:
->id(),->class(),->attr()
- Spacing:
Stylablecontract β defines the fluent style interfaceRenderablecontract βrender(): stringHtmlableintegration βtoHtml()and__toString()for seamless Blade rendering
// Works directly in Blade templates {!! TextView::make()->text('Hello, World!')->padding('16px')->background('#6200EE')->color('#fff') !!} // Or as a Blade variable (Htmlable autorender) $widget = TextView::make()->text('Hello')->padding('16px'); // {{ $widget }} works without {!! !!} escaping issues
β Phase 2 β Layouts (Q1βQ2 2026)
Goal: Flutter-style declarative layout primitives.
| Component | Description |
|---|---|
Column |
Vertical flex layout. mainAxisAlignment, crossAxisAlignment, gap, scrollable |
Row |
Horizontal flex layout. Same API, adds wrap, horizontal scrollable |
Stack |
Absolute-positioned layers with 9-point alignment grid |
Scaffold |
Full-screen page shell composing AppBar + body + BottomNavigation + FAB |
Scaffold::make() ->appBar(AppBar::make()->title('Products')->withDrawer()) ->body( Column::make() ->padding('16px') ->gap('12px') ->scrollable() ->children($productWidgets) ) ->bottomNav( BottomNavigation::make() ->tabs(config('mobile-nav.bottom')) ->active('products') ->badges(['cart' => $cartCount]) )
β Phase 3 β Navigation (Q2 2026)
Goal: Persistent, state-aware navigation with real-time badge counters.
| Component | Feature |
|---|---|
BottomNavigation |
Real-time badge counters (dot for 1, numeric for 2β99, "99+" cap). Livewire reactive via wire:click. |
NavigationDrawer |
Side-panel with per-item badge support, Alpine.js open/close, Android back-button integration |
AppBar |
Android status bar color sync, drawer toggle, back button, action slots |
// Real-time cart badge via Livewire property BottomNavigation::make() ->tabs(config('mobile-nav.bottom')) ->active($this->activeTab) ->livewire('switchTab') ->badges([ 'cart' => $this->cartCount, // Updates reactively 'notifications' => $this->unreadCount, ]) ->badgeColor('#E53935')
β Phase 4 β Data (Q2βQ3 2026)
Goal: High-performance data rendering using the itemBuilder pattern from Flutter.
ListView β Closure-based list rendering:
ListView::make() ->items($this->products) ->itemBuilder(function (array $product, int $index): string { return Card::make() ->title($product['name']) ->subtitle('$' . $product['price']) ->render(); }) ->separator('#f0f0f0') ->onScrollEnd('loadMore') // Livewire infinite scroll ->padding('0 16px')
π Phase 5 β Livewire Single-File Components (Q3 2026)
Goal: .wire.php single-file components for reactive native-feel interactions.
<livewire:mobile.product-list />β SFC with virtual scroll<livewire:mobile.cart-drawer />β Persistent cart state<livewire:mobile.search-bar />β Debounced live search- NativePHP v3.1 EDGE tag integration for hardware haptics and status bar
π Phase 6 β Native Bridge (Q4 2026)
Goal: Deep NativePHP v3.1 integration for a true native feel.
AndroidBridgeJS interface wrappers (haptics, status bar, camera, file picker)- Push notification bridge with Livewire event syncing
NativeGestureDetectorfor swipe, long-press, and pinch
π§© Component Catalogue
Layout
| Class | Description |
|---|---|
AppBar |
Fixed top bar with status bar color sync |
BottomNavigation |
Tab bar with badge counters |
NavigationDrawer |
Slide-in side menu |
Column |
Vertical flex layout |
Row |
Horizontal flex layout |
Stack |
Layered absolute positioning |
Scaffold |
Full-screen page shell |
Modal |
Bottom sheet / dialog |
UI
| Class | Description |
|---|---|
TextView |
Styled text with typography helpers |
Button |
Tap targets with haptic feedback |
Card |
Elevated content container |
Image |
Lazy-loaded with srcset |
Carousel |
Touch-swipe with Alpine.js |
ListView |
itemBuilder list renderer |
ProgressBar |
Linear or circular |
Slider |
Range input |
Link |
Accessible anchors |
π§ͺ Testing
Tests live in packages/php-mobile-ui/tests/ and run via Pest v4.
# From the Laravel app root php artisan test --compact --filter=mobile-ui # From the package directory ./vendor/bin/pest
Coverage:
WidgetStylingTestβ 15 tests covering all fluent CSS propertiesColumnRowTestβ 14 tests for Column, Row, Stack layoutsListViewTestβ 11 tests for itemBuilder, separators, scroll wiring
βοΈ Configuration
php artisan vendor:publish --tag=mobile-ui-config
Edit config/mobile-ui.php to define your navigation tabs, brand colors, and NativePHP bridge settings.
π’ Credits
Developed and maintained by Elegant Media β elegantmedia.com.au
- Mobile commerce platform: The Appliance Store
- Architecture: Mobile-first Laravel with Livewire v4
- Target runtime: Android WebView via NativePHP v3.1
Licensed MIT. PHP 8.2+ required.