Download

To get the most recent version, you can fork the PHP-CPP library on GitHub.
If you need or prefer a stable version you can download one of the available
releases. When downloading one of the below releases make sure to come back
in the future to upgrade to a newer (and improved) version.

PHP-CPP 2.1.2

v2.1.2 released

* Fix where info->type was not correctly assigned, resulting in garbage being dereferenced (php7.2). fix compilation error for php7.3 regarding the way constants are implemented in zend.
* info->type is >php7.2 only
* Always dereference our value, if it is not a reference we get the original back again
* Constants were not right after all, and the iterator structure is slightly different for 7.3.
* iterator_funcs is now of pointer type
* Fix build on OSX (#391)
* Added PHP7.3 support

PHP-CPP 2.1.1

v2.1.1 released

* Add automatic builds for g++-4.8 up to g++-8 and clang++-4.0 to clang++-6.0. Also resolves #357 by moving the `-shared` flag further down on the command line parameters, after the point PHP had the chance to taint them by including the `-pie` flag.
* If our zend value is a reference, pass through the reference to retrieve the object class entry

Version 1.5.3

Version 1.5.2

v1.5.2 released

This is a bugfix release
- Properly handle a Php::Exception when thrown from a serialize method.
- Handle exceptions thrown from unserialize similar to normal php.
- Fix issue with derived classes. closes #211
- Fix logic error that caused segfaults for extension-created classes extended from userland using a doc-block

Version 1.5.1

v1.5.1 released

This release only adds some error related functions
- The php error_reporting function is exposed without any slow Php::call() calls
- The php set_error_handler function is exposed without any slow Php::call() calls
- Exposed all of the E_\* properties as an enum

Version 1.5

v1.5 released

PHP-CPP version 1.5 is mainly a bugfix release, and it has a small number of new features:
- PHP interfaces defined in C++ can now also have static methods
- Fixed segmentation fault crash when casting objects
- Fixed crash when calling chained C++ methods from a PHP script
- Allowed "Php::Value x = y["whatever"]" syntax in C++ code
- Fixed memory leak when calling function stored in a Php::Value object
- Fixed memory leak when a Php::Iterator object was being used

Version 1.4

v1.4 released

New release with several bugfixes and some new features
- Added a function to load other extensions by path
- Fixed some symbols that were not being exported
- Value::rawValue() will now return nullptr in case the Value is not a string
- Value::get(int) and Value::contains(int) now also work on Objects implementing ArrayAccess
- Makefile will now add the version using sonames

Version 1.3.2

v1.3.2 released

This release is mainly a bugfix release
- Implemented a simple sapi_name() method which will return the current sapi.
- On Windows with mingw EOF was not defined.
- Added access checks to Php::Value::contains.
- Fixed the Value::contains method and added the isCallable(name) function to see if the object has an accessible member function
- Changed default visibility for symbols in the PHP-CPP library to hidden and explicitly exported all symbols available from the public API.
- Fix compile issue with PHP 5.3
- Added article about dynamic loading
- Added DlUnrestricted example extension
- Fixed a crash when dynamicly loaded extensions were unloaded

Version 1.3

v1.3 released

A new release of PHP-CPP with bug fixes and new features. The highlights are:
- Value::unset() method has been fixed to make it possible to remove array/object members
- Reduced amount of code by using variadic templates
- All move and assignment operators are marked as 'noexcept'
- Fixed chaining methods, it now is possible to "return this"
- FIxed memory leaks
- Added Php::Script and Php::File classes that can evaluate PHP scripts
- Added methods Php::include(), Php::include_once(), Php::require() and Php::require_once()
- Fixed return value of Php::eval() function (this could break existing applications that rely on old behavior)
- It now is possible to iterate over super-globals like Php::POST, Php::SERVER, etcetera
- Added Php::Function class that allows one to capture C++ lambdas and pass them over to PHP user space
- Added support for constants using the Php::Constant class
- Added functions Php::define(), Php::defined() and Php::constant()
- Added version check to ensure that a compiled extension is compatible with the installed version of PHP-CPP

Version 1.2.2

v1.2.2 released

This release is mainly a bugfix version
- Fixed a memory leak with Php::Value objects not being freed correctly when returned
- Php::Object("MyClass") no longer crashes when there is no __construct() function
- It is now slightly easier to cross compile

Version 1.2.1

v1.2.1 released

Minor release which adds a few minor things.
- Php::Value can now be casted to a std::set
- Php::ByVal and Php::ByRef will now be type-less if no type provided
- Makefile will now respect the specified php-config binary
- Makefile will now build a static library as well

Version 1.2

v1.2 released

This is mainly a bugfix version + some new features and change in behavior of some functions.
- New feature: Php::Value objects can now also be compared with other Php::Value objects using C++ comparison operators like ==, , etcetera.
- Fix: magic methods were not working for objects created with Php::Object("MyClass", new MyClass())
- Fix: moving nullptr to a Php::Value object caused a crash
- Fix: infinite loop when compariting value objects with each other using operator ==
- New feature: A C++ class does no longer have to have a default constructor to be usable from PHP
- Changed behavior: PHP-CPP used to throw PHP exceptions to user space when an error occured, while the Zend engine would trigger a fatal error in similar situations and stop further execution. This was a difference between PHP-CPP and the Zend engine. This has been changed: now PHP-CPP also triggers fatal errors when the programmer makes a mistake (instead of throwing exceptions).
- Fix: methods and properties from base classes were not available in derived classes
- New feature: Php::eval() function
- New feature: Php::class_exists() function
- New feature: Php::is_a() and Php::is_subclass_of() functions
- New feature: Methods Php::Value::instanceOf() and Php::Value::derivedFrom()
- Fix: creating a Php::Value based on a std::map would not result in an array variable being created
- Fix: for objects created using Php::Object() constructor, the __construct() method was not called
- Fix: traversing through array properties was not always working when property names started with a null byte
- Fix: casting a Php::value holding an array to a map with string keys, will now turn the keys into numeric string keys ("1", "2", etcetera)
- Fix: "apachectl reload" caused a crash on PHP 5.3 environments
- Changed behavior: setting or retrieving properties of a Php::Value that start with a null byte (to rely on the Zend implementation of private properties) will no longer work (PHP-CPP users should never rely on specific Zend features)

Version 1.1.1

Version 1.1

v1.1 released

Release 1.1 of the PHP-CPP library contains a number of small bug fixes, and support for php.ini variables.

The source code and directory structure of the library has been refactored to prepare for future support of HHVM, so that extensions written with PHP-CPP can be used in combination with Zend, and in combination with HHVM. This is work in progress: currently PHP-CPP extensions only work with Zend.

The most important changes in version 1.1 are:
- Support for php.ini entries.
- Restructured source code to be engine agnostic.

Version 1.0

v1.0 released

This is the first stable release of the PHP-CPP library. Since the previous release various bugs have been fixed and a number of small features have been added. These are the highlights:
- Support for TRSM (multi-threading PHP installations)
- Test framework has been added to the source distribution
- Fixed iterating over arrays
- Fixed populating multidimensional arrays
- Allow chaining of class/method/property registration methods.
- Class and interface inheritance can be specified in the get_module() startup function
- Fixed super-global Php::SERVER when running as Apache module with just-in-time population
- Added support for static class properties

Version 0.9.2

v0.9.2 released

This release has mainly bug fixes, and some small new necessary features:
- A unit test framework has been added
- Object properties could not have initial negative values
- C++ iterators were not correct when iterating over PHP classes that implemented Iterator or IteratorAggregate
- Output streams 'Php::out', 'Php::notice', 'Php::warning' and 'Php::error' and 'Php::deprecated' have been added
- Setting up multidimensional arrays was not working correctly

Version 0.9.1

v0.9.1 released

In PHP-CPP version 0.9.1 several small memory corruption bugs have been fixed, and some changes have been made that prevented the library from being compiled for different PHP versions or with different compilers than the ones used by us.

No new features have been introduced. Just like PHP-CPP v0.9 this is a feature-freeze releases that prepares for the upcoming v1.0 version.

Version 0.9

v0.9 released

This v0.9 release has all the features that we want to have in v1.0. But it has not been tested so extensively, hence the v0.9 tag: almost v1.0, but not completely stable.

The most important new features and changes since the previous release (v0.2) are:
- Php::Serializable class
- Support for __clone(), __destruct() and __callStatic() methods
- C++ classes without a copy constructor automatically are unclonable in PHP too
- Magic methods are no longer virtual, which allows one to use alternative method signatures
- Introduces "super-globals" Php::GET, Php::POST, Php::COOKIE, etc. just like PHP has.
- Properties can be implemented with callback methods, enabling read-only properties
- Fixed issues to compile on OSX
- Direct access to the string buffer inside a Php::Value object is now allowed

Because magic methods no longer are virtual, the v0.9 release is not compatible with v0.2. Extensions that were developed using PHP-CPP v0.2 have to be recompiled, and possible be slightly modified too to match the new magic method signature.

Version 0.2

v0.2 released

The PHP-CPP library is making progress. Since v0.1 many things have changed and many new features have been introduced - too many to even mention. Version 0.2 is not compatible with 0.1. This means that you will have to make changes to your extensions if you upgrade from v0.1 to v0.2.

This version has been brought out to give _some_ stability to extensions writers, and to allow the PHP-CPP development to move on without having to worry about breaking existing extension with every change that is made to the library.

This is an pre-release with an API that is not yet stabilized. The library is in a usable state, but we do not guarantee that future releases will be compatible with v0.2.

Version 0.1

Who is behind PHP-CPP?

PHP-CPP is made by
Copernica,
a leading provider of high quality marketing software located in Amsterdam, The Netherlands. With Copernica you can deliver relevant and timely communications using
email,
sms,
landing pages
and
PDF.