定制 tuqqu/go-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tuqqu/go-php

Composer 安装命令:

composer require tuqqu/go-php

包简介

Implementation of Go language interpreter written in PHP

README 文档

README

Golang interpreter written in PHP.

Example

use GoPhp\Interpreter;

$interp = Interpreter::create(<<<GO
    package main
    
    type person struct {
        name string
        age  int
    }
    
    func newPerson(name string) *person {
        p := person{name: name}
        p.age = 42

        return &p
    }

    func main() {
        s := newPerson("John Doe")
    
        println("Hello, " + s.name)
    }
GO);

$result = $interp->run();

See examples for more. To run examples:

cd ./examples/{name}
php main.php

WIP

This is a toy project, not intended for production use.

To see what is already implemented, refer to tests.

Development

install dependencies:

composer install

run tests:

make test

run make help for more commands.

Differences from the Go compiler

  • No support for real goroutines, go statements run sequentially

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 184
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 184
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-25