NativePHPとは
PHP言語を用いてデスクトップアプリケーションを開発可能にするフレームワーク。
使用言語:HTML、CSS、Javascript、PHP
対応OS:Windows、Mac、Linux(開発環境は現時点では、Mac or Linux)
環境構築手順
Laravelのプロジェクトを作成する。
composer create-project laravel/laravel testNativePhpApp
プロジェクト内に移動する。
cd testNativePhpApp
Nativephpをプロジェクトに追加する。
composer require nativephp/electron
NativePHPをインストールする。
php artisan native:install
インストールするか聞かれるので「Yes」を選択し、Enter。

サーバーを起動するか聞かれるので「Yes」を選択し、Enter。

下のようなウィンドウが表示されれば成功

ターミナル上では色々エラーが出ているが、アルファ版なのでバグがまだまだたくさんあるらしい。
Error: Command failed: /Users/tatsu/testNativePhpApp/vendor/nativephp/electron/resources/js/resources/php/php artisan native:config
at ChildProcess.exithandler (node:child_process:430:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
code: 1,
killed: false,
signal: null,
cmd: '/Users/tatsu/testNativePhpApp/vendor/nativephp/electron/resources/js/resources/php/php artisan native:config',
stdout: '\n' +
' ERROR Command "native:config" is not defined. Did you mean one of these? \n' +
'\n' +
' ⇂ native:build \n' +
' ⇂ native:install \n' +
' ⇂ native:migrate \n' +
' ⇂ native:minify \n' +
' ⇂ native:publish \n' +
' ⇂ native:queue \n' +
' ⇂ native:serve \n' +
'\n',
stderr: ''
}
API server started on port 4000
Starting PHP server... /Users/tatsu/testNativePhpApp/vendor/nativephp/electron/resources/js/resources/php/php artisan serve /Users/tatsu/testNativePhpApp
Making sure app folders are available
Skipping Database migration while in development.
You may migrate manually by running: php artisan native:migrate
PHP Server started on port: 8100
(node:10774) electron: NSVisualEffectMaterialAppearanceBased has been deprecated and removed as of macOS 10.15.
(Use `Electron --trace-warnings ...` to show where the warning was created)
[10774:0918/110227.918502:ERROR:CONSOLE(1)] "Uncaught (in promise) TypeError: Failed to fetch", source: devtools://devtools/bundled/panels/elements/elements.js (1)
参考URL
公式ドキュメント
Introduction
NativePHPdocumentationformobilev1

コメント