Questions tagged [zephir]

Zephir - Ze(nd Engine) Ph(p) I(nt)r(mediate) - is a high level language that eases the creation and maintainability of C-extensions for PHP.

Zephir Language

Zephir - Ze(nd Engine) Ph(p) I(nte)r(mediate) - is an open source high level language that eases the creation and maintainability of C-extensions for .

Zephir extensions are exported to C code that can be compiled and optimized by major compilers such as //. Functionality is exposed to the language.

Zephir aims for near full interoperability with existing code.

Main features:

  • Both dynamic/static typing
  • Reduced execution overhead compared with full interpretation
  • Restricted procedural programming, promoting OOP
  • Memory safety
  • Ahead-of-time compiler

Compiler design goals:

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

Installation

xx is the parser for the language:

Requirements:

json-c re2c

Installation on Ubuntu

sudo apt-get install libjson0 libjson0-dev libjson0-dbg
sudo apt-get install re2c

Once you have the required packages installed, you can generate the parser as follows:

./generate

Usage

Compile the extension:

./zephir

The code produced is placed in ext/, there you can perform the standard compilation:

cd ext/
sudo ./install

The code is maintained on Github

Zephir is going to be the language that will drive the development of 2.0 (http://www.phalconphp.com/en/)

Support

Due to the fact that the language is very young, support is not offered at this point. General questions can be posted in the Phalcon Forum.

34 questions
8
votes
1 answer

PHP Fatal error: Class 'jsonserializable' not found in Unknown on line 0

Ubuntu 16.04 PHP 7.0.4 Phalcon 2.1.x Zephir $~: php -v PHP Fatal error: Class 'jsonserializable' not found in Unknown on line 0 When add phalcon.so in php.ini
8
votes
1 answer

Is it possible with Zephir to include an external library?

I have some code in C which does some hardware access. This code is ready and well tested. Now I want to implement a web interface for controlling this hardware. So I came along PHP extension development with Zephir. My question is, „Is it possible…
white_gecko
  • 4,808
  • 4
  • 55
  • 76
4
votes
1 answer

Multiple class files in a Zephir extension

I'm doing some experiments with Phalcon Zephir to see how well it can convert some of my libraries to PHP extensions. I have two PHP classes, each already defined in its own file: the Zephir notes are quite clear that this must be the…
Mark Baker
  • 209,507
  • 32
  • 346
  • 385
4
votes
2 answers

How can I install Zephir on Ubuntu?

I would like to install Zephir on my Ubuntu machine. The goal is to convert some of my existing code into a PHP extension, in order to get the benefits of faster execution. Any pointers are more than appreciated.
Nikolaos Dimopoulos
  • 11,495
  • 6
  • 39
  • 67
3
votes
1 answer

Need Help Understanding a Crude Benchmark: Regular PHP vs HHVM vs Zephir

I performed this test using a simple factorial function (borrowed the logic from http://avelino.xxx/2014/03/golang-c-and-python-the-benchmark-time) Regular PHP Code function fact($n){ if($n===0)return 1; return $n*fact($n-1); } function…
Kul
  • 1,239
  • 8
  • 18
3
votes
1 answer

run the zephir language on windows machines

Is it possible to use the zephir language on a windows system when the packages json-c and re2c are required. Can I somehow install or build the packages in windows to then build and run zephir?
2
votes
1 answer

error zephir_parser extension not loaded windows

I have followed all steps here to install zephir on windows 7 32bits I run php with wampserver 2.5, I have downloaded PHP5.6.33 and added it to wampserver successfully I have installed visual studio 2012 I have created an extension namespace as that…
khalil
  • 107
  • 2
  • 15
2
votes
1 answer

PHP unable to load dynamic extension (invalid ELF header) [PHP + Zephir]

got a little problem over here. I've compiled example Zephir plugin on my machine, which works fine on the workstation, but when I move it eg. to production server, I receive this weird php error: PHP Startup: Unable to load dynamic library…
ben.arr
  • 21
  • 1
  • 2
2
votes
1 answer

Using PDO in Zephir

As part of my experiments with Zephir I am currently trying to use PHP PDO to access a MySQL database. For starters I found that a relatively innocuous $dbh = new PDO("mysql:host=localhost;dbname=dbn;","user","pwd"); when translated and used in…
DroidOS
  • 8,530
  • 16
  • 99
  • 171
1
vote
0 answers

Thread network connection issues

We have a thread network of about 40 Nordic nrf52840 endpoints and an OTBR made of Raspberry Pi and a nrf52840 dongle. End points use SLAAC enabled. In some cases, the OTBR finds network to join but stops functioning once joining or creating a…
GiladF
  • 11
  • 1
1
vote
0 answers

Zephir curl dependency

How to properly introduce the curl extension as a dependency? Simply trying to create an array that references constants from the curl extension like so public function __construct() { let this->options = [ CURLOPT_SSL_VERIFYPEER :…
quickshiftin
  • 66,362
  • 10
  • 68
  • 89
1
vote
0 answers

How to call my extension method to detect written annotation?

Hi i'm tring to write an extension for php in zephir or php-cpp to call my customMethod from my extention when comment block like code below added to php file any suggestion note will be appreciate
phpniki
  • 758
  • 4
  • 13
1
vote
1 answer

zephir_parser extension not loaded

I'm running on ubuntu 14.04 and I installed php5.6. I'm trying to do the Hello world with Zephir but when I compile my project with : zephir build I got this error : zephir_parser extension not loaded, compiling it Parser statistics: 127 terminals,…
John
  • 4,711
  • 9
  • 51
  • 101
1
vote
0 answers

Zephir extension class in Global space

Is it possible to create a Zephir extension that exposes classes in the PHP Global space? Without any namespace definition, all class and function definitions are placed into the global space Any attempts to leave out a namespace provides the…
Sean3z
  • 3,745
  • 6
  • 26
  • 33
1
vote
1 answer

run zephir build error on tutorial

I installed zephir OK (0.3.7a) and run the test, and got error as follows: [root@vmlinux64 test]# zephir build PHP Warning: system() has been disabled for security reasons in /usr/local/lib64/zephir/Library/CompilerFile.php on line 107 PHP …
william.shark
  • 91
  • 1
  • 8
1
2 3