Installation

There is a Docker image for Zephir.

Use PHP Function

You can use php function in zephir. For example

namespace Test;

class Hello
{
    public function say()
    {
        fib();
    }
}

When you build, zephir shows you this:

Warning: Function “fib” does not exist at compile time in /tmp/test/test/Hello.zep on 7 [nonexistent-function]

<?php
function fib()
{
    echo '1 1 2 3 5 8';
}
$hello = new Test\Hello();
$hello->say();

When you execute the php file, you see this:

1 1 2 3 5 8

This shows you that you can use php function in zephir.

Use Extension Function

You can use function from other PHP extension. For example:

namespace Test;

class Hello
{
    public function say()
    {
        var ch;

        let ch = curl_init("http://example.com/");

        curl_exec(ch);
    }
}
<?php
$hello = new Test\Hello();
$hello->say();