You could extend PHP to use existing libraries and classes in the same way that it already does so for things like cURL and LibMcrypt: write Zend API wrappers that call those libraries (this is why we have header files). You're going to have to write something, after all - otherwise how is PHP supposed to know how to use your library?
A(nother) source of information on this would therefore appear to be the PHP source code. PHP's source code for its mcrypt functions is under 50kB, and that for cURL is just over.
Of course, if you just want to build your existing code as standalone executables and have PHP run it that way, you can ... doesn't matter how they're written, then.