hoa/core
最新稳定版本:2.15.11.09
Composer 安装命令:
composer require hoa/core
包简介
The Hoa\Core library.
README 文档
README
Hoa is a modular, extensible and structured set of PHP libraries. Moreover, Hoa aims at being a bridge between industrial and research worlds.
Hoa\Core 
This library is the foundation —the core— of all libraries of Hoa. It provides fundamental algorithms, paradigms and mechanisms, organized as follows:
- Core: core of the core;
- Consistency: adds consistency to PHP (
from/import,xcallable,dnew,curryetc.); - Exception: homogenises exceptions and errors;
- Protocol: abstracts resources —and more— accesses (e.g.
hoa://Libraryorhoa://Application); - Parameter: manages parameters of libraries;
- Event: adds support of events and listeners;
- Data: adds support of polymorphic data with high performance.
Warning
This library is deprecated. It has been splitted into:
This library is no longer used.
Installation
The core can be placed where you want. We recommand /usr/local/lib/Hoa for Unix-like systems and C:\Program Files\Hoa for Windows systems.
Then, you have to require Core.php and it is enough to use all libraries of Hoa; thus:
<?php require '/usr/local/lib/Hoa/Core/Core.php'; var_dump(HOA); // bool(true)
With Composer, you do not need to require Core.php, only vendor/autoload.php as usual.
Quick usage
We propose a quick overview of some layers of the core.
Exceptions and errors
Errors are unified to exceptions. Exceptions are of 3 kinds: idle, normal and error. They support formatted messages, auto-catch, dedicated event channel etc.
Protocol
hoa:// defines an abstraction for application ressources (with roots Data and Application) and another abstraction for libraries resources (with root Library). For example:
$conf = require 'hoa://Data/Etc/Configuration/Foo.php';
We can attach more than resources on this protocol. Example with the Hoa\Registry library:
Hoa\Registry\Registry::set('foo', 'bar'); echo resolve('hoa://Library/Registry#foo'); // bar
Events and listeners
Libraries can use events and listeners (which have some similarities). For example, if we attach a function to the channel of exceptions:
event('hoa://Event/Exception')->attach(function ($bucket) { $exception = $bucket->getData(); echo 'Exception: ', $exception->getMessage(), "\n"; }) throw new Hoa\Core\Exception('Hello %s!', 0, 'Gordon'); // Exception: Hello Gordon!
Some libraries define their own channels, such as the Hoa\Stream library with, for example, hoa://Event/Stream/<stream-name>:close-before, or hoa://Event/Log/<channel> etc.
For listeners, we are closer to the emitter:
$websocket = new Hoa\Websocket\Server( new Hoa\Socket\Server('tcp://127.0.0.1:8889') ); $websocket->on('message', $callable); $websocket->run();
Documentation
Different documentations can be found on the website: http://hoa-project.net/.
License
Hoa is under the New BSD License (BSD-3-Clause). Please, see LICENSE.
hoa/core 适用场景与选型建议
hoa/core 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 953.57k 次下载、GitHub Stars 达 37, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「data」 「event」 「library」 「listener」 「protocol」 「consistency」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hoa/core 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hoa/core 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hoa/core 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Adds the EDTF data type to Wikibase
A simple library that allows transform any kind of data to native php data or whatever
Symfony bundle for broadway/broadway.
Inbox pattern process implementation for your Laravel Applications
Data provider for yii2
统计信息
- 总下载量: 953.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 38
- 点击次数: 22
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2026-01-04