Skip to content

Commit 6849b60

Browse files
committed
Merge branch 'master' into dev
2 parents c4af4f4 + eef4f3e commit 6849b60

38 files changed

Lines changed: 1813 additions & 1534 deletions

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
.vscode
1+
.vscode
2+
vendor/
3+
.idea/
4+
composer.lock
5+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use CodeIgniter\CodingStandard\CodeIgniter4;
4+
use Nexus\CsConfig\Factory;
5+
use PhpCsFixer\Finder;
6+
7+
$finder = Finder::create()
8+
->files()
9+
->in([
10+
__DIR__ . '/src/',
11+
// __DIR__ . '/tests/',
12+
__DIR__ . '/dev/app/',
13+
__DIR__ . '/dev/tests/',
14+
])
15+
->exclude('build')
16+
->append([__FILE__]);
17+
18+
$overrides = [];
19+
20+
$options = [
21+
'finder' => $finder,
22+
'cacheFile' => 'build/.php-cs-fixer.cache',
23+
];
24+
25+
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Codeigniter4-RoadRunner provides the synchroniztion of the Request and Response
1313
## Install
1414

1515
### Prerequisites
16-
1. CodeIgniter Framework 4.1.1^
16+
1. CodeIgniter Framework 4.1.9^
1717
2. Composer
1818
3. Enable `php-curl` extension
1919
4. Enable `php-zip` extension
@@ -44,6 +44,8 @@ Run the command in the root directory of your project:
4444
## Server Settings
4545
The server settings are all in the project root directory ".rr.yaml". The default file will look like this:
4646
```yaml
47+
version: "2.7"
48+
4749
rpc:
4850
listen: tcp://127.0.0.1:6001
4951

@@ -121,8 +123,8 @@ class Home extends BaseController
121123
122124
public function index()
123125
{
124-
//Don't use :
125-
//echo view('welcome_message');
126+
// Don't use:
127+
// echo view('welcome_message');
126128
return view('welcome_message');
127129
}
128130

build/.gitkeep

Whitespace-only changes.

composer.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
"homepage": "https://github.com/SDPM-lab"
1919
}
2020
],
21-
"minimum-stability": "stable",
21+
"minimum-stability": "dev",
22+
"prefer-stable": true,
2223
"require": {
23-
"php" : "^7.3",
24-
"codeigniter4/framework": "^4.1.5",
24+
"php" : "^7.4 || ^8.0",
25+
"codeigniter4/framework": "^4.1.9",
2526
"spiral/roadrunner": "^2",
2627
"spiral/dumper": "^2.8",
2728
"laminas/laminas-diactoros": "^2.8",
@@ -31,5 +32,14 @@
3132
"psr-4": {
3233
"SDPMlab\\Ci4Roadrunner\\": "src/"
3334
}
34-
}
35-
}
35+
},
36+
"require-dev": {
37+
"codeigniter4/devkit": "^1.0",
38+
"rector/rector": "0.12.16"
39+
},
40+
"config": {
41+
"allow-plugins": {
42+
"phpstan/extension-installer": true
43+
}
44+
}
45+
}

dev/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ nb-configuration.xml
125125
/phpunit*.xml
126126
/.phpunit.*.cache
127127

128+
rr
128129
rr.exe
129130
.rr.yaml
130-
psr-worker.php
131+
psr-worker.php

dev/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
This is the Codeigniter4-RoadRunner test case project, it is built by Codeigniter4, and has loaded the Codeigniter4-Roadrunner library class inside the upper directory included in the `src` in.
44

5-
You can run the test right after you modified the Codeigniter4-Roadrunner project files, verify if the funtions are complete; Or wirte some related program logic in this project to assist your development.
5+
You can run the test right after you modified the Codeigniter4-Roadrunner project files, verify if the functions are complete; Or write some related program logic in this project to assist your development.
66

77
## Test Range
88

9-
This test case takes the acutal sent CURL Request as test approach, because what Codeigniter4-Roadrunner provide is the synchronization on HTTP Request and Response objects of Roadrunner-Worker and Codeigniter4 (Since Codeigniter4 doesn't implement PSR-7 interface standard). In other words, we just have to verify if the server workes as what we wanted under the actual HTTP connection.
9+
This test case takes the actual sent CURL Request as test approach, because what Codeigniter4-Roadrunner provide is the synchronization on HTTP Request and Response objects of Roadrunner-Worker and Codeigniter4 (Since Codeigniter4 doesn't implement PSR-7 interface standard). In other words, we just have to verify if the server workes as what we wanted under the actual HTTP connection.
1010

1111
1. BasicTest:Test HTTP `GET``POST``query``form-data`, and the `php echo` output command, and if `header` can process normally and give us outputs.
1212
2. FileUploadTest:Test if file upload class can work correctly and move files.
@@ -15,23 +15,23 @@ This test case takes the acutal sent CURL Request as test approach, because what
1515

1616
## Requirements
1717

18-
We recommend you to use the latest PHPUnit. While we're writing scripts, the version we're running at is version `9.5.10`. You might need to use Composer to download the library your project needed back to your develop environment.
18+
We recommend you to use the latest PHPUnit. While we're writing scripts, the version we're running at is version `9.5.19`. You might need to use Composer to download the library your project needed back to your develop environment.
1919

2020
```
2121
composer install
2222
```
2323

24-
Next, you must initiallize the environment that Roadrunner needed.
24+
Next, you must initialize the environment that Roadrunner needed.
2525

2626
```
2727
php spark ciroad:init
2828
```
2929

30-
Finally, please confirm if the directory has these threee files including `rr`(if your developing under Windows, you will see `rr.exe`), `rr.yaml`, `psr-worker.php`.
30+
Finally, please confirm if the directory has these three files including `rr` (if you are developing under Windows, you will see `rr.exe`), `.rr.yaml`, `psr-worker.php`.
3131

3232
## Run Tests
3333

34-
Before running tests, please open `rr.yaml` file first, and ensure this configuration file has these settings:
34+
Before running tests, please open `.rr.yaml` file first, and ensure this configuration file has these settings:
3535

3636
```yaml
3737
rpc:
@@ -49,12 +49,12 @@ http:
4949
num_workers: 1
5050
```
5151
52-
Since Roadrunner-Worker lasts inside RAMs, HTTP requests will reuse Workers to process. Hence we need to test the stability under the environment with only one worker to prove that it can work properly under several workers.
52+
Since Roadrunner-Worker lasts inside RAMs, HTTP requests will reuse Workers to process. Hence, we need to test the stability under the environment with only one worker to prove that it can work properly under several workers.
5353
5454
Next, you have to open a terminal and cd to the root directory, type the commands below to run the Roadrunner server:
5555
5656
```
57-
rr serve -d
57+
./rr serve -d
5858
```
5959

6060
Finally, open another new terminal and cd to the test project, type the commands below to run tests:
@@ -67,4 +67,4 @@ If you're running tests under Windows CMD, your command should be like this:
6767

6868
```
6969
vendor\bin\phpunit
70-
```
70+
```

