Super simple golang
code examples:
cli.go:
package main
import (
<html> | |
<body> | |
<div id="root"></div> | |
<script> | |
var host = 'ws://0.0.0.0:12345/websockets.php'; | |
var socket = new WebSocket(host); | |
socket.onmessage = function(e) { | |
document.getElementById('root').innerHTML = e.data; | |
}; | |
</script> |
<?php | |
$address = '0.0.0.0'; | |
$port = 12345; | |
// Create WebSocket. | |
$server = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); | |
socket_set_option($server, SOL_SOCKET, SO_REUSEADDR, 1); | |
socket_bind($server, $address, $port); | |
socket_listen($server); |
<?php | |
namespace Domain\Interfaces\VISA; | |
interface EuropeanUnion | |
{ | |
public function approve() : string; | |
} |
<?php | |
namespace VISA; | |
use Domain\Interfaces\VISA\EuropeanUnion as VISAInterface; | |
class EuropeanUnion implements VISAInterface | |
{ | |
public function approve(): string | |
{ |
<?php | |
namespace VISA; | |
use Domain\Interfaces\VISA\EuropeanUnion as VISAInterface; | |
class EuropeanUnion implements VISAInterface | |
{ | |
public function approve(): string | |
{ |
<?php | |
require_once __DIR__ . '/vendor/autoload.php'; | |
$eu = new VISA\EuropeanUnion(); | |
$result = $eu->approve(); | |
var_export($result); |
{ | |
"autoload": { | |
"psr-4": { | |
"Domain\\": "src/Domain", | |
"VISA\\": "src/Infrastructure/VISA/Review" | |
} | |
} | |
} |
{ | |
"autoload": { | |
"psr-4": { | |
"Domain\\": "src/Domain", | |
"VISA\\": "src/Infrastructure/VISA/Free" | |
} | |
} | |
} |
<?php | |
/** | |
* PHP benchmarking ElasticSearch vendors. | |
* | |
* README: | |
* | |
* This is a simple example which provides different options | |
* how to receive data from ElasticSearch into PHP. | |
* In this test, we have simple `type` inside ElasticSearch `index` which contains 1K records, | |
* @see https://github.com/cn007b/my/blob/master/ed/php/examples/elasticsearch/comparison/import.sh |