PHP is a general-purpose scripting language that is used primarily in Web development. The PHP interpreter is typically installed as a Web server plug-in, and PHP itself also supports plug-ins known as "extensions." PHP extensions, by definition, extend the interpreter’s run-time environment by adding new functions and data types.
The Ice extension for PHP, IcePHP, provides PHP scripts with access to Ice facilities. IcePHP is a thin integration layer implemented in C++ using the Ice C++ run-time library. This implementation technique has a number of advantages over a native PHP implementation of the Ice run-time:
IcePHP supplies a robust subset of the Ice run-time facilities. PHP scripts are able to use all of the Slice data types in a natural way (see
Section 24.4), make remote invocations, and use all of the advanced Ice services such as routers, locators and protocol plug-ins.
The primary design goal of IcePHP was to provide PHP scripts with a simple and efficient interface to the Ice run-time. To that end, the feature set supported by IcePHP was carefully selected to address the requirements of typical PHP applications. As a result, IcePHP does not support the following Ice features:
The traditional design for a language mapping requires the intermediate step of translating Slice definitions into the target programming language before they can be used in an application.
IcePHP takes a different approach, made possible by the flexibility of PHP’s extension interfaces. In IcePHP, no intermediate code generation step is necessary. Instead, the extension is configured with the application’s Slice definitions, which are used to drive the extension’s run-time behavior (see
Section 24.3).
The Slice definitions are made available to PHP scripts as specified by the mapping in
Section 24.4, just as if the Slice definitions had first gone through the traditional code-generation step and then been imported by the script.