How nativephp/kitchen-sink-mobile works
Project type and purpose
• This is a full-stack, embedded-mobile demonstration: a “Mobile Kitchen Sink” app built on top of Laravel, Livewire, and NativePHP.
• It showcases dozens of native device features (camera, geolocation, storage, notifications, etc.) via Livewire components inside a PHP-powered mobile runtime.
File-structure analysis
• Top-level directories:
• app/ → Laravel core (MVC controllers, models, services, events)
• bootstrap/ → framework bootstrap & provider registration
• config/ → Laravel & NativePHP configuration
• database/ → migrations for users, cache, jobs
• public/ → entry point (index.php) & static assets
• resources/ → Blade views, Livewire view templates, CSS/JS assets
• routes/ → HTTP, console, channels definition
• storage/ → app files, cache, sessions, logs
• native/ → NativePHP engine artifacts
• tests/ → unit & feature tests
• build files: vite.config.js, tailwind.config.js, package.json
• Presence of Livewire (app/Livewire, resources/views/livewire) indicates component-driven UI with real-time XHR/WebSocket updates.
• The .env, artisan, composer.json indicate a Laravel backend. The “native” folder and php artisan native:* commands signal NativePHP’s embedded-server on device.
README insights
• Purpose: demo for NativePHP for Mobile license & Flux UI Pro.
• Installation steps: clone, composer+npm install, build assets, run php artisan native:install & native:run → launches on device.
Main components
a. Mobile Device & OS
• Shows the handset running Android/iOS.
• NativePHP runtime embedded in the app.
b. PHP Application Server
• Laravel entry point (public/index.php → bootstrap → service providers).
• HTTP kernel & Livewire kernel.
c. Livewire Component Layer
• PHP components (app/Livewire) ↔ JS runtime in WebView
• Blade templates & Flux UI Pro shaders.
d. Asset Pipeline
• Vite dev server / build → app.css, app.js, echo.js
• Tailwind CSS
e. Data Storage
• Local database (SQLite or configured DB in config/database.php)
• File storage (storage/app/private & public)
• Cache & sessions (storage/framework)
• Queues (jobs table)
f. Native Device Services
• Camera, Microphone, Geolocation, Push Notifications, Haptics, Secure Storage, etc.
• Exposed via Livewire components that fire events to the PHP backend.
g. External Services
• WorkOS (config/workos.php, AuthKit), maybe broadcast driver (Pusher/Echo).
• Any third-party APIs (e.g., cloud mail, queue, cache services if configured).
Relationships & data flows
• UI Interaction (touch)
→ Livewire JS component
→ AJAX/WebSocket request to Livewire kernel
→ Controller / Livewire class (app/Livewire)
→ Optional Service classes (app/Services) or Models (app/Models)
→ Database / Storage / External API
→ Response back to Livewire JS
→ DOM diff applied in WebView
• Events: Laravel events (app/Events) broadcast via Echo → Livewire listeners → front-end update.
• Console commands (app/Console) for setup, migrations, native:install, native:run.
Architectural patterns & principles
• MVC at the core (Controllers, Models, Views)
• Component-based UI via Livewire (separation of stateful UI logic)
• Event-driven updates (Laravel Events + Echo)
• Service layer for business logic (app/Services/KitchenSinkService)
• Clear separation: Frontend assets vs. backend runtime vs. device bridges
Essential elements summary
• Components: OS/Device, NativePHP, Laravel Kernel, Livewire Layer, Blade + Flux UI, Asset Bundler, DB & Storage, External APIs
• Data flows: user input → Livewire → backend → persistence → front-end update
• Patterns: MVC, Component-based, Event-driven
• Technologies: PHP 8+, Laravel, Livewire, NativePHP, Vite, Tailwind, Flux UI, WorkOS API