icicleio/react-adapter
Composer 安装命令:
composer require icicleio/react-adapter
包简介
Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.
README 文档
README
This library facilitates interoperability between components built for React and Icicle. This library provides an adapter between the differing event loop and promise implementations of the two libraries.
Requirements
- PHP 5.5+
Installation
The recommended way to install is with the Composer package manager. (See the Composer installation guide for information on installing and using Composer.)
Run the following command to use this library in your project:
composer require icicleio/react-adapter
You can also manually edit composer.json to add this library as a project requirement.
// composer.json { "require": { "icicleio/react-adapter": "^0.4" } }
ReactLoop
Icicle\ReactAdapter\Loop\ReactLoop is as a direct replacement for the React event loop. It communicates with the active Icicle event loop to provide the same functionality. The class implements React\EventLoop\LoopInterface, so it can be used with any component that requires a React event loop.
use Icicle\ReactAdapter\Loop\ReactLoop; use Predis\Async\Client; // Create the loop adapter. $loop = new ReactLoop(); // $loop can be used anywhere an instance of React\EventLoop\LoopInterface is required. $client = new Client('tcp://127.0.0.1:6379', $loop);
ReactPromise
Icicle\ReactAdapter\Promise\ReactPromise creates a promise implementing React\Promise\ExtendedPromiseInterface and React\Promise\ExtendedPromiseInterface from an Icicle awaitable that implements Icicle\Awaitable\Awaitable. This allows awaitables created from Icicle to be used in any component requiring a React promise.
$iciclePromise = new \Icicle\Awaitable\Promise(function ($resolve, $reject) { // Resolver }); $reactPromise = new \Icicle\ReactAdapter\Promise\ReactPromise($iciclePromise);
Awaitable\adapt()
The Icicle\Awaitable namespace defines a function adapt() that can transform any object with a then(callable $onFulfilled, callable $onRejected) method into an awaitable implementing Icicle\Awaitable\Awaitable. This function can be used to convert a React promise to an Icicle awaitable.
$reactPromise = new \React\Promise\Promise(function ($resolve, $reject) { // Resolver }); $awaitable = \Icicle\Awaitable\adapt($reactPromise);
See the Awaitable API documentation for more information on Icicle\Awaitable\adapt().
icicleio/react-adapter 适用场景与选型建议
icicleio/react-adapter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 407 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 06 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「adapter」 「loop」 「promise」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 icicleio/react-adapter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 icicleio/react-adapter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 icicleio/react-adapter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Adapter designed to add Framework Agnosticism for Caching within PHP Packages.
flysystem cache Adapter
Virtual Filesystem Storage Adapter for Laravel
Lightweight library that provides regular PHP methods is a non-blocking implementation.
Server side promises
Iteration tools for PHP
统计信息
- 总下载量: 407
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-10