-
-
Notifications
You must be signed in to change notification settings - Fork 79
π Mobile v1.1 Documentation Updates #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
593fde1
Updates some of the docs for mobile
shanerbaner82 9fefd45
Updates ordering for docs
shanerbaner82 e6d3fa0
Merge branch 'main' into docs-updates
shanerbaner82 a699a30
updates doc
shanerbaner82 bdcac7b
π Update mobile v1.1 documentation structure and content
shanerbaner82 6783490
Resolve merge conflicts with main branch
shanerbaner82 c364c16
Merge remote-tracking branch 'origin/main' into v1.1-docs-updates
shanerbaner82 cd6f1d0
Update resources/views/docs/mobile/1/apis/camera.md
shanerbaner82 1c0ad47
More docs updates
shanerbaner82 033fd97
Update mobile documentation with enhanced deep links, push notificatiβ¦
shanerbaner82 69832bf
Update Dialog API documentation for new alert implementation
shanerbaner82 4ba3bdc
Add Browser API documentation for in-app browser functionality
shanerbaner82 36c6d88
Update resources/views/docs/mobile/1/the-basics/icu-support.md
shanerbaner82 df3c84a
Update resources/views/docs/mobile/1/apis/browser.md
shanerbaner82 90ae4c3
Update mobile documentation with API improvements and platform notes
shanerbaner82 14bbdf7
Simplify versioning documentation with Laravel-inspired approach
shanerbaner82 0c7714c
Update Browser API documentation with new methods and improved structure
shanerbaner82 639ec1d
polish (#182)
simonhamp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
title: Mobile | ||
order: 1 | ||
--- | ||
|
||
# NativePHP for Mobile | ||
|
||
**Build native iOS and Android apps with PHP and Laravel** | ||
|
||
NativePHP for Mobile revolutionizes mobile development by allowing PHP developers to create native mobile applications using the languages and frameworks they already know and love. No need to learn Swift, Kotlin, or React Native - just pure PHP and Laravel. | ||
|
||
## What Makes NativePHP Mobile Special? | ||
|
||
=οΏ½ **Native Performance** - Your app runs natively on device with embedded PHP runtime | ||
shanerbaner82 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
=οΏ½ **True Mobile APIs** - Access camera, biometrics, push notifications, and more | ||
οΏ½ **Laravel Powered** - Use your existing Laravel skills and ecosystem | ||
=' **No Web Server** - Your app runs entirely on-device | ||
<οΏ½ **Cross Platform** - Single codebase for iOS and Android | ||
|
||
## Quick Start | ||
|
||
Get your first mobile app running in minutes: | ||
|
||
```bash | ||
# Install NativePHP Mobile | ||
composer require nativephp/mobile | ||
|
||
# Configure your app | ||
php artisan native:install | ||
|
||
# Run your app | ||
php artisan native:run | ||
``` | ||
|
||
## Current Features (v1.1) | ||
|
||
**Available now:** | ||
- =οΏ½ Camera & Gallery access | ||
- = Biometric authentication (Face ID, Touch ID, Fingerprint) | ||
- = Push notifications via Firebase | ||
- =οΏ½ Native dialogs & toasts | ||
- = Deep links & universal links | ||
- =οΏ½ NFC support | ||
- =οΏ½ Haptic feedback & vibration | ||
- =& Flashlight control | ||
- =οΏ½ Native sharing | ||
- = Secure storage (Keychain/Keystore) | ||
- =οΏ½ Location services | ||
|
||
[See the complete roadmap οΏ½](/docs/mobile/1/getting-started/roadmap) | ||
|
||
## Documentation Sections | ||
|
||
### [Getting Started](/docs/mobile/1/getting-started) | ||
Everything you need to start building mobile apps with PHP: | ||
- [Introduction](/docs/mobile/1/getting-started/introduction) - Learn how NativePHP Mobile works | ||
- [Installation](/docs/mobile/1/getting-started/installation) - Set up your development environment | ||
- [Environment Setup](/docs/mobile/1/getting-started/environment-setup) - Configure iOS and Android tools | ||
- [Configuration](/docs/mobile/1/getting-started/configuration) - App settings and permissions | ||
- [Development](/docs/mobile/1/getting-started/development) - Development workflow | ||
- [Roadmap](/docs/mobile/1/getting-started/roadmap) - Current and planned features | ||
|
||
### [The Basics](/docs/mobile/1/the-basics) | ||
Core concepts and fundamental knowledge: | ||
- [Native Functions](/docs/mobile/1/the-basics/native-functions) - Understanding sync vs async APIs | ||
- [Asynchronous Methods](/docs/mobile/1/the-basics/asynchronous-methods) - Event-driven mobile development | ||
- [ICU Support](/docs/mobile/1/the-basics/icu-support) - International components for Unicode | ||
|
||
### [Concepts](/docs/mobile/1/concepts) | ||
Important concepts for mobile app development: | ||
- [CI/CD](/docs/mobile/1/concepts/ci-cd) - Continuous integration and deployment | ||
- [Deep Links](/docs/mobile/1/concepts/deep-links) - Universal links, app links, and NFC | ||
- [Push Notifications](/docs/mobile/1/concepts/push-notifications) - Firebase Cloud Messaging setup | ||
- [Splash Screen/Icons](/docs/mobile/1/concepts/splash-screen-icons) - App branding and assets | ||
- [Versioning](/docs/mobile/1/concepts/versioning) - App version management | ||
|
||
### [APIs](/docs/mobile/1/apis) | ||
Complete API reference for all native features: | ||
- [Biometrics](/docs/mobile/1/apis/biometrics) - Face ID, Touch ID, fingerprint authentication | ||
- [Camera](/docs/mobile/1/apis/camera) - Photo capture and gallery access | ||
- [Dialog](/docs/mobile/1/apis/dialog) - Alerts, toasts, and sharing | ||
- [Geolocation](/docs/mobile/1/apis/geolocation) - GPS and location services | ||
- [Haptics](/docs/mobile/1/apis/haptics) - Vibration and tactile feedback | ||
- [PushNotifications](/docs/mobile/1/apis/push-notifications) - FCM token management | ||
- [SecureStorage](/docs/mobile/1/apis/secure-storage) - Keychain and keystore operations | ||
- [System](/docs/mobile/1/apis/system) - Flashlight and legacy methods | ||
|
||
### [Digging Deeper](/docs/mobile/1/digging-deeper) | ||
Advanced topics for production apps: | ||
- [Databases](/docs/mobile/1/digging-deeper/databases) - SQLite and data management | ||
- [Security](/docs/mobile/1/digging-deeper/security) - Best practices and secure storage | ||
|
||
## Need Help? | ||
|
||
- **License Required** - [Purchase your license](https://nativephp.com/mobile) to get started | ||
- **Community** - Join our Discord for support and discussions | ||
- **Examples** - Check out the Kitchen Sink demo app (coming soon to app stores) | ||
|
||
Ready to build your first mobile app with PHP? [Let's get started! οΏ½](/docs/mobile/1/getting-started/introduction) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
--- | ||
title: APIs | ||
order: 4 | ||
--- | ||
|
||
# API Reference | ||
|
||
Complete documentation for all NativePHP Mobile APIs. Each API provides access to native device capabilities through familiar PHP facades. | ||
|
||
## Available APIs | ||
|
||
### [Biometrics](/docs/mobile/1/apis/biometrics) | ||
**Face ID, Touch ID, Fingerprint Authentication** | ||
```php | ||
Biometrics::promptForBiometricID(); | ||
``` | ||
Secure user authentication using device biometric sensors. Supports Face ID on iOS, Touch ID, and fingerprint readers on Android. | ||
|
||
### [Camera](/docs/mobile/1/apis/camera) | ||
**Photo Capture & Gallery Access** | ||
```php | ||
Camera::getPhoto(); | ||
Camera::pickImages('images', true, 5); | ||
``` | ||
Take photos with the device camera or select images from the photo gallery. Supports both single and multiple image selection. | ||
|
||
### [Dialog](/docs/mobile/1/apis/dialog) | ||
**Native UI Elements** | ||
```php | ||
Dialog::alert('Title', 'Message', $buttons, $callback); | ||
Dialog::toast('Success message'); | ||
Dialog::share('Title', 'Text', 'https://example.com'); | ||
``` | ||
Display native alerts, toast notifications, and sharing interfaces that match platform design guidelines. | ||
|
||
### [Geolocation](/docs/mobile/1/apis/geolocation) β New in v1.1 | ||
**GPS & Location Services** | ||
```php | ||
Geolocation::getCurrentPosition(true); // High accuracy | ||
Geolocation::checkPermissions(); | ||
Geolocation::requestPermissions(); | ||
``` | ||
Access device location services with configurable accuracy levels and proper permission handling. | ||
|
||
### [Haptics](/docs/mobile/1/apis/haptics) | ||
**Vibration & Tactile Feedback** | ||
```php | ||
Haptics::vibrate(); | ||
``` | ||
Provide tactile feedback for user interactions, form validation, and important events. | ||
|
||
### [PushNotifications](/docs/mobile/1/apis/push-notifications) | ||
**Firebase Cloud Messaging** | ||
```php | ||
PushNotifications::enrollForPushNotifications(); | ||
PushNotifications::getPushNotificationsToken(); | ||
``` | ||
Register devices for push notifications and manage FCM tokens for server-side notification delivery. | ||
|
||
### [SecureStorage](/docs/mobile/1/apis/secure-storage) β New in v1.1 | ||
**Keychain & Keystore Operations** | ||
```php | ||
SecureStorage::set('api_token', $token); | ||
$token = SecureStorage::get('api_token'); | ||
SecureStorage::delete('api_token'); | ||
``` | ||
Store sensitive data securely using iOS Keychain and Android Keystore with automatic encryption. | ||
|
||
### [System](/docs/mobile/1/apis/system) | ||
**System Functions & Legacy API** | ||
```php | ||
System::flashlight(); // Toggle flashlight | ||
``` | ||
Control system functions like the flashlight. Also provides deprecated methods that have moved to dedicated facades. | ||
|
||
## API Patterns | ||
|
||
### Synchronous APIs | ||
Execute immediately and return results: | ||
- `Haptics::vibrate()` | ||
- `System::flashlight()` | ||
- `Dialog::toast()` | ||
- `SecureStorage::set()` / `get()` | ||
|
||
### Asynchronous APIs | ||
Trigger operations and fire events when complete: | ||
- `Camera::getPhoto()` β `PhotoTaken` event | ||
- `Biometrics::promptForBiometricID()` β `Completed` event | ||
- `PushNotifications::enrollForPushNotifications()` β `TokenGenerated` event | ||
- `Geolocation::getCurrentPosition()` β `LocationReceived` event | ||
|
||
### Event Handling | ||
All async APIs use Laravel events with Livewire integration: | ||
|
||
```php | ||
use Livewire\Attributes\On; | ||
use Native\Mobile\Events\Camera\PhotoTaken; | ||
|
||
#[On('native:' . PhotoTaken::class)] | ||
public function handlePhotoTaken(string $path) | ||
{ | ||
// Process the captured photo | ||
} | ||
``` | ||
|
||
## Migration from System Facade | ||
|
||
Many methods have moved from the `System` facade to dedicated facades in v1.1: | ||
|
||
| Old (Deprecated) | New (Recommended) | | ||
|------------------|-------------------| | ||
| `System::camera()` | `Camera::getPhoto()` | | ||
| `System::vibrate()` | `Haptics::vibrate()` | | ||
| `System::promptForBiometricID()` | `Biometrics::promptForBiometricID()` | | ||
| `System::enrollForPushNotifications()` | `PushNotifications::enrollForPushNotifications()` | | ||
| `System::secureSet()` / `secureGet()` | `SecureStorage::set()` / `get()` | | ||
|
||
The old methods still work but are deprecated. See the [System API documentation](/docs/mobile/1/apis/system) for complete migration guidance. | ||
|
||
## Platform Support | ||
|
||
All APIs work on both iOS and Android with platform-appropriate implementations: | ||
- **iOS**: Uses native iOS frameworks and APIs | ||
- **Android**: Uses Android SDK and native libraries | ||
- **Permissions**: Automatically handled with user prompts when required | ||
- **Fallbacks**: Graceful degradation when features aren't available | ||
|
||
## Error Handling | ||
|
||
APIs provide both success and error events for proper error handling: | ||
|
||
```php | ||
#[On('native:' . PhotoTaken::class)] | ||
public function handleSuccess($data) { /* ... */ } | ||
|
||
#[On('native:' . PermissionDenied::class)] | ||
public function handleError($error) { /* ... */ } | ||
``` | ||
|
||
Each API documentation includes complete error handling examples and best practices. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
title: Biometrics | ||
order: 100 | ||
--- | ||
|
||
## Overview | ||
|
||
The Biometrics API allows you to authenticate users using their device's biometric sensors like Face ID, Touch ID, or fingerprint scanners. | ||
|
||
```php | ||
use Native\Mobile\Facades\Biometrics; | ||
``` | ||
|
||
## Methods | ||
|
||
### `promptForBiometricID()` | ||
|
||
Prompts the user for biometric authentication. | ||
|
||
## Events | ||
|
||
### `Native\Mobile\Events\Biometric\Completed` | ||
|
||
Fired when biometric authentication completes (success or failure). | ||
|
||
```php | ||
use Livewire\Attributes\On; | ||
use Native\Mobile\Events\Biometric\Completed; | ||
|
||
#[On('native:' . Completed::class)] | ||
public function handleBiometricAuth(bool $success) | ||
{ | ||
if ($success) { | ||
// User authenticated successfully | ||
$this->unlockSecureFeature(); | ||
} else { | ||
// Authentication failed | ||
$this->showErrorMessage(); | ||
} | ||
} | ||
``` | ||
|
||
## Example Usage | ||
|
||
```php | ||
use Livewire\Component; | ||
use Livewire\Attributes\On; | ||
use Native\Mobile\Facades\Biometrics; | ||
use Native\Mobile\Events\Biometric\Completed; | ||
|
||
class SecureArea extends Component | ||
{ | ||
public bool $isUnlocked = false; | ||
public bool $isAuthenticating = false; | ||
|
||
public function authenticate() | ||
{ | ||
$this->isAuthenticating = true; | ||
Biometrics::promptForBiometricID(); | ||
} | ||
|
||
#[On('native:' . Completed::class)] | ||
public function handleBiometricAuth(bool $success) | ||
{ | ||
$this->isAuthenticating = false; | ||
|
||
if ($success) { | ||
$this->isUnlocked = true; | ||
session(['biometric_authenticated' => true]); | ||
} else { | ||
$this->addError('auth', 'Biometric authentication failed'); | ||
} | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.secure-area'); | ||
} | ||
} | ||
``` | ||
|
||
## Platform Support | ||
|
||
- **iOS:** Face ID, Touch ID | ||
- **Android:** Fingerprint, Face unlock, other biometric methods | ||
- **Fallback:** System authentication (PIN, password, pattern) | ||
|
||
## Security Notes | ||
|
||
- Biometric authentication provides **convenience**, not absolute security | ||
- Always combine with other authentication factors for sensitive operations | ||
- Consider implementing session timeouts for unlocked states | ||
- Users can potentially bypass biometrics if their device is compromised |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily an issue but can you help me understand why the order of arguments were switched here? Was something being overwritten we wasn't expecting? π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually yeah, and maybe you can verify, locally for me every page showed "Mobile" as the title of the document, reversing this fixed it for me. On the website currently it works fine now, not sure what's going on tbh and I didn't switch it back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my end I see the title
NativePHP
on every page. Looks like the title tag is present in the head twice.By editing
$pageProperties
the second title tag does change, but my browser only picks up the first one so I can't see it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might depend on your cache driver, I haven't played with it but saw some code about cacheing if local...