Skip to content

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

License

Notifications You must be signed in to change notification settings

micheylin/zephir

 
 

Repository files navigation

Zephir

Build Status Coverage Status Dependency Status Latest Stable Version Total Downloads

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:

  • json-c (Please install this one from Github)
  • re2c

To build the PHP extension:

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

Installation

You can install zephir using composer. Run composer require phalcon/zephir, 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

Usage

Compile the extension:

./bin/zephir compile

Documentation & Blog

  • A preliminary documentation can be found here
  • Official Blog can be found here
  • Sublime/TextMate highlight-syntax bundle here

License

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

Contributing

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

Donate & Sponsor

Zephir is available to the public without charge, under the permissive MIT License. Zephir is available to everyone freely on terms that allow both non-commercial and commercial activity. This license allows for academics, for-profit software developers, volunteers and enthusiasts alike to collaborate together to make a better software for everyone.

Donate allowing us to invest more time and resources to the project, ensuring it will be ready sooner and with loads of features.

Donate

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:

Build Status

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published