承接 aharabara/habarnam 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aharabara/habarnam

Composer 安装命令:

composer require aharabara/habarnam

包简介

Ncurses wrapper for fast TUI building

README 文档

README

⚡ Habarnam

Warning! ⚠️

This package is in early development, so don't use it until you know your risks.

Framework/wrapper for ext-ncurses that will allows you to write simple CLI applications using a little bit of XML and PHP.

Give a ⭐ if like it and write me if you don't and we will make it better.

Made with habarnam:

Soon could be implemented:

  • Chat (WIP)
  • Redis or MySQL browser
  • Reddit browser
  • Ascii drawing tool

If you have some ideas, then create an issue and we will discuss it 🤘

Usage:

#go to you project directory and require it into your project
composer require aharabara/habarnam

# then install ext-ncurses with its patches, so it will work for php 7.*
# and add 'extension=ncurses.so' to your php.ini
./vendor/aharabara/habarnam/install.sh

touch ./index.php
mkdir ./src/
mkdir ./logs/
mkdir ./views/
mkdir ./assets/
touch ./views/surfaces.xml
touch ./views/main.xml
touch ./assets/styles.css

index.php content

<?php

use Base\{Application, Core\Installer, Core\Workspace, Services\ViewRender};

require __DIR__ . '/vendor/autoload.php';


$projectName = '<You project name>'; // will be used to create a folder inside ~/.config
$workspace = new Workspace("habarnam-{$projectName}");
$installer = new Installer($workspace);

$installer->checkCompatibility();

if (!$installer->isInstalled()) {
    $installer->run();
}

/* folder with surfaces.xml and other view files */
$render = new ViewRender(__DIR__. '/views/');

(new Application($workspace, $render->prepare(), 'main'))
    ->debug(true)
    ->handle();

surface.xml content

<surfaces>
    <!-- each surface should be declared inside application>surfaces element
         and should have 'id' attribute
    -->
    <surface id="example.middle">
        <!-- top left corner of the surface-->
        <pos x="10" y="4"/>
        <!-- top bottom corner of the surface-->
        <pos x="-10" y="8"/>

        <!-- y="-5"  will lead to calculation from bottom and not from the top -->
        <!-- x="-5"  will lead to calculation from right and not from the left -->
    </surface>
    <surface id="example.fullscreen"/>
    <!-- In some cases you just need a popup, so you can use [type=centered]
         and specify it's [height] and [width]
     -->
    <surface id="example.popup" height="7" type="centered"/>
</surfaces>

main.xml content

<template id="main"> <!-- template tag represents a screen with components -->
    <!-- you can jump between view using Application->switchTo('TemplateID') or BaseController->switchTo('TemplateID')-->
    <head>
        <!-- you can specify here which css files you want to load for this template-->
        <link src="/assets/styles.css"/> 
    </head>
    <body>
        <section title="Users" surface="column.left"> <!-- surface attribute will set section size and position -->
            <ol id="users" on.item.selected="\App\UserController@login"> <!-- on.* are events that are triggered during interaction -->
                <li value="user-1">User</li> <!-- you can nest some components, for example ol > li -->
            </ol>
        </section>
        <section title="History" surface="column.right.top"> <!-- or section > * -->
            <textarea id="info"/>
        </section>
        <section title="Message" surface="column.right.bottom">
            <input id="message"/> <!-- you can address any (non-dynamic) component via Application->findFirst('.css>selector')-->
            <button on.press="\App\UserController@login" id="send">Send</button> <!-- or via Application->findAll('selector')-->
        </section>
    </body>
</template>

Tips

  • To navigate through components use Tab and Shift + Tab or keyboard arrows.
  • Call Application->debug(true) and then press F1 and you will be able to see components surfaces. Surface calculation is still glitchy, but you can use it.
  • Press F3 to toggle resize mode
  • Press F5 to refresh styles from css files. (:cool:)
  • Press Ctrl+X to exit application. Be careful and save everything before doing it.
  • more coming...

aharabara/habarnam 适用场景与选型建议

aharabara/habarnam 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 32, 最近一次更新时间为 2019 年 05 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 aharabara/habarnam 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aharabara/habarnam 我们能提供哪些服务?
定制开发 / 二次开发

基于 aharabara/habarnam 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 34
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 32
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-03