Is there something like Python ctype for PHP? Access to libraries without having to write an extension?

Python has ctypes for accessing libraries. In PHP, you write extensions for everything. Popular extensions, such as libgd, are available almost everywhere.

Is there any extension that works like Python types, allowing you to access libraries without having to write a PHP extension?

+7
c php shared-libraries
source share
4 answers

I do not know anything. But you can let SWIG build the extension for the library you need.

0
source share

Are you looking for ffi .

+2
source share

There is a PHP extension (irony?) Called ffi . FFI stands for External Function Interface , which is a general term when a language calls libraries written in another language.

+1
source share

I don’t think there is such a thing: in PHP the “standard” way to use the library is to impose a wrapper on it that exports the library functions to PHP.

(But maybe an extension could be written to do what ctypes do? - Not sure, but maybe ^^)

0
source share

All Articles