2

Is there a way to make one of my PHP API libraries compiled into PHP extensions? I don't want my client see the source code of that PHP API.

I searched and found the same, BUT with Cython (of Python): How to protect and compile python source code into a .so library?

Thanks!

Community
  • 1
  • 1
Bonn
  • 53
  • 1
  • 13

1 Answers1

1

The sort-of equivalent in PHP-world is "HipHop for PHP", which takes PHP code, translates it into C++, and compiles it. This, of course, adds dependency requirements to any web server that's using your library.

Linky: https://github.com/facebook/hiphop-php/wiki

utopianheaven
  • 1,267
  • 7
  • 18
  • 1
    based on this post: http://stackoverflow.com/questions/7646276/using-hiphop-for-php-extension-development, I don't think hiphop could create such extensions – Bonn Nov 05 '12 at 06:59
  • I wouldn't see why you couldn't compile your "protected/API" PHP code into C++ using HipHop and then write a simple wrapper that wraps this code to expose it to PHP again for others to use in PHP? Having used HipHop on some projects myself, I don't see why this wouldn't work... it's no different than creating an API for any other C++ program. (That said, I wouldn't want to think of the dependencies this API might have now...) – utopianheaven Nov 05 '12 at 07:05