Zephir is a compiled high level language aimed to the creation of C-extensions for PHP

0.10.10 2018-05-24 21:31 UTC


Latest Stable Version Total Downloads License Build on Linux Build on Windows

Zephir - Ze(nd Engine) Ph(p) I(nt)r(mediate) - is a high level language that eases the creation and maintainability of extensions for PHP. Zephir extensions are exported to C code that can be compiled and optimized by major C compilers such as gcc/clang/vc++. Functionality is exposed to the PHP language.

Main features:

  • Both dynamic/static typing
  • Reduced execution overhead compared with full interpretation
  • Restricted procedural programming, promoting OOP
  • Memory safety
  • Ahead-of-time (AOT) compiler to provide predictable performance

Compiler design goals:

  • Multi-pass compilation
  • Type speculation/inference
  • Allow runtime profile-guided optimizations, pseudo-constant propagation and indirect/virtual function inlining


  • re2c >= 0.13.6
  • Zephir Parser >= 1.1.0
  • A C compiler such as gcc >= 4.4 or an alternative such as clang >= 3.0, Visual C++ >= 11 or Intel C++. It is recommended to use gcc 4.4 or later
  • GNU make >= 3.81
  • automake
  • PHP development headers and tools
  • The build-essential package when using gcc on Ubuntu (and likely other distros as well)


NOTE: The development branch will always contain the latest unstable version. If you wish to check older versions or formal, tagged release, please switch to the relevant branch/tag.


To install Zephir on Windows follow this guide.

Linux | macOS | BSD | Solaris

Git way

Clone Zephir repository.

Then, install Zephir by using command ./install from project root dir. For global installation add -c flag.

Composer way

You can install Zephir using composer.

To get Zephir, run composer require phalcon/zephir.

Additional notes on Ubuntu

The following packages are needed in Ubuntu:

  • apt-get install re2c libpcre3-dev


Compile the extension:

zephir compile

External Links


See for details about contributions to this repository.


Zephir is open-sourced software licensed under the MIT License. See the LICENSE file for more information.