Zephir is a compiled high level language aimed to the creation of C-extensions for PHP
C PHP Zephir C++ HTML M4 Other
Latest commit 72dbb20 Jan 3, 2017 @sergeyklay sergeyklay committed on GitHub Merge pull request #1380 from sergeyklay/master
Bump version
Failed to load latest commit information.
Library Bump version Jan 3, 2017
bin Avoid using "-a" or "-o" with "[" Sep 29, 2016
ext Fixed "sh: 1: cd: can't cd to ext" Nov 30, 2016
generated chore(ZendEngine_2): e5ef2f5: regenerate test sources [ci skip] Dec 1, 2016
kernels Removed IS_TYPE_IMMUTABLE Dec 30, 2016
parser Make build_linux.sh POSIX compliant Sep 14, 2016
prototypes Fixed Imagick::getVersion Dec 26, 2016
runtime [Runtime] Fix #989 issue, IS_CONSTANT_ARRAY was removed in PHP 5.6 Jun 27, 2015
templates Link-time Code Generation on Windows Aug 29, 2016
test Introduced HashEqualsOptimizer Dec 1, 2016
unit-tests Introduced HashEqualsOptimizer Dec 1, 2016
.editorconfig Introduced HashEqualsOptimizer Dec 1, 2016
.gitattributes Added sha to Zephir version when possible May 22, 2016
.gitignore Fixed "sh: 1: cd: can't cd to ext" Nov 30, 2016
.linter-clang-includes Added linter clang includes Aug 12, 2016
.travis.yml Use EG(fake_scope) replaced EG(scope) (#1322) Sep 21, 2016
CONTRIBUTING.md Export symbol using string Aug 22, 2014
LICENSE Updated Copyright Nov 26, 2016
README.md Code cleanup (#1304) Aug 28, 2016
WINDOWS.md docs(win32): Update windows documentation regarding parser Dec 13, 2015
appveyor.yml Fixed Appveyor build Sep 27, 2016
bootstrap.php Updated Copyright Nov 26, 2016
compiler.php Updated Copyright Nov 26, 2016
composer.json Cleaned composer.json Nov 26, 2016
config.json Upd config.json - api docs options Apr 4, 2015
id_rsa.enc chore(ci): Attempt implementing automated regenerating Nov 14, 2015
install Updating year to 2016 [ci skip] Apr 25, 2016
install-nosudo Fixed install-nosudo Aug 13, 2016
phpunit.xml.dist Fix risky unit tests (#1266) Aug 9, 2016



Dependency Status Latest Stable Version Total Downloads License

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


To compile zephir-parser:

To build the PHP extension:

  • g++ >= 4.4/clang++ >= 3.x/vc++ 9
  • gnu make 3.81 or later
  • php development headers and tools


You can install zephir using composer. Run composer require phalcon/zephir, run ./install and then run zephir from your bin-dir. By default it is ./vendor/bin/zephir. You can read more about composer binaries in it's documentation.

For global installation via composer you can use composer global require. Do not forget add ~/.composer/vendor/bin into your $PATH.

Also you can just clone zephir repository and run ./install. For global installation add -c flag.

Additional notes on Ubuntu

The following packages are needed in Ubuntu:

  • apt-get install re2c libpcre3-dev


Compile the extension:

./bin/zephir compile

External Links


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


See CONTRIBUTING.md for details about contributions to this repository.

Current Build Status

Zephir is built under Travis CI service. Every commit pushed to this repository will queue a build into the continuous integration service and will run all PHPUnit tests to ensure that everything is going well and the project is stable. The current build status is:

  • Linux: Build Status
  • Windows: Build status