Skip to content

Migrating from 1.x

PAM Desktop 2 is not an upgrade of 1.x. It is a different product under the same name: 1.x showed a web interface in a Servo web view and let it call PHP through a typed command gateway; 2.x renders a native interface that PHP describes with components. An application written for 1.x does not run on 2.x, and there is no compatibility layer. Moving means writing the interface again; application logic that does not touch the 1.x API (domain classes, database queries, HTTP clients) can be kept.

1.x In 2.x
The interface in HTML, CSS and JavaScript, rendered by Servo Components and Style in PHP, or .pam.php templates with scoped CSS: Components, Styling. A WebView element can still embed a page.
Typed commands (#[Command]) called from JavaScript, and events emitted to JavaScript Event handlers are PHP closures on elements; state is #[State] on components. There is no JavaScript side.
The capability gateway: capabilities off by default, file roots, grants, the permission audit Gone: with no web content there is nothing to mediate. The worker is an ordinary PHP process; host modules have their own limits. See Security.
The application declared in PHP (#[Desktop(...)]) pam-desktop.json: Project Structure.
Declarative windows and menus UI\Window, App::menu(), Tray, Shortcut: Windows, Menus & Tray.
Background jobs Component timers that pause in the background, and Timers: State & Lifecycle.
Native SQLite, HTTP streaming, Secret Service The SQLite, Http, Files and SecureStorage modules: SQLite, HTTP & WebSockets, Storage & Files.
Rust plugins and their contracts Not available. Optional features ship as PHP packages in the same repository: Bundled Packages.
Multi-process window isolation, the background agent, workstation certification Not available.
Linux-only support Linux is the reference; macOS runs; Windows is written but not yet run.

Class names are not a guide: Pam\Desktop\App, for instance, exists in both versions. In 1.x it was a base class the application extended; in 2.x it is a static entry point (App::run(), App::menu()).

  • PHP runs in a worker process started by a Rust host. They now exchange binary frames over the worker’s standard input and output: Architecture.
  • PHP 8.5.
  • The package name pushinbr/pam-desktop and the Pam\Desktop namespace.
  • The host binary pam-desktop and the launcher vendor/bin/pam-desktop. The launcher still reads PAM_DESKTOP_HOST_BINARY, the 1.x name of PAM_DESKTOP_HOST.
  1. Create a fresh 2.x project next to the old one and read Your First App:

    Terminal window
    pam init acme-v2 --template desktop
  2. Copy your domain code (models, services, repositories) into src/. Remove anything that depends on 1.x classes.

  3. Rebuild one screen at a time as a .pam.php component. Your HTML maps closely to tags (<div> becomes <Column> or <Row>, text becomes <Text>), and much of your CSS carries over: flexbox, colors, borders, fonts, :hover and :focus, media queries, CSS variables, tables and inline layout are supported.

  4. Replace each 1.x command with a component method called from on:press or on:submit, and each event with a #[State] property.

  5. Move persistence and network code to the asynchronous modules, or keep your own PHP code where it does not block: a module call returns at once, while a blocking call in a handler delays the next render.

  6. Rebuild menus, shortcuts and dialogs with the shell API.

  7. Run pam desktop check and port your tests to Pam\Desktop\Testing\mount().

The 1.x sources are in the history of the PAM Desktop repository, at the v1.* tags; the last one is v1.3.4. Bundles built by 1.x (manifest schema 1) are not accepted by the 2.x updater, so ship 2.x as a new installation.