Giter VIP home page Giter VIP logo

zephir-lang / php-zephir-parser Goto Github PK

View Code? Open in Web Editor NEW
181.0 19.0 36.0 975 KB

The Zephir Parser delivered as a C extension for the PHP language.

Home Page: https://zephir-lang.com

License: MIT License

Shell 0.33% C 49.43% C++ 4.22% M4 0.94% PHP 43.04% JavaScript 0.21% PowerShell 0.34% Makefile 0.55% Emacs Lisp 0.05% Dockerfile 0.89%
zephir php-extension php lemon parser parser-generator c php-api zend-engine lalr

php-zephir-parser's Introduction

Zephir Parser

Actions Status Coverage Status License Discord

The Zephir Parser delivered as a C extension for the PHP language.

Supported PHP versions: 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 and 8.2

NOTE: The development branch will always contain the latest unstable version. If you wish to check older versions or formal, tagged release, please switch to the relevant branch/tag.

Get Started

Build Requirements

Prerequisite packages are:

  • OS: Linux || Solaris || FreeBSD || macOS || Windows
  • Compiler: g++ >= 4.4 || clang++ >= 3.x || vc++ >= 11
  • re2c >= 0.13.6

To build extension from the source you will need the PHP development headers. If PHP was manually installed, these should be available by default. Otherwise, you will need to fetch them from a repository.

PECL

pecl install zephir_parser

Windows

To install Zephir Parser on Windows:

  1. Download Zephir Parser for Windows
  2. Extract the DLL file and copy it to your PHP extensions directory
  3. Edit your php.ini file and add this line:
    [Zephir Parser]
    extension=php_zephir_parser.dll

Linux

On a Linux/Unix-based platform you can easily compile and install the extension from sources.

For Linux/Unix-based based systems you'll need also:

Ubuntu

sudo apt-get install php7.0-dev gcc make re2c autoconf automake

Suse

sudo zypper install php7.0-devel gcc make re2c autoconf automake

CentOS/Fedora/RHEL

sudo yum install php-devel gcc make re2c autoconf automake

General Compilation

Follow these instructions to generate a binary extension for your platform:

git clone git://github.com/zephir-lang/php-zephir-parser.git
cd php-zephir-parser
phpize
./configure
make
sudo make install

If you have multiple/specific PHP versions installed, you may be able to specify for which installation you'd like to build by using the --with-php-config option during configuration. For example:

git clone git://github.com/zephir-lang/php-zephir-parser.git
cd php-zephir-parser
/usr/local/bin/phpize
./configure --with-php-config=/usr/local/bin/php-config
make
sudo make install

Add the extension to your php.ini:

[Zephir Parser]
extension=zephir_parser.so

Usage

$program = <<<EOF
namespace Acme;

class Greeting
{
    public static function sayHello() -> void
    {
        echo "Hello, World!";
    }
}
EOF;

$retval = zephir_parse_file($program, '(eval code)');

var_dump($retval);

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

License

Zephir Parser is open source software licensed under the MIT License (MIT). See the LICENSE file for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.