leric/php-thrift

PHP的Thrift客户端API(与Thrift版本同步)

0.14.1 2021-03-11 02:10 UTC

This package is auto-updated.

Last update: 2024-09-11 10:08:16 UTC


README

Thrift PHP软件库

许可证

在Apache软件基金会(ASF)的一个或多个贡献者许可协议下许可。有关版权所有权的更多信息,请参阅与此工作一起分发的NOTICE文件。ASF按Apache许可证版本2.0(以下简称“许可证”)向您许可此文件;除非适用法律要求或经书面同意,否则不得使用此文件,除非遵守许可证。您可以在以下位置获得许可证副本:

https://apache.ac.cn/licenses/LICENSE-2.0

除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”分发,不提供任何明示或暗示的保证或条件。有关许可证的具体语言规定权限和限制,请参阅许可证。

在PHP中使用Thrift

Thrift需要PHP 5。Thrift在尽可能少地假设您的PHP环境的同时,尽量简化一些更高级的PHP功能(例如,使用绝对路径URL的APCu缓存)。

要在您的PHP代码库中使用Thrift,请执行以下步骤

  1. 将thrift/lib/php/lib中的所有内容复制到您的PHP代码库中
  2. 配置Symfony自动加载器(或您通常使用的任何其他加载器)

之后,您必须手动包含编译器创建的Thrift包

require_once 'packages/Service/Service.php';
require_once 'packages/Service/Types.php';

依赖项

PHP_INT_SIZE

This built-in signals whether your architecture is 32 or 64 bit and is
used by the TBinaryProtocol to properly use pack() and unpack() to
serialize data.

apcu_fetch(),apcu_store()

APCu cache is used by the TSocketPool class. If you do not have APCu installed,
Thrift will fill in null stub function definitions.

重大变更

0.12.0

  1. PSR-4加载器现在是默认的。如果想要使用类映射,请使用-gen php:classmap

  2. 如果使用PSR-4,请使用$thriftClassLoader->registerNamespace('namespace', '<path>')代替$thriftClassLoader->registerDefinition('namespace', '<path>')