PHP Thin Client
This is a legacy Apache Ignite documentation
The new documentation is hosted here: https://ignite.apache.org/docs/latest/
Overview
This thin client allows your PHP applications to work with Apache Ignite clusters via Binary Client Protocol.
A thin client is a lightweight Ignite client that connects to the cluster via a standard socket connection. It does not start in JVM process (Java is not required at all), does not become a part of the cluster topology, never holds any data or used as a destination of compute grid calculations.
What it does is it simply establishes a socket connection to a standard Ignite node and performs all operations through that node.
For more information, visit:
- Initialization and Configuration to learn how to configure and obtain references of the thin client APIs currently supported.
- Key-Value Operations to learn which JCache APIs are supported supported.
- SQL Queries to learn how to use SQL with the Java thin client API.
- Binary Types to learn how to use the Ignite Binary Objects API with the PHP thin client API.
- Security to see if the thin client has enough protection to connect to an enterprise Ignite cluster over Internet.
Quick Start
Prerequisites
- PHP version 7.2 or higher and Composer Dependency Manager.
- PHP Multibyte String extension. Depending on your PHP configuration, you may need to additionally install/configure it.
- Latest version of Apache Ignite
Installing from Sources
- Clone or download the Ignite repository to
local_ignite_path
- Go to
local_ignite_path/modules/platforms/php
folder - Execute
composer install --no-dev
command
cd local_ignite_path/modules/platforms/php
composer install --no-dev
To use the client in your application, include vendor/autoload.php
file, generated by Composer, to your source code. For example:
require_once "<local_ignite_path>/vendor/autoload.php";
Running an Example
After installing PHP thin client, let's run an example using existing PHP examples that are delivered with every Ignite distribution for the sake of quick getting started.
- Run Apache Ignite server.
To start a cluster node with the default configuration, open the terminal and, assuming you are inIGNITE_HOME
(Ignite installation folder), just type this:
$ bin/ignite.sh
$ bin\ignite.bat
- In another terminal window, go to
IGNITE_HOME/platforms/php/examples
and run an example by callingphp <example_file_name>.php
, like so:
cd IGNITE_HOME/platforms/php/examples
php CachePutGetExample.php
PHP example files
PHP thin client contains fully workable examples to demonstrate the behavior of the client.
Updated 2 months ago