empathy-php / engine
Empathy 框架引擎
0.1.3
2021-04-10 18:31 UTC
README
🚀 Empathy 引擎
Empathy 引擎 - 基于 Empathy Core 或 Empathy Litecore 的应用框架
安装
composer require empathy-php/engine
与 Empathy Core 或 Empathy Litecore 共同使用
为了更好地工作,建议在根目录的 composer.json
文件中添加以下代码
{ "scripts": { "empathy-run": "vendor/empathy-php/core/empathy.exe vendor/empathy-php/core/script.php" } }
之后就可以执行代码
composer empathy-run
以启动项目
可以在项目根目录的 app.php
文件中编写应用程序代码
工作示例
app.php
<?php require 'vendor/autoload.php'; use Empathy\Engine\Components\{ Form, Button }; use function Empathy\Engine\Others\pre; $form = new Form; $button = new Button ($form); $form->caption = 'Example app'; $button->text = 'Click me!'; $button->bounds = [16, 16, 96, 32]; $button->on ('click', function () { pre ('Hello, World!'); }); $form->showDialog ();