-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.php
More file actions
44 lines (36 loc) · 1003 Bytes
/
server.php
File metadata and controls
44 lines (36 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env php
<?php
/**
* Blockchain Development Server
*
* Starts a local development server for blockchain platform
*/
// Get configuration
$config = [];
if (file_exists(__DIR__ . '/config/config.php')) {
$config = require __DIR__ . '/config/config.php';
}
$host = '127.0.0.1';
$port = 8080;
// Parse command line arguments
$args = getopt('h:p:', ['host:', 'port:']);
if (isset($args['h'])) {
$host = $args['h'];
} elseif (isset($args['host'])) {
$host = $args['host'];
}
if (isset($args['p'])) {
$port = (int)$args['p'];
} elseif (isset($args['port'])) {
$port = (int)$args['port'];
}
$networkName = $config['blockchain']['network_name'] ?? 'Modern Blockchain Platform';
echo "Starting $networkName development server...\n";
echo "Host: $host\n";
echo "Port: $port\n";
echo "Document root: " . __DIR__ . "\n";
echo "URL: http://$host:$port\n";
echo "Press Ctrl+C to stop\n\n";
// Start the server
$command = "php -S $host:$port -t " . __DIR__;
system($command);