Skip to content

phplang/p3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

P3: PHP Plus Plus

This repository contains a single useful item: p3.h. This file may be freely (BSD License) included in any PHP extension project to quickly and easily wrap a C++ class into a PHP class. The C++11 templates take care of all the boilerplate methods like allocators, constructors, cloning, and reserving extra space for the base zend_object.

Two example extensions have been included in this repo:

  • MyFile is a very basic File implementation with read/write methods.
  • Simple is an even simpler object which does nothing but track a counter var.

The inline documentation in p3.h itself, as well as MyFile should provide enough information. Simple is deliberately undocumented as it's meant to show how small the code for a custom object can be.

Otherwise, the key items to note are PHP_REQUIRE_CXX() and -std=c++11 in config.m4.

Future Plans

  • dim/obj read/write/isset/unset accessors
  • Wrapped property access (short-hand for above)

About

PHP++: C++11 Class wrap library for PHP7

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published