https://github.com/xtlsoft/gofeature
Enabling Golang Features in PHP.
https://github.com/xtlsoft/gofeature
Last synced: 10 months ago
JSON representation
Enabling Golang Features in PHP.
- Host: GitHub
- URL: https://github.com/xtlsoft/gofeature
- Owner: xtlsoft
- License: mit
- Created: 2018-01-07T00:43:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-06T00:22:47.000Z (about 8 years ago)
- Last Synced: 2025-07-18T03:44:15.418Z (12 months ago)
- Language: PHP
- Size: 12.7 KB
- Stars: 12
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GoFeature
Enabling Golang Features in PHP.
## Installation
```bash
composer require xtlsoft/gofeature
```
## Demos
Defer:
```php
push(function(){
echo 'FromAnother1';
})->push(function(){
echo 'FromAnother2'
});
echo '3'
```
Result:
```text
3FromAnother2FromAnother121
```
Go:
```php
$th = go(function($ctx){
while(1){
echo $this->recv();
}
});
$th->send("First test.\r\n");
sleep(2);
$th->send("Twice test.");