PHP code example of pushinbr / pam-native-live-activities
1. Go to this page and download the library: Download pushinbr/pam-native-live-activities 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/ */
pushinbr / pam-native-live-activities example snippets
use Pam\Native\LiveActivities\LiveActivities;
use Pam\Native\LiveActivities\LiveActivityContent;
$activities = new LiveActivities();
$content = new LiveActivityContent('Order on the way', 'Preparing', 0.15, 'myapp://orders/42');
$activities->start('order-42', $content, function (?string $identifier, ?string $error) use ($activities): void {
if ($identifier === null) {
return;
}
$activities->update(
$identifier,
new LiveActivityContent('Order on the way', 'Courier assigned', 0.45),
static fn (?string $updated, ?string $error) => null,
);
}, pushEnabled: true);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.