PHP code example of blessedzulu / nativephp-mobile-haptics

1. Go to this page and download the library: Download blessedzulu/nativephp-mobile-haptics 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/ */

    

blessedzulu / nativephp-mobile-haptics example snippets


use BlessedZulu\NativePHP\Mobile\Haptics\Facades\Haptics;

// Impact feedback — for button taps, collisions, UI emphasis
Haptics::impact('light');    // light, medium (default), heavy, rigid, soft

// Notification feedback — for async operation results
Haptics::notification('success');  // success (default), warning, error

// Selection feedback — for pickers, sliders, toggles
Haptics::selection();

// Raw vibration (ms) — native on Android, approximated on iOS
Haptics::vibrate(300);

// Vibration pattern [vibrate, pause, vibrate, pause, ...]
Haptics::pattern([100, 50, 200, 50, 100]);

if ($user->prefersHaptics()) {
    Haptics::impact('medium');
}