Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/boost/docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The Hypervel framework has a few system requirements. Hypervel ships with its ow

If you are deploying your application to a server that is running Nginx, you may use the following configuration file as a starting point for configuring your web server. Most likely, this file will need to be customized depending on your server's configuration. **If you would like assistance in managing your server, consider using a fully-managed Hypervel platform like [SonicStack](https://sonicstack.io).**

Please ensure, like the configuration below, your web server proxies dynamic requests to your Hypervel server. The default Hypervel HTTP server listens on port `9501` and may be configured in your application's `config/server.php` file:
Please ensure, like the configuration below, your web server proxies dynamic requests to your Hypervel server. The default Hypervel HTTP server listens on port `8000` and may be configured in your application's `config/server.php` file:

```nginx
server {
Expand All @@ -80,7 +80,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_pass http://127.0.0.1:9501;
proxy_pass http://127.0.0.1:8000;
}

location ~ /\.(?!well-known).* {
Expand Down Expand Up @@ -126,7 +126,7 @@ In production, your Hypervel server should be kept running by a process monitor,
php artisan serve
```

By default, the HTTP server binds to `0.0.0.0:9501` with HTTP/2 enabled. You may configure the server host, port, worker count, max requests per worker, HTTP/2 support, and other Swoole settings using the `HTTP_SERVER_HOST`, `HTTP_SERVER_PORT`, `SERVER_WORKERS`, `SERVER_MAX_REQUESTS`, and `SERVER_HTTP2` environment variables read by `config/server.php`.
By default, the HTTP server binds to `0.0.0.0:8000` with HTTP/2 enabled. You may configure the server host, port, worker count, max requests per worker, HTTP/2 support, and other Swoole settings using the `SERVER_HOST`, `SERVER_PORT`, `SERVER_WORKERS`, `SERVER_MAX_REQUESTS`, and `SERVER_HTTP2` environment variables read by `config/server.php`.

The `serve` command also accepts `--host` and `--port` options for overriding the HTTP server address for the current process. In production, prefer durable configuration in `config/server.php` and your environment.

Expand Down
4 changes: 2 additions & 2 deletions src/boost/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ cd example-app
php artisan serve
```

Once you have started the development server, your application will be accessible in your web browser at [http://localhost:9501](http://localhost:9501). The server host, port, worker count, and other Swoole options may be configured in your application's `config/server.php` file.
Once you have started the development server, your application will be accessible in your web browser at [http://localhost:8000](http://localhost:8000). The server host, port, worker count, and other Swoole options may be configured in your application's `config/server.php` file.

You may temporarily override the HTTP server address for the current process using the `--host` and `--port` options:

```shell
php artisan serve --host=127.0.0.1 --port=9502
php artisan serve --host=127.0.0.1 --port=8001
```

<a name="watching-for-changes"></a>
Expand Down
4 changes: 2 additions & 2 deletions src/boost/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Transfer/sec: 1.69MB
Hypervel:

```text
Running 10s test @ http://127.0.0.1:9501/api
Running 10s test @ http://127.0.0.1:8000/api
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 7.66ms 17.85ms 249.92ms 90.25%
Expand Down Expand Up @@ -132,7 +132,7 @@ Transfer/sec: 1.66KB
Hypervel:

```text
Running 10s test @ http://10.10.4.12:9501/api
Running 10s test @ http://10.10.4.12:8000/api
16 threads and 15000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.02s 64.72ms 1.87s 93.62%
Expand Down
2 changes: 1 addition & 1 deletion src/boost/docs/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The entry point for a Hypervel application is the `artisan` executable. This fil

The `bootstrap/app.php` file creates and configures the application using `Hypervel\Foundation\Application`. This is where routing, middleware, exception handling, service providers, and console command paths are configured before the application instance is returned.

When you run `php artisan serve`, the console kernel resolves the `serve` command, which starts the configured Swoole server. By default, the HTTP server is configured in your application's `config/server.php` file and listens on port `9501`. Any `serve` command host or port options are applied before Swoole workers start.
When you run `php artisan serve`, the console kernel resolves the `serve` command, which starts the configured Swoole server. By default, the HTTP server is configured in your application's `config/server.php` file and listens on port `8000`. Any `serve` command host or port options are applied before Swoole workers start.

<a name="bootstrapping-the-application"></a>
### Bootstrapping the Application
Expand Down
2 changes: 1 addition & 1 deletion src/boost/docs/starter-kits.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ You may then start the Hypervel development server and frontend asset watcher us
composer dev
```

