Skip to content

Commit

Permalink
Replace http server with koriym/php-server
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed Jul 26, 2023
1 parent 8f43546 commit d62c50a
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 148 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"aura/sql": "^3 || ^4 || ^5",
"bear/app-meta": "^1.8",
"bear/resource": "^1.17",
"koriym/php-server": "^1.0",
"longxinh/xhprof": "^2.3",
"psr/log": "^1 || ^2 || ^3",
"ray/aop": "^2.13",
"ray/di": "^2.14",
"symfony/process": "^5.2.7",
"longxinh/xhprof": "^2.3"
"ray/di": "^2.14"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@

use RuntimeException;
use Symfony\Component\Process\Process;

use function error_log;
use function is_int;
use function register_shutdown_function;
use function sleep;
use function sprintf;
use function strpos;
use function version_compare;

use const PHP_BINARY;
use const PHP_VERSION;

/** @deprecated User koriym/php-server PhpServer instead */
final class BuiltinServer
{
/**
Expand Down
1 change: 0 additions & 1 deletion src-deprecated/Http/BuiltinServerStartTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use BEAR\Resource\ResourceInterface;
use Ray\Di\InjectorInterface;
use ReflectionClass;

use function dirname;
use function register_shutdown_function;

Expand Down
5 changes: 3 additions & 2 deletions src/Http/HttpResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use BEAR\Resource\ResourceInterface;
use BEAR\Resource\ResourceObject;
use BEAR\Resource\Uri as ResourceUri;
use Koriym\PhpServer\PhpServer;
use LogicException;

use function exec;
Expand All @@ -32,7 +33,7 @@ final class HttpResource implements ResourceInterface
/** @var string */
private $baseUri;

/** @var BuiltinServer */
/** @var PhpServer */
private static $server;

/** @var QueryMerger */
Expand Down Expand Up @@ -62,7 +63,7 @@ private function startServer(string $host, string $index): void
return;
}

self::$server = new BuiltinServer($host, $index);
self::$server = new PhpServer($host, $index);
self::$server->start();
$started[] = $id;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Fake/app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"ray/di": "^2.11"
},
"require-dev": {
"bear/devtools": "^0.1",
"bamarni/composer-bin-plugin": "^1.4",
"bear/devtools": "^0.1",
"koriym/php-server": "^1.0",
"phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-master"
},
Expand Down
48 changes: 47 additions & 1 deletion tests/Fake/app/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/Fake/app/public-twig/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

require dirname(__DIR__) . '/vendor/autoload.php';
require dirname(__DIR__, 4) . '/vendor/autoload.php';
exit((new Bootstrap())(PHP_SAPI === 'cli-server' ? 'dev-html-app' : 'dev-prod-twig-app', $GLOBALS, $_SERVER));
exit((new Bootstrap())(PHP_SAPI === 'cli-server' ? 'dev-twig-app' : 'dev-prod-twig-app', $GLOBALS, $_SERVER));
1 change: 1 addition & 0 deletions tests/Fake/app/src/Resource/Page/Halo.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use BEAR\Resource\Annotation\Embed;
use BEAR\Resource\ResourceObject;

class Halo extends ResourceObject
{
public $body = [
Expand Down
Loading

0 comments on commit d62c50a

Please sign in to comment.