{"id":13700099,"url":"https://github.com/kitech/php-go","last_synced_at":"2025-04-04T17:09:24.631Z","repository":{"id":57493639,"uuid":"58429259","full_name":"kitech/php-go","owner":"kitech","description":"Write PHP extension using go/golang. Zend API wrapper for go/golang.","archived":false,"fork":false,"pushed_at":"2019-09-20T04:36:21.000Z","size":121,"stargazers_count":882,"open_issues_count":25,"forks_count":108,"subscribers_count":51,"default_branch":"master","last_synced_at":"2025-03-28T16:09:58.869Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kitech.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-10T04:15:27.000Z","updated_at":"2025-03-11T07:14:12.000Z","dependencies_parsed_at":"2022-08-28T15:14:03.922Z","dependency_job_id":null,"html_url":"https://github.com/kitech/php-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitech%2Fphp-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitech%2Fphp-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitech%2Fphp-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitech%2Fphp-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitech","download_url":"https://codeload.github.com/kitech/php-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217221,"owners_count":20903009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T20:00:48.580Z","updated_at":"2025-04-04T17:09:24.613Z","avatar_url":"https://github.com/kitech.png","language":"C","funding_links":[],"categories":["扩展编写"],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/kitech/php-go/phpgo?status.svg)](https://godoc.org/github.com/kitech/php-go/phpgo)\n[![GoDoc](https://godoc.org/github.com/kitech/php-go/zend?status.svg)](https://godoc.org/github.com/kitech/php-go/zend)\n\n### php-go\n\nWrite PHP extension using go/golang. Zend API wrapper for go/golang. \n\nSimple, easy, fun to write PHP extensions.\n\n### Features\n\n* function support\n* struct/class support\n* constant support\n* primitive data type as parameters and return values, (u)int*/float*/string/bool\n* complex data type as parameters, map/slice/array\n* all can be done by programmatic\n\n### Environment\n\n* Modern Linux/Unix system\n* PHP 5.5+/7.x\n* go version 1.4+\n* php5-dev installed (`apt-get install php5-dev`)\n* for MacOS, go 1.8+\n\n### Build \u0026 Install\n\ngo get:\n\n```\ngo get github.com/kitech/php-go\ncd $GOPATH/src/github.com/kitech/php-go\n# adjust PHPCFG path if needed\nPHPCFG=`which php-config` make\n```\n\nmanual:\n\n    mkdir -p $GOPATH/src/github.com/kitech\n    git clone https://github.com/kitech/php-go.git $GOPATH/src/github.com/kitech/php-go\n    cd $GOPATH/src/github.com/kitech/php-go\n    make\n    ls -lh php-go/hello.so\n    php56 -d extension=./hello.so examples/hello.php\n\n\n### Examples\n\n```go\n// package main is required\npackage main\n\nimport \"github.com/kitech/php-go/phpgo\"\n\nfunc foo_in_go() {\n}\n\ntype Bar struct{}\nfunc NewBar() *Bar{\n    return \u0026Bar{}\n}\n\nfunc init() {\n    phpgo.InitExtension(\"mymod\", \"1.0\")\n\n    phpgo.AddFunc(\"foo_in_php\", foo_in_go)\n    phpgo.AddClass(\"bar_in_php\", NewBar)\n}\n\n// should not run this function\n// required for go build though.\nfunc main() { panic(\"wtf\") }\n```\n\n### Limitations\n\n* Deadlock in pcntl_fork'ed subprocess when call extension functions. #47\n\n\n### TODO\n\n- [ ] install with go get \n- [x] improve php7 support\n- [ ] namespace support\n- [ ] multiple extension support\n- [ ] class member access support\n- [x] unlimited function/method/class count support\n- [x] global ini var support\n- [ ] fill phpinfo\n\n\nContributing\n------------\n1. Fork it\n2. Create your feature branch (``git checkout -b my-new-feature``)\n3. Commit your changes (``git commit -am 'Add some feature'``)\n4. Push to the branch (``git push origin my-new-feature``)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitech%2Fphp-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitech%2Fphp-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitech%2Fphp-go/lists"}