1. Go to this page and download the library: Download nativephp/mobile-dialog library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nativephp / mobile-dialog example snippets
use Native\Mobile\Facades\Dialog;
use Native\Mobile\Events\Alert\ButtonPressed;
// Simple alert
Dialog::alert('Hello', 'Welcome to our app!');
// Alert with custom buttons
Dialog::alert('Confirm', 'Are you sure?', ['Cancel', 'Delete'])
->id('delete-confirm')
->show();
// Listen for button press
#[OnNative(ButtonPressed::class)]
public function handleButton($index, $label, $id = null)
{
if ($id === 'delete-confirm' && $label === 'Delete') {
$this->deleteItem();
}
}
use Native\Mobile\Facades\Dialog;
// Short toast (2 seconds)
Dialog::toast('Item saved!', 'short');
// Long toast (4 seconds) - default
Dialog::toast('Processing complete');