blob: a2b10682c9de89ebc0e7a88378451b60aa0e33c2 [file] [log] [blame]
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="en-us" http-equiv="Content-Language" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/images/favicon.ico" rel="shortcut icon" />
<link href="/static/css/style.css" rel="stylesheet" type="text/css" />
<link href="/static/css/codehilite.css" rel="stylesheet" type="text/css" />
<link href="/static/css/bootstrap.css" media="screen, projection" rel="stylesheet" type="text/css" />
<link href="/static/css/thrift.css" media="screen, projection" rel="stylesheet" type="text/css" />
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap-dropdown.js"></script>
<script src="/static/js/bootstrap-tab.js"></script>
<script src="/static/js/thrift.js"></script>
<title>Apache Thrift - PHP library</title>
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/">Apache Thrift &trade;</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li><a href="/download">Download</a></li>
<li><a href="/docs">Documentation</a></li>
<li><a href="/developers">Developers</a></li>
<li><a href="/lib">Libraries</a></li>
<li><a href="/tutorial">Tutorial</a></li>
<li><a href="/test">Test Suite</a></li>
<li><a href="/about">About</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="http://www.apache.org/" target="_blank">Apache Home</a></li>
<li><a href="http://www.apache.org/licenses/" target="_blank">Apache License v2.0</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Donate</a></li>
<li><a href="http://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a></li>
<li><a href="http://www.apache.org/security/" target="_blank">Security</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<h1 id="using-thrift-with-php">Using Thrift with PHP</h1>
<p>Thrift requires PHP 7.1 Thrift makes as few assumptions about your PHP
environment as possible while trying to make some more advanced PHP
features (i.e. APCu cacheing using asbolute path URLs) as simple as possible.</p>
<p>To use Thrift in your PHP codebase, take the following steps:</p>
<ol>
<li>Copy all of thrift/lib/php/lib into your PHP codebase</li>
<li>Configure Symfony Autoloader (or whatever you usually use)</li>
</ol>
<p>After that, you have to manually include the Thrift package
created by the compiler:</p>
<p><code>
require_once 'packages/Service/Service.php';
require_once 'packages/Service/Types.php';
</code></p>
<h1 id="dependencies">Dependencies</h1>
<p>PHP_INT_SIZE</p>
<pre><code>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.
</code></pre>
<p>apcu_fetch(), apcu_store()</p>
<pre><code>APCu cache is used by the TSocketPool class. If you do not have APCu installed,
Thrift will fill in null stub function definitions.
</code></pre>
<h1 id="breaking-changes">Breaking Changes</h1>
<h2 id="section">0.12.0</h2>
<ol>
<li>
<p><a href="https://www.php-fig.org/psr/psr-4/">PSR-4</a> loader is now the default. If you want to use class maps instead, use <code>-gen php:classmap</code>.</p>
</li>
<li>
<p>If using PSR-4, use <code>$thriftClassLoader-&gt;registerNamespace('namespace', '&lt;path&gt;')</code> instead of <code>$thriftClassLoader-&gt;registerDefinition('namespace', '&lt;path&gt;')</code>.</p>
</li>
</ol>
<p class="snippet_footer">This page was generated by Apache Thrift's <strong>source tree docs</strong>:
<a href="https://gitbox.apache.org/repos/asf?p=thrift.git;a=blob;hb=HEAD;f=lib/php/README.md">lib/php/README.md</a>
</p>
</div>
<div class="container">
<hr>
<footer class="footer">
<div class="row">
<div class="span3">
<h3>Links</h3>
<ul class="unstyled">
<li><a href="/download">Download</a></li>
<li><a href="/developers">Developers</a></li>
<li><a href="/tutorial">Tutorials</a></li>
</ul>
<ul class="unstyled">
<li><a href="/sitemap">Sitemap</a></li>
</ul>
</div>
<div class="span3">
<h3>Get Involved</h3>
<ul class="unstyled">
<li><a href="/mailing">Mailing Lists</a></li>
<li><a href="http://issues.apache.org/jira/browse/THRIFT">Issue Tracking</a></li>
<li><a href="/docs/HowToContribute">How To Contribute</a></li>
</ul>
</div>
<div class="span6">
<a href="http://www.apache.org/"><img src="/static/images/feather.svg" onerror="this.src='/static/images/feather.png';this.onerror=null;" /></a>
Copyright &copy; 2024 <a href="http://www.apache.org/">Apache Software Foundation</a>.
Licensed under the <a href="http://www.apache.org/licenses/">Apache License v2.0</a>.
Apache, Apache Thrift, and the Apache feather logo are trademarks of The Apache Software Foundation.
</div>
</div>
</footer>
</div>
</body>
</html>