In a world where Electron dominates cross-platform desktop development, PHP developers have often been left out of the conversation. But what if you could build native-feeling apps using the language you already love? Enter BosonPHP—a blazing-fast runtime that reimagines what PHP can do beyond the browser.
🚀 What Is BosonPHP?
BosonPHP is a high-performance runtime and kernel designed to run PHP applications with native UI capabilities. Think of it as PHP’s answer to Electron—but lighter, faster, and more developer-friendly. It leverages Saucer v6.0 bindings to create desktop interfaces using HTML, JavaScript, and PHP—all without leaving your comfort zone.
🧩 Key Features
- Webview Integration: Render HTML directly in a native window and bind JavaScript functions to PHP callbacks.
- Framework Bridges: Seamless integration with Laravel, Symfony, Spiral, and PSR-7 via dedicated adapters.
- Compiler Support: Package your PHP app into a standalone executable using the Boson compiler.
- System Insights: Access CPU and OS info, manage static files, and intercept requests natively.
🛠️ Getting Started
Install BosonPHP via Composer:
composer require boson-php/runtime
Here’s a minimal example:
$app = new Boson\Application();
$app->webview->html = <<<HTML
<button onclick="foo('HELLO');">Hello</button>
HTML;
$app->webview->bind('foo', fn($msg) => var_dump($msg));
This snippet creates a native window with a button that triggers a PHP function—no browser required.
🔌 Laravel Integration
BosonPHP offers a Laravel Service Provider that lets you boot your app inside the Boson runtime. This means you can build desktop tools powered by Laravel’s routing, Eloquent, and Blade—all wrapped in a native shell.
🎯 Use Cases
- Developer Utilities: Build code analyzers, dashboards, or CLI tools with a GUI.
- Internal Tools: Create cross-platform desktop apps for teams without relying on Electron.
- Educational Apps: Package interactive learning tools using PHP and HTML.
🤔 Why It Matters
BosonPHP isn’t just a novelty—it’s a statement. It shows that PHP is still evolving, still relevant, and still capable of surprising us. For developers who want to stay in the PHP ecosystem while exploring new frontiers, BosonPHP is a breath of fresh air.
Fuel my creative spark with a virtual coffee! Your support keeps the ideas percolating—grab me a cup at Buy Me a Coffee and let’s keep the magic brewing!
