phalcon/zephir

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

0.9.6 2017-01-03 15:53 UTC

README

Dependency Status 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

Requirements

To compile zephir-parser:

To build the PHP extension:

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

Installation

First, clone Zephir repository.

Next, you have to get Zephir Parser. The most easy way to do it is to use git submodule command:

git submodule init
git submodule update

Then you have to install it:

cd modules/php-zephir-parser
sudo ./install

Add the extension to your php.ini:

[Zephir Parser]
extension=zephir_parser.so

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

Easy way pull latest of all submodules

For git 1.6.1 or above you can use something similar to:

git submodule update --remote --merge

See git-submodule(1) for details.

Additional notes on Ubuntu

The following packages are needed in Ubuntu:

  • apt-get install re2c libpcre3-dev

Usage

Compile the extension:

./bin/zephir compile

External Links

Contributing

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

License

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