-
Install from github zephir.phar Latest URL https://github.com/zephir-lang/zephir/releases
-
Rename the file zephir.phar to zephir and place it in the /bin directory
-
Check if installed
zephir help
-
Install zephir_parser
pecl install zephir_parser
Add extension to php.ini. Reload
extension=zephir_parser.so
-
Execute initialization
zephir init app // app为命名空间
-
Enter the app directory and there are files config.json, ext directory, app directory
-
Write a simple PHP case
namespace App; class MyClass { public static function sayHello() { return "Hello from Zephir!"; } }
-
Execute build packaging and wait for packaging to the ext directory
zephir build
Results of the
Preparing for PHP compilation... Preparing configuration file... Compiling... Zephir version has changed, use "zephir fullclean" to perform a full clean of the project Installing... Extension installed. Add "extension=app.so" to your php.ini ! [NOTE] Don't forget to restart your web server
-
Enter ext and execute install to install into the PHP environment so, and restart the PHP service
-
Create a new PHP file
echo App\MyClass::sayHello();
-
Display Hello from Zephir! normally.
zephir implements PHP encapsulation into C language extension files so implements a simple case of demo [Rookie Level Tutorial]
Guess you like
Origin blog.csdn.net/abc564643122/article/details/134765427
Recommended
Ranking