Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit bc95b4f

Browse files
committed
bin
1 parent 9101867 commit bc95b4f

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "mpyw/HyperBuiltinServer",
2+
"name": "mpyw/php-hyper-builtin-server",
33
"description": "Reverse proxy for PHP built-in server which supports multiprocessing and TLS/SSL encryption",
44
"type": "project",
55
"license": "MIT",
@@ -38,5 +38,6 @@
3838
".*",
3939
"!/src/*"
4040
]
41-
}
41+
},
42+
"bin": ["hyper-run"]
4243
}

hyper-run

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
declare(ticks=1);
5+
set_time_limit(0);
6+
7+
if (PHP_SAPI !== 'cli') {
8+
header('Content-Type: text/plain; charset=UTF-8', true, 400);
9+
exit("This script only works on php-cli.\n");
10+
}
11+
if (DIRECTORY_SEPARATOR !== '/') {
12+
fwrite(STDERR, "Windows is not supported.\n");
13+
exit(1);
14+
}
15+
if (!isset($_SERVER['argv'][1])) {
16+
fwrite(STDERR, "Usage: {$_SERVER['argv'][0]} <DocumentRoot>\n");
17+
exit(1);
18+
}
19+
$dir = $_SERVER['argv'][1];
20+
if (!is_dir($dir)) {
21+
fwrite(STDERR, "No such directory: $dir\n");
22+
exit(1);
23+
}
24+
25+
require __DIR__ . '/autoload.php';
26+
$ps = new mpyw\HyperBuiltinServer\MasterProcess($dir);
27+
$ps->listen();

0 commit comments

Comments
 (0)