empathy-php/engine

Empathy 框架引擎

0.1.3 2021-04-10 18:31 UTC

This package is auto-updated.

Last update: 2024-09-11 01:46:43 UTC


README

🚀 Empathy 引擎

Latest Stable Version Total Downloads License

Empathy 引擎 - 基于 Empathy CoreEmpathy Litecore 的应用框架

安装

composer require empathy-php/engine

Empathy CoreEmpathy 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 ();

作者: Podvyrnyi Nikolai