PHP code example of kevinbatdorf / nativephp-launcher

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

    

kevinbatdorf / nativephp-launcher example snippets


use KevinBatdorf\Launcher\Concerns\IsHomeScreen;
use KevinBatdorf\Launcher\Events\HomeRequested;
use KevinBatdorf\Launcher\Facades\Launcher;

class HomeScreen extends NativeComponent
{
    use IsHomeScreen;                       // BACK at the root stays put instead of minimising

    public array $apps = [];

    public function mount(): void
    {
        $this->apps = Launcher::apps();     // label, package, activity, icon path
    }

    public function open(string $package, string $activity): void
    {
        Launcher::open($package, activity: $activity);
    }
}

#[On(HomeRequested::class)]
public function homeRequested(int $displayId): void
{
    Screens::show($displayId);
}