The design of the PHPEmbed library centers on the principle of simplicity. The problem with the existing PHP SAPI is that it is complicated and requires a substantial amount of understanding to accomplish even basic tasks. The goal was to build a library that required no knowledge of the inner workings of PHP and provided the most useful functionality ``out of the box.''
The PHPEmbed library also provides relatively complete functionality. In addition to providing clients the ability to call any PHP function from C++ and get back return values, all with automatic translation between basic PHP types and C++ POD types, PHPEmbed also provides an optional Standard Template Library (STL) extension to support a number of more complex type conversions such as converting PHP arrays to vectors, sets, or even hash maps. In order to support arbitrarily nested and weakly typed PHP arrays there is a simple php_array class and iterator in C++ which can be used both to navigate PHP arrays internally but also to create arrays to pass to PHP functions. Finally, there is a PHP tokenizing library included although there is no example usage or support of any kind for that code at this time.
In general, this implementation errs towards copying data rather than mutating it in place or incrementing ref counts without regard to the longevity of the embedded object. Macros have been avoided since they tend make code harder to understand and debug and have no impact on the performance in this case.1 The library is intended to remain easy to use and understand above all else.