PHP code example of vos / nativephp-live-activities-free

1. Go to this page and download the library: Download vos/nativephp-live-activities-free 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/ */

    

vos / nativephp-live-activities-free example snippets


use Vos\LiveActivities\ActivityContent;
use Vos\LiveActivities\ActivityIcon;
use Vos\LiveActivities\Facades\LiveActivities;

$activity = LiveActivities::start('delivery-42',
    ActivityContent::make('Preparing your order')->subtitle('In the kitchen')
        ->icon(ActivityIcon::Utensils)->color('#F97316')
);

LiveActivities::update($activity->id,
    ActivityContent::make('On the way')->progress(0.5)
        ->icon(ActivityIcon::Truck)->color('#06B6D4')
);

LiveActivities::all();
LiveActivities::capabilities();
LiveActivities::end($activity->id);

$content = ActivityContent::make('Delivered')
    ->progress(1)
    ->icon('circle-check')
    ->color('#22C55E');

$capabilities = LiveActivities::capabilities();

if ($capabilities->supported && $capabilities->enabled) {
    // The platform supports activities and the 
sh
composer an vendor:publish --tag=nativephp-plugins-provider
php artisan native:plugin:register vos/nativephp-live-activities-free
php artisan native:plugin:list
sh
php artisan native:run ios
# Or:
php artisan native:run android