프로젝트
GitHub에서 보기
kitech/php-go
소개
Go/Golang으로 PHP 확장을 작성합니다. Go/Golang용 Zend API 래퍼입니다.
기타 프로젝트What you can do
- function support
- struct/class support
- constant support
- primitive data type as parameters and return values, (u)int*/float*/string/bool
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalphp-go
Write PHP extension using go/golang. Zend API wrapper for go/golang.
Simple, easy, fun to write PHP extensions.
Features
- function support
- struct/class support
- constant support
- primitive data type as parameters and return values, (u)int*/float*/string/bool
- complex data type as parameters, map/slice/array
- all can be done by programmatic
Environment
- Modern Linux/Unix system
- PHP 5.5+/7.x
- go version 1.4+
- php5-dev installed (
apt-get install php5-dev) - for MacOS, go 1.8+
Build & Install
go get:
go get github.com/kitech/php-go
cd $GOPATH/src/github.com/kitech/php-go
# adjust PHPCFG path if needed
PHPCFG=`which php-config` make
manual:
mkdir -p $GOPATH/src/github.com/kitech
git clone https://github.com/kitech/php-go.git $GOPATH/src/github.com/kitech/php-go
cd $GOPATH/src/github.com/kitech/php-go
make
ls -lh php-go/hello.so
php56 -d extension=./hello.so examples/hello.php
Examples
// package main is required
package main
import "github.com/kitech/php-go/phpgo"
func foo_in_go() {
}
type Bar struct{}
func NewBar() *Bar{
return &Bar{}
}
func init() {
phpgo.InitExtension("mymod", "1.0")
phpgo.AddFunc("foo_in_php", foo_in_go)
phpgo.AddClass("bar_in_php", NewBar)
}
// should not run this function
// required for go build though.
func main() { panic("wtf") }
Limitations
- Deadlock in pcntl_fork'ed subprocess when call extension functions. #47
TODO
- install with go get
- improve php7 support
- namespace support
- multiple extension support
- class member access support
- unlimited function/method/class count support
- global ini var support
- fill phpinfo
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
관련 프로젝트 살펴보기
불러오는 중…