Once you have started the Hypervel development server, your application will be accessible in your web browser at [http://localhost:9501](http://localhost:9501).
Once you have started the Hypervel development server, your application will be accessible in your web browser at [http://localhost:8000](http://localhost:8000).

<a name="react"></a>
## React
Expand Down
2 changes: 1 addition & 1 deletion src/boost/docs/testbench.md
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ The `serve` command uses Hypervel's normal server configuration and starts the s
You may pass `--host` and `--port` to temporarily override the configured HTTP server address for the current process:

```shell
vendor/bin/testbench serve --host=127.0.0.1 --port=9502
vendor/bin/testbench serve --host=127.0.0.1 --port=8001
```

> [!NOTE]
Expand Down
4 changes: 2 additions & 2 deletions src/foundation/config/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
[
'name' => 'http',
'type' => Server::SERVER_HTTP,
'host' => env('HTTP_SERVER_HOST', '0.0.0.0'),
'port' => (int) env('HTTP_SERVER_PORT', 9501),
'host' => env('SERVER_HOST', '0.0.0.0'),
'port' => (int) env('SERVER_PORT', 8000),
'sock_type' => SWOOLE_SOCK_TCP,
'callbacks' => [
Event::ON_REQUEST => [Hypervel\HttpServer\Server::class, 'onRequest'],
Expand Down
2 changes: 1 addition & 1 deletion src/server/src/Port.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Port

protected string $host = '0.0.0.0';

protected int $port = 9501;
protected int $port = 8000;

protected int $sockType = 0;

Expand Down
2 changes: 1 addition & 1 deletion tests/Engine/SocketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testSocketConnectFailed()
}

try {
(new Socket\SocketFactory)->make(new Socket\SocketOption('192.0.0.1', 9501, 0.2));
(new Socket\SocketFactory)->make(new Socket\SocketOption('192.0.0.1', 8000, 0.2));
} catch (SocketConnectException $exception) {
$this->assertSame(SOCKET_ETIMEDOUT, $exception->getCode());
$this->assertStringContainsString('timed out', $exception->getMessage());
Expand Down
8 changes: 4 additions & 4 deletions tests/Integration/Routing/RoutePortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testPortScopedRouteRejectsWrongPort()
{
Route::port(8080)->get('/foo', fn () => 'port 8080');

$response = $this->call('GET', 'http://localhost:9501/foo');
$response = $this->call('GET', 'http://localhost:8000/foo');

$response->assertNotFound();
}
Expand All @@ -32,7 +32,7 @@ public function testUnscopedRouteMatchesAnyPort()
Route::get('/foo', fn () => 'any port');

$this->call('GET', 'http://localhost:8080/foo')->assertOk();
$this->call('GET', 'http://localhost:9501/foo')->assertOk();
$this->call('GET', 'http://localhost:8000/foo')->assertOk();
}

public function testPortGroupScopesAllChildRoutes()
Expand All @@ -45,7 +45,7 @@ public function testPortGroupScopesAllChildRoutes()
$this->call('GET', 'http://localhost:8080/foo')->assertOk();
$this->call('GET', 'http://localhost:8080/bar')->assertOk();

$this->call('GET', 'http://localhost:9501/foo')->assertNotFound();
$this->call('GET', 'http://localhost:9501/bar')->assertNotFound();
$this->call('GET', 'http://localhost:8000/foo')->assertNotFound();
$this->call('GET', 'http://localhost:8000/bar')->assertNotFound();
}
}
42 changes: 21 additions & 21 deletions tests/Routing/RoutePortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ public function testInnerPortOverridesOuterGroup()
$router->port(8080)->group(function ($router) {
$router->get('/foo', fn () => 'outer');

$router->port(9501)->group(function ($router) {
$router->port(8000)->group(function ($router) {
$router->get('/bar', fn () => 'inner');
});
});

$routes = $router->getRoutes()->getRoutes();

$this->assertSame(8080, $routes[0]->getPort());
$this->assertSame(9501, $routes[1]->getPort());
$this->assertSame(8000, $routes[1]->getPort());
}

public function testPortGroupMergeInnerOverridesOuter()
{
$old = ['port' => 8080];
$result = RouteGroup::merge(['port' => 9501], $old);
$result = RouteGroup::merge(['port' => 8000], $old);

$this->assertSame(9501, $result['port']);
$this->assertSame(8000, $result['port']);
}

public function testPortGroupMergeInheritsFromOuter()
Expand All @@ -106,7 +106,7 @@ public function testRouteWithoutPortMatchesAnyPort()
$response = $router->dispatch(Request::create('http://localhost:8080/foo', 'GET'));
$this->assertSame('ok', $response->getContent());

$response = $router->dispatch(Request::create('http://localhost:9501/foo', 'GET'));
$response = $router->dispatch(Request::create('http://localhost:8000/foo', 'GET'));
$this->assertSame('ok', $response->getContent());
}

Expand All @@ -126,7 +126,7 @@ public function testRouteWithPortRejectsWrongPort()

$this->expectException(NotFoundHttpException::class);

$router->dispatch(Request::create('http://localhost:9501/foo', 'GET'));
$router->dispatch(Request::create('http://localhost:8000/foo', 'GET'));
}

public function testSamePathDifferentPortThrowsLogicException()
Expand All @@ -137,7 +137,7 @@ public function testSamePathDifferentPortThrowsLogicException()
$this->expectException(LogicException::class);
$this->expectExceptionMessage('Cannot register [GET foo] for multiple ports');

$collection->add((new Route('GET', '/foo', fn () => 'b'))->port(9501));
$collection->add((new Route('GET', '/foo', fn () => 'b'))->port(8000));
}

public function testSamePathNullVsPortThrowsLogicException()
Expand Down Expand Up @@ -213,7 +213,7 @@ public function testCompiledRouteCollectionRespectsPort()

// Wrong port — 404
$this->expectException(NotFoundHttpException::class);
$compiledCollection->match(Request::create('http://localhost:9501/foo', 'GET'));
$compiledCollection->match(Request::create('http://localhost:8000/foo', 'GET'));
}

public function testRouteUrlGenerationUsesRoutePort()
Expand All @@ -222,10 +222,10 @@ public function testRouteUrlGenerationUsesRoutePort()
$route = (new Route(['GET'], 'foo', ['as' => 'portRoute']))->port(8080);
$routes->add($route);

// Current request is on port 9501
$url = new UrlGenerator($routes, Request::create('http://localhost:9501/'));
// Current request is on port 8000
$url = new UrlGenerator($routes, Request::create('http://localhost:8000/'));

// Absolute URL should use route's port (8080), not request's port (9501)
// Absolute URL should use route's port (8080), not request's port (8000)
$this->assertSame('http://localhost:8080/foo', $url->route('portRoute'));
}

Expand All @@ -235,7 +235,7 @@ public function testRouteUrlGenerationOmitsDefaultPort()
$route = (new Route(['GET'], 'foo', ['as' => 'portRoute']))->port(80);
$routes->add($route);

$url = new UrlGenerator($routes, Request::create('http://localhost:9501/'));
$url = new UrlGenerator($routes, Request::create('http://localhost:8000/'));

// Port 80 on HTTP should be omitted
$this->assertSame('http://localhost/foo', $url->route('portRoute'));
Expand All @@ -248,7 +248,7 @@ public function testRouteUrlGenerationWithHttpsAndPort443()
$route->port(443);
$routes->add($route);

$url = new UrlGenerator($routes, Request::create('http://localhost:9501/'));
$url = new UrlGenerator($routes, Request::create('http://localhost:8000/'));

// Port 443 on HTTPS should be omitted
$this->assertSame('https://localhost/foo', $url->route('secureRoute'));
Expand All @@ -260,11 +260,11 @@ public function testRouteUrlGenerationWithoutPortUsesRequestPort()
$route = new Route(['GET'], 'foo', ['as' => 'noPort']);
$routes->add($route);

// Current request is on port 9501
$url = new UrlGenerator($routes, Request::create('http://localhost:9501/'));
// Current request is on port 8000
$url = new UrlGenerator($routes, Request::create('http://localhost:8000/'));

// No port on route — should use request port
$this->assertSame('http://localhost:9501/foo', $url->route('noPort'));
$this->assertSame('http://localhost:8000/foo', $url->route('noPort'));
}

public function testRelativeUrlIgnoresPort()
Expand All @@ -273,7 +273,7 @@ public function testRelativeUrlIgnoresPort()
$route = (new Route(['GET'], 'foo', ['as' => 'portRoute']))->port(8080);
$routes->add($route);

$url = new UrlGenerator($routes, Request::create('http://localhost:9501/'));
$url = new UrlGenerator($routes, Request::create('http://localhost:8000/'));