dev/app/Config/Autoload.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class Autoload extends AutoloadConfig
4141
* @var array<string, string>
4242
*/
4343
public $psr4 = [
44-
APP_NAMESPACE => APPPATH, // For custom app namespace
45-
'Config' => APPPATH . 'Config',
46-
"SDPMlab\\Ci4Roadrunner\\" => ROOTPATH . ".." . DIRECTORY_SEPARATOR . "src" . DIRECTORY_SEPARATOR,
44+
APP_NAMESPACE => APPPATH, // For custom app namespace
45+
'Config' => APPPATH . 'Config',
46+
'SDPMlab\\Ci4Roadrunner\\' => ROOTPATH . '..' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR,
4747
];
4848

4949
/**

dev/app/Config/Events.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
ob_end_flush();
3333
}
3434

35-
ob_start(static function ($buffer) {
36-
return $buffer;
37-
});
35+
ob_start(static fn ($buffer) => $buffer);
3836
}
3937

4038
/*

dev/app/Config/Routes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
// route since we don't have to scan directories.
3434
$routes->get('/', 'Home::index');
3535

36-
$routes->resource('testRest',[
37-
'controller' =>'\App\Controllers\TestRest',
36+
$routes->resource('testRest', [
37+
'controller' => '\App\Controllers\TestRest',
3838
]);
3939

4040
/*

0 commit comments

Comments
 (0)