Skip to content

kaja47/phpmod.d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

phpmod.d

Write PHP extensions without unending misery of C, macros and PHP build system.

Imagine a world where you can expose a native function to PHP by writing couple lines of D code just like this:

import phpmod;

mixin mod!(bitops);

long popcount(long x) {
  import core.bitop : popcnt;
  return popcnt(x);
}

Then compiling that tiny file by simple invocation of your favourite compiler:

gdc-15 -shared -fPIC -O2 -fpreview=all phpmod.d bitops.d -o bitops.so

or

ldc2 -shared -O2 --preview=all phpmod.d bitops.d --of=bitops.so

And finally loading it:

php -d extension=./bitops.so

All that without ever touching everlasting horrors of C, wrestling with abysmal build system or being exposed to rancid guts of PHP virtual machine?

That world is possible. phpmod.d is the tool that do just that.

You write your code in a neat, expressive a performant native language and let all the garbage needed to interface with the PHP runtime be auto-generated during compilation.

About

Bindings for the PHP API to build native PHP extensions in D language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors