Skip to content

Commit 563e717

Browse files
committed
future(): ripplev2 & databse-connection-pool
1 parent 69a4586 commit 563e717

27 files changed

Lines changed: 531 additions & 422 deletions

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ laravel-ripple.iml
44
composer.lock
55
.php-cs-fixer.cache
66
/vendor/
7-

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<p align="center">
2-
<img src="https://raw.githubusercontent.com/cloudtay/ripple/refs/heads/main/assets/images/logo.png" width="420" alt="Logo">
3-
</p>
4-
<p align="center">
52
<a href="#"><img src="https://img.shields.io/badge/PHP-%3E%3D%208.3-blue" alt="Build Status"></a>
63
<a href="https://packagist.org/packages/cloudtay/ripple"><img src="https://img.shields.io/packagist/dt/cloudtay/ripple" alt="Download statistics"></a>
74
<a href="https://packagist.org/packages/cloudtay/ripple"><img src="https://img.shields.io/packagist/v/cloudtay/ripple" alt="Stable version"></a>

composer.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,14 @@
1919
"ext-posix": "*",
2020
"ext-sockets": "*",
2121
"ext-pdo": "*",
22-
"cloudtay/ripple": "^1.0",
23-
"cloudtay/ripple-http": "^1.0",
22+
"cloudtay/ripple": "^2.0",
2423
"laravel/framework": "^11.0|^12.0"
2524
},
2625
"require-dev": {
2726
"friendsofphp/php-cs-fixer": "*",
28-
"illuminate/http": "*",
29-
"illuminate/console": "*",
30-
"illuminate/container": "*",
31-
"illuminate/support": "*",
3227
"phpunit/phpunit": "*",
3328
"laravel/octane": "2.x-dev"
3429
},
35-
"suggest": {
36-
"cloudtay/ripple-websocket": "^1.0"
37-
},
3830
"minimum-stability": "dev",
3931
"prefer-stable": true,
4032
"extra": {

src/Built/Command.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
namespace Laravel\Ripple\Built;
1414

1515
use Laravel\Ripple\Inspector\Client;
16-
use Revolt\EventLoop\UnsupportedFeatureException;
17-
use Ripple\Utils\Output;
16+
use Ripple\Runtime\Support\Stdin;
1817
use Symfony\Component\Console\Input\InputInterface;
1918
use Symfony\Component\Console\Output\OutputInterface;
2019

@@ -26,7 +25,6 @@ class Command extends \Illuminate\Console\Command
2625
{
2726
/**
2827
* the name and signature of the console command.
29-
*
3028
* @var string
3129
*/
3230
protected $signature = 'ripple:server
@@ -41,9 +39,8 @@ class Command extends \Illuminate\Console\Command
4139
protected $description = 'start the ripple service';
4240

4341
/**
44-
* @param InputInterface $input
42+
* @param InputInterface $input
4543
* @param OutputInterface $output
46-
*
4744
* @return void
4845
*/
4946
public function initialize(InputInterface $input, OutputInterface $output): void
@@ -53,58 +50,55 @@ public function initialize(InputInterface $input, OutputInterface $output): void
5350

5451
/**
5552
* 运行服务
56-
*
5753
* @param Client $client
58-
*
5954
* @return void
60-
* @throws UnsupportedFeatureException
6155
*/
6256
public function handle(Client $client): void
6357
{
6458
switch ($this->argument('action')) {
6559
case 'start':
6660
if ($client->serverIsRunning()) {
67-
Output::warning('the server is already running');
61+
Stdin::println('the server is already running');
6862
return;
6963
}
7064
$client->start($this->option('daemon'));
71-
Output::writeln('server started');
65+
Stdin::println('server started');
7266
break;
7367

7468
case 'stop':
7569
if (!$client->serverIsRunning()) {
76-
Output::warning('the server is not running');
70+
Stdin::println('the server is not running');
7771
return;
7872
}
7973
$client->inspector->stopServer();
8074
break;
8175

8276
case 'reload':
8377
if (!$client->serverIsRunning()) {
84-
Output::warning('the server is not running');
78+
Stdin::println('the server is not running');
8579
return;
8680
}
8781
$client->inspector->reloadServer();
8882
break;
8983

9084
case 'restart':
9185
if (!$client->serverIsRunning()) {
92-
Output::warning('the server is not running');
86+
Stdin::println('the server is not running');
9387
return;
9488
}
9589
$client->inspector->restartServer();
9690
break;
9791

9892
case 'status':
9993
if (!$client->serverIsRunning()) {
100-
Output::writeln('the server is not running');
94+
Stdin::println('the server is not running');
10195
} else {
102-
Output::info('the server is running');
96+
Stdin::println('the server is running');
10397
}
10498
break;
10599

106100
default:
107-
Output::warning('Unsupported operation');
101+
Stdin::println('Unsupported operation');
108102
}
109103
}
110104
}

src/Built/Coroutine/ContainerMap.php

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/Built/Coroutine/ContextManager.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class ContextManager
2929

3030
/**
3131
* @param Container $application
32-
*
3332
* @return void
3433
*/
3534
public static function bind(Container $application): void
@@ -56,7 +55,6 @@ public static function unbind(): void
5655
/**
5756
* @param string|null $abstract
5857
* @param array $parameters
59-
*
6058
* @return mixed
6159
* @throws BindingResolutionException
6260
*/

src/Built/Events/RequestReceived.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Laravel\Ripple\Built\Listeners\FlushAuthenticationState;
2020
use Laravel\Ripple\Built\Listeners\FlushQueuedCookies;
2121
use Laravel\Ripple\Built\Listeners\FlushSessionState;
22-
use Ripple\Utils\Output;
22+
use Ripple\Runtime\Support\Stdin;
2323

2424
class RequestReceived
2525
{
@@ -40,7 +40,7 @@ public function __construct(public Application $app, public Application $sandbox
4040
try {
4141
$app->make($listener)->handle($this);
4242
} catch (BindingResolutionException $e) {
43-
Output::warning($e->getMessage());
43+
Stdin::println($e->getMessage());
4444
}
4545
}
4646

src/Built/Events/WorkerErrorOccurred.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class WorkerErrorOccurred
2121
/**
2222
* @param Application $app
2323
* @param Application $sandbox
24-
* @param Throwable $exception
24+
* @param Throwable $exception
2525
*/
2626
public function __construct(public Application $app, public Application $sandbox, public Throwable $exception)
2727
{

src/Built/Factory.php

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,11 @@
1212

1313
namespace Laravel\Ripple\Built;
1414

15-
use FilesystemIterator;
1615
use Illuminate\Foundation\Application;
1716
use Illuminate\Support\Facades\Config;
18-
use RecursiveDirectoryIterator;
19-
use RecursiveIteratorIterator;
20-
use Ripple\File\File;
21-
use Ripple\File\Monitor;
22-
use SplFileInfo;
17+
use Laravel\Ripple\Monitor;
2318

2419
use function is_dir;
25-
use function array_shift;
2620
use function is_file;
2721

2822
class Factory
@@ -104,38 +98,16 @@ public static function defaultServicesToWarm(): array
10498
*/
10599
public static function createMonitor(): Monitor
106100
{
107-
$monitor = File::getInstance()->monitor();
101+
$monitor = new Monitor();
108102
$watchPaths = Config::get('ripple.WATCH_PATHS', []);
109103

110-
$after = [];
111-
112104
foreach ($watchPaths as $path) {
113105
if (is_file($path)) {
114106
$monitor->add($path);
115107
}
116108

117109
if (is_dir($path)) {
118-
$iterator = new RecursiveIteratorIterator(
119-
new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS),
120-
RecursiveIteratorIterator::SELF_FIRST
121-
);
122-
123-
/*** @var SplFileInfo $file */
124-
foreach ($iterator as $file) {
125-
if ($file->isDir()) {
126-
$after[] = $file->getPathname();
127-
}
128-
129-
if ($file->isFile()) {
130-
$monitor->add($file->getPathname());
131-
}
132-
}
133-
134-
$after[] = $path;
135-
}
136-
137-
while ($path = array_shift($after)) {
138-
$monitor->add($path);
110+
$monitor->add($path, 'php');
139111
}
140112
}
141113

src/Built/Listeners/FlushAuthenticationState.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class FlushAuthenticationState
1818
{
1919
/**
2020
* Handle the event.
21-
*
2221
* @param mixed $event
2322
*/
2423
public function handle(mixed $event): void

0 commit comments

Comments
 (0)