// Relative URL has no host/port
$this->assertSame('/foo', $url->route('portRoute', [], false));
Expand All @@ -286,7 +286,7 @@ public function testRouteUrlGenerationPreservesForcedRootPath()
$routes->add($route);

// Forced root with a path component (e.g., reverse proxy path prefix)
$url = new UrlGenerator($routes, Request::create('http://localhost:9501/'));
$url = new UrlGenerator($routes, Request::create('http://localhost:8000/'));
$url->useOrigin('http://www.foo.com/subfolder');

$this->assertSame('http://www.foo.com:8080/subfolder/foo', $url->route('portRoute'));
Expand All @@ -298,14 +298,14 @@ public function testSignedRouteUsesRoutePort()
$route = (new Route(['GET'], 'foo', ['as' => 'portRoute']))->port(8080);
$routes->add($route);

$url = new UrlGenerator($routes, Request::create('http://localhost:9501/'));
$url = new UrlGenerator($routes, Request::create('http://localhost:8000/'));
$url->setKeyResolver(fn () => 'test-signing-key');

$signed = $url->signedRoute('portRoute');

// Signed URL should use route port, not request port
$this->assertStringContainsString('localhost:8080', $signed);
$this->assertStringNotContainsString('9501', $signed);
$this->assertStringNotContainsString('8000', $signed);

// Signature should be valid when verified against the correct URL
$this->assertTrue($url->hasValidSignature(
Expand All @@ -331,7 +331,7 @@ public function testCompiledRouteDynamicAddWithDifferentPortThrows()
$this->expectException(LogicException::class);
$this->expectExceptionMessage('Cannot register [GET foo] for multiple ports');

$compiledCollection->add((new Route('GET', 'foo', ['uses' => fn () => 'other', 'as' => 'foo2']))->port(9501));
$compiledCollection->add((new Route('GET', 'foo', ['uses' => fn () => 'other', 'as' => 'foo2']))->port(8000));
}

public function testCompiledRouteDynamicAddWithSamePortAllowed()
Expand Down
10 changes: 5 additions & 5 deletions tests/Server/ServerStartCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testServeCommandStartsServerWhenRunningInConsoleIsFalse(): void
'name' => 'http',
'type' => ServerInterface::SERVER_HTTP,
'host' => '0.0.0.0',
'port' => 9501,
'port' => 8000,
],
],
];
Expand Down Expand Up @@ -103,7 +103,7 @@ public function testServeCommandOverridesHttpServerHostAndPort(): void
'name' => 'http',
'type' => ServerInterface::SERVER_HTTP,
'host' => '0.0.0.0',
'port' => 9501,
'port' => 8000,
],
],
];
Expand All @@ -119,7 +119,7 @@ public function testServeCommandOverridesHttpServerHostAndPort(): void
'name' => 'http',
'type' => ServerInterface::SERVER_HTTP,
'host' => '127.0.0.1',
'port' => 9502,
'port' => 8001,
],
];

Expand Down Expand Up @@ -147,7 +147,7 @@ public function testServeCommandOverridesHttpServerHostAndPort(): void

$result = $command->run(new ArrayInput([
'--host' => '127.0.0.1',
'--port' => '9502',
'--port' => '8001',
]), new NullOutput);

$this->assertSame(0, $result);
Expand All @@ -167,7 +167,7 @@ public function testServeCommandRejectsInvalidPortOption(string $port): void
'name' => 'http',
'type' => ServerInterface::SERVER_HTTP,
'host' => '0.0.0.0',
'port' => 9501,
'port' => 8000,
],
],
]);
Expand Down
4 changes: 2 additions & 2 deletions tests/Testbench/Foundation/Console/ServeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public function itStartsTheUnderlyingServerCommandAndDispatchesLifecycleEvents()
$serverFactory = m::mock(ServerFactory::class);
$serverFactory->shouldReceive('setEventDispatcher')->once()->andReturnSelf();
$serverFactory->shouldReceive('setLogger')->once()->andReturnSelf();
$serverFactory->shouldReceive('configure')->once()->with(['http' => ['port' => 9501]]);
$serverFactory->shouldReceive('configure')->once()->with(['http' => ['port' => 8000]]);
$serverFactory->shouldReceive('start')->once();

$config = m::mock(Repository::class);
$config->shouldReceive('array')->once()->with('server', [])->andReturn(['http' => ['port' => 9501]]);
$config->shouldReceive('array')->once()->with('server', [])->andReturn(['http' => ['port' => 8000]]);

$logger = m::mock(StdoutLoggerInterface::class);

Expand Down