PHP code example of sadiqk2 / nativephp-symfony-desktop-bundle

1. Go to this page and download the library: Download sadiqk2/nativephp-symfony-desktop-bundle 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/ */

    

sadiqk2 / nativephp-symfony-desktop-bundle example snippets


final class Bootstrapper implements AppBootstrapper
{
    public function __construct(private readonly WindowManager $windows) {}

    // The runtime POSTs /_native/api/booted at the end of its boot and this
    // decides what appears. That is the entire app-startup contract.
    public function boot(): void
    {
        $this->windows->open('main')
            ->url('/')
            ->size(1000, 720)
            ->title('My App')
            ->rememberState()
            ->open();
    }
}

#[AsEventListener]
public function onResized(WindowResized $event): void
{
    // Typed, not an array: $event->id, $event->width, $event->height
}
yaml
# config/routes/native_desktop.yaml — written by native:install
native_desktop:
    resource: '@NativeDesktopBundle/src/Resources/config/routes.php'
    type: php