This commit is contained in:
Your Name 2025-11-14 16:05:17 +08:00
parent be05b7f663
commit 7de67356f0
150 changed files with 6184 additions and 14 deletions

View File

@ -32,7 +32,8 @@
"ext-pdo": "*",
"ext-bcmath": "*",
"phpseclib/phpseclib": "*",
"workerman/phpsocket.io": "^2.2"
"workerman/phpsocket.io": "^2.2",
"hyperf/pimple": "^2.2"
},
"config": {
"preferred-install": "dist",

View File

@ -32,7 +32,7 @@ private static $installed = array (
'aliases' =>
array (
),
'reference' => '0a95974a63e41cca15747597241a53381c61f1df',
'reference' => 'be05b7f6639c030982107e2c8b858af2b106b2b6',
'name' => 'fastadminnet/fastadmin',
),
'versions' =>
@ -71,7 +71,7 @@ private static $installed = array (
'aliases' =>
array (
),
'reference' => '0a95974a63e41cca15747597241a53381c61f1df',
'reference' => 'be05b7f6639c030982107e2c8b858af2b106b2b6',
),
'fastadminnet/fastadmin-addons' =>
array (
@ -118,6 +118,51 @@ private static $installed = array (
),
'reference' => '21dc724a0583619cd1652f673303492272778051',
),
'hyperf/context' =>
array (
'pretty_version' => 'v3.0.37',
'version' => '3.0.37.0',
'aliases' =>
array (
),
'reference' => '264e06fb882426d90758eca2c5bb8293f8b60455',
),
'hyperf/contract' =>
array (
'pretty_version' => 'v3.0.37',
'version' => '3.0.37.0',
'aliases' =>
array (
),
'reference' => '2e8290104468a8d90855067d8644a32114474452',
),
'hyperf/engine' =>
array (
'pretty_version' => 'v2.14.1',
'version' => '2.14.1.0',
'aliases' =>
array (
),
'reference' => '6595d2659ce7ebb940b8740a00ecd199128398f0',
),
'hyperf/engine-contract' =>
array (
'pretty_version' => 'v1.13.0',
'version' => '1.13.0.0',
'aliases' =>
array (
),
'reference' => '26a18ec0375147546bf9702b0fd737fdd2cec1d6',
),
'hyperf/pimple' =>
array (
'pretty_version' => 'v2.2.2',
'version' => '2.2.2.0',
'aliases' =>
array (
),
'reference' => '7bd07745c256b83679471c06ec2a11e901d37277',
),
'maennchen/zipstream-php' =>
array (
'pretty_version' => '2.4.0',

View File

@ -12,15 +12,16 @@ return array(
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'9c7a683baffd24f5595c1dc5f5273030' => $vendorDir . '/hyperf/engine/src/Functions.php',
'6b998e7ad3182c0d21d23780badfa07b' => $vendorDir . '/yansongda/supports/src/Functions.php',
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php',
'988d02680beedec88d52f2787b2d2007' => $vendorDir . '/yansongda/artful/src/Functions.php',
'f7e3d8cd19cf23ce3883a6a51d791b77' => $vendorDir . '/fastadminnet/fastadmin-addons/src/common.php',
'f0e7e63bbb278a92db02393536748c5f' => $vendorDir . '/overtrue/wechat/src/Kernel/Support/Helpers.php',
'6747f579ad6817f318cc3a7e7a0abb93' => $vendorDir . '/overtrue/wechat/src/Kernel/Helpers.php',
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php',
'cc56288302d9df745d97c934d6a6e5f0' => $vendorDir . '/topthink/think-queue/src/common.php',
'f7e3d8cd19cf23ce3883a6a51d791b77' => $vendorDir . '/fastadminnet/fastadmin-addons/src/common.php',
'8c783b3a3de2f6d9177022b5ccdcc841' => $vendorDir . '/yansongda/pay/src/Functions.php',
);

View File

@ -9,7 +9,7 @@ return array(
'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'),
'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'),
'think\\' => array($baseDir . '/thinkphp/library/think', $vendorDir . '/topthink/think-queue/src', $vendorDir . '/fastadminnet/fastadmin-addons/src'),
'think\\' => array($vendorDir . '/fastadminnet/fastadmin-addons/src', $baseDir . '/thinkphp/library/think', $vendorDir . '/topthink/think-queue/src'),
'phpseclib3\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
'addons\\' => array($baseDir . '/addons'),
'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
@ -32,7 +32,7 @@ return array(
'Symfony\\Bridge\\PsrHttpMessage\\' => array($vendorDir . '/symfony/psr-http-message-bridge'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
@ -46,6 +46,11 @@ return array(
'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'),
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'),
'Hyperf\\Pimple\\' => array($vendorDir . '/hyperf/pimple/src'),
'Hyperf\\Engine\\Contract\\' => array($vendorDir . '/hyperf/engine-contract/src'),
'Hyperf\\Engine\\' => array($vendorDir . '/hyperf/engine/src'),
'Hyperf\\Contract\\' => array($vendorDir . '/hyperf/contract/src'),
'Hyperf\\Context\\' => array($vendorDir . '/hyperf/context/src'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),

View File

@ -13,16 +13,17 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'9c7a683baffd24f5595c1dc5f5273030' => __DIR__ . '/..' . '/hyperf/engine/src/Functions.php',
'6b998e7ad3182c0d21d23780badfa07b' => __DIR__ . '/..' . '/yansongda/supports/src/Functions.php',
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php',
'988d02680beedec88d52f2787b2d2007' => __DIR__ . '/..' . '/yansongda/artful/src/Functions.php',
'f7e3d8cd19cf23ce3883a6a51d791b77' => __DIR__ . '/..' . '/fastadminnet/fastadmin-addons/src/common.php',
'f0e7e63bbb278a92db02393536748c5f' => __DIR__ . '/..' . '/overtrue/wechat/src/Kernel/Support/Helpers.php',
'6747f579ad6817f318cc3a7e7a0abb93' => __DIR__ . '/..' . '/overtrue/wechat/src/Kernel/Helpers.php',
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php',
'cc56288302d9df745d97c934d6a6e5f0' => __DIR__ . '/..' . '/topthink/think-queue/src/common.php',
'f7e3d8cd19cf23ce3883a6a51d791b77' => __DIR__ . '/..' . '/fastadminnet/fastadmin-addons/src/common.php',
'8c783b3a3de2f6d9177022b5ccdcc841' => __DIR__ . '/..' . '/yansongda/pay/src/Functions.php',
);
@ -100,6 +101,14 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1
'Monolog\\' => 8,
'Matrix\\' => 7,
),
'H' =>
array (
'Hyperf\\Pimple\\' => 14,
'Hyperf\\Engine\\Contract\\' => 23,
'Hyperf\\Engine\\' => 14,
'Hyperf\\Contract\\' => 16,
'Hyperf\\Context\\' => 15,
),
'G' =>
array (
'GuzzleHttp\\Psr7\\' => 16,
@ -134,9 +143,9 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1
),
'think\\' =>
array (
0 => __DIR__ . '/../..' . '/thinkphp/library/think',
1 => __DIR__ . '/..' . '/topthink/think-queue/src',
2 => __DIR__ . '/..' . '/fastadminnet/fastadmin-addons/src',
0 => __DIR__ . '/..' . '/fastadminnet/fastadmin-addons/src',
1 => __DIR__ . '/../..' . '/thinkphp/library/think',
2 => __DIR__ . '/..' . '/topthink/think-queue/src',
),
'phpseclib3\\' =>
array (
@ -228,8 +237,8 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1
),
'Psr\\Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-message/src',
1 => __DIR__ . '/..' . '/psr/http-factory/src',
0 => __DIR__ . '/..' . '/psr/http-factory/src',
1 => __DIR__ . '/..' . '/psr/http-message/src',
),
'Psr\\Http\\Client\\' =>
array (
@ -283,6 +292,26 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1
array (
0 => __DIR__ . '/..' . '/markbaker/matrix/classes/src',
),
'Hyperf\\Pimple\\' =>
array (
0 => __DIR__ . '/..' . '/hyperf/pimple/src',
),
'Hyperf\\Engine\\Contract\\' =>
array (
0 => __DIR__ . '/..' . '/hyperf/engine-contract/src',
),
'Hyperf\\Engine\\' =>
array (
0 => __DIR__ . '/..' . '/hyperf/engine/src',
),
'Hyperf\\Contract\\' =>
array (
0 => __DIR__ . '/..' . '/hyperf/contract/src',
),
'Hyperf\\Context\\' =>
array (
0 => __DIR__ . '/..' . '/hyperf/context/src',
),
'GuzzleHttp\\Psr7\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',

View File

@ -658,6 +658,352 @@
],
"install-path": "../guzzlehttp/psr7"
},
{
"name": "hyperf/context",
"version": "v3.0.37",
"version_normalized": "3.0.37.0",
"source": {
"type": "git",
"url": "https://github.com/hyperf/context.git",
"reference": "264e06fb882426d90758eca2c5bb8293f8b60455"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hyperf/context/zipball/264e06fb882426d90758eca2c5bb8293f8b60455",
"reference": "264e06fb882426d90758eca2c5bb8293f8b60455",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"hyperf/engine": "^1.2|^2.0",
"php": ">=8.0"
},
"time": "2023-09-19T01:50:18+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Hyperf\\Context\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A coroutine/application context library.",
"homepage": "https://hyperf.io",
"keywords": [
"Context",
"hyperf",
"php",
"swoole"
],
"support": {
"docs": "https://hyperf.wiki",
"issues": "https://github.com/hyperf/hyperf/issues",
"pull-request": "https://github.com/hyperf/hyperf/pulls",
"source": "https://github.com/hyperf/hyperf"
},
"install-path": "../hyperf/context"
},
{
"name": "hyperf/contract",
"version": "v3.0.37",
"version_normalized": "3.0.37.0",
"source": {
"type": "git",
"url": "https://github.com/hyperf/contract.git",
"reference": "2e8290104468a8d90855067d8644a32114474452"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hyperf/contract/zipball/2e8290104468a8d90855067d8644a32114474452",
"reference": "2e8290104468a8d90855067d8644a32114474452",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=8.0"
},
"time": "2023-09-19T01:50:18+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Hyperf\\Contract\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "The contracts of Hyperf.",
"homepage": "https://hyperf.io",
"keywords": [
"hyperf",
"php",
"swoole"
],
"support": {
"docs": "https://hyperf.wiki",
"issues": "https://github.com/hyperf/hyperf/issues",
"pull-request": "https://github.com/hyperf/hyperf/pulls",
"source": "https://github.com/hyperf/hyperf"
},
"install-path": "../hyperf/contract"
},
{
"name": "hyperf/engine",
"version": "v2.14.1",
"version_normalized": "2.14.1.0",
"source": {
"type": "git",
"url": "https://github.com/hyperf/engine.git",
"reference": "6595d2659ce7ebb940b8740a00ecd199128398f0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hyperf/engine/zipball/6595d2659ce7ebb940b8740a00ecd199128398f0",
"reference": "6595d2659ce7ebb940b8740a00ecd199128398f0",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"hyperf/engine-contract": "~1.13.0",
"php": ">=8.0"
},
"conflict": {
"ext-swoole": "<5.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"hyperf/guzzle": "^3.0",
"hyperf/http-message": "^3.0",
"mockery/mockery": "^1.5",
"phpstan/phpstan": "^1.0",
"phpunit/phpunit": "^9.4",
"swoole/ide-helper": "5.*"
},
"suggest": {
"ext-sockets": "*",
"ext-swoole": ">=5.0",
"hyperf/http-message": "Required to use ResponseEmitter.",
"psr/http-message": "Required to use WebSocket Frame."
},
"time": "2025-08-04T02:12:07+00:00",
"type": "library",
"extra": {
"hyperf": {
"config": "Hyperf\\Engine\\ConfigProvider"
},
"branch-alias": {
"dev-master": "2.14-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"src/Functions.php"
],
"psr-4": {
"Hyperf\\Engine\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Coroutine engine provided by swoole.",
"keywords": [
"engine",
"hyperf",
"php",
"swoole"
],
"support": {
"issues": "https://github.com/hyperf/engine/issues",
"source": "https://github.com/hyperf/engine/tree/v2.14.1"
},
"funding": [
{
"url": "https://hyperf.wiki/#/zh-cn/donate",
"type": "custom"
},
{
"url": "https://opencollective.com/hyperf",
"type": "open_collective"
}
],
"install-path": "../hyperf/engine"
},
{
"name": "hyperf/engine-contract",
"version": "v1.13.0",
"version_normalized": "1.13.0.0",
"source": {
"type": "git",
"url": "https://github.com/hyperf/engine-contract.git",
"reference": "26a18ec0375147546bf9702b0fd737fdd2cec1d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hyperf/engine-contract/zipball/26a18ec0375147546bf9702b0fd737fdd2cec1d6",
"reference": "26a18ec0375147546bf9702b0fd737fdd2cec1d6",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"mockery/mockery": "^1.0",
"phpstan/phpstan": "^1.0",
"phpunit/phpunit": ">=7.0",
"psr/http-message": "^1.0",
"swoole/ide-helper": "^4.5"
},
"suggest": {
"psr/http-message": "Required to use WebSocket Frame."
},
"time": "2025-04-13T14:48:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.11-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Hyperf\\Engine\\Contract\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Contract for Coroutine Engine",
"keywords": [
"contract",
"coroutine",
"engine",
"hyperf",
"php"
],
"support": {
"issues": "https://github.com/hyperf/engine-contract/issues",
"source": "https://github.com/hyperf/engine-contract/tree/v1.13.0"
},
"funding": [
{
"url": "https://hyperf.wiki/#/zh-cn/donate",
"type": "custom"
},
{
"url": "https://opencollective.com/hyperf",
"type": "open_collective"
}
],
"install-path": "../hyperf/engine-contract"
},
{
"name": "hyperf/pimple",
"version": "v2.2.2",
"version_normalized": "2.2.2.0",
"source": {
"type": "git",
"url": "https://github.com/hyperf-cloud/pimple-integration.git",
"reference": "7bd07745c256b83679471c06ec2a11e901d37277"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hyperf-cloud/pimple-integration/zipball/7bd07745c256b83679471c06ec2a11e901d37277",
"reference": "7bd07745c256b83679471c06ec2a11e901d37277",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"hyperf/context": "^3.0",
"hyperf/contract": "^3.0",
"php": ">=8.0",
"pimple/pimple": "^3.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"hyperf/support": "^3.0",
"mockery/mockery": "^1.3",
"phpstan/phpstan": "^1.0",
"phpunit/phpunit": ">=7.0"
},
"time": "2023-06-10T04:41:29+00:00",
"type": "library",
"extra": {
"hyperf": {
"config": "Hyperf\\Pimple\\ConfigProvider"
},
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Hyperf\\Pimple\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Pimple Container",
"keywords": [
"container",
"hyperf",
"php",
"psr11"
],
"support": {
"issues": "https://github.com/hyperf-cloud/pimple-integration/issues",
"source": "https://github.com/hyperf-cloud/pimple-integration/tree/v2.2.2"
},
"install-path": "../hyperf/pimple"
},
{
"name": "maennchen/zipstream-php",
"version": "2.4.0",

View File

@ -6,7 +6,7 @@
'aliases' =>
array (
),
'reference' => '0a95974a63e41cca15747597241a53381c61f1df',
'reference' => 'be05b7f6639c030982107e2c8b858af2b106b2b6',
'name' => 'fastadminnet/fastadmin',
),
'versions' =>
@ -45,7 +45,7 @@
'aliases' =>
array (
),
'reference' => '0a95974a63e41cca15747597241a53381c61f1df',
'reference' => 'be05b7f6639c030982107e2c8b858af2b106b2b6',
),
'fastadminnet/fastadmin-addons' =>
array (
@ -92,6 +92,51 @@
),
'reference' => '21dc724a0583619cd1652f673303492272778051',
),
'hyperf/context' =>
array (
'pretty_version' => 'v3.0.37',
'version' => '3.0.37.0',
'aliases' =>
array (
),
'reference' => '264e06fb882426d90758eca2c5bb8293f8b60455',
),
'hyperf/contract' =>
array (
'pretty_version' => 'v3.0.37',
'version' => '3.0.37.0',
'aliases' =>
array (
),
'reference' => '2e8290104468a8d90855067d8644a32114474452',
),
'hyperf/engine' =>
array (
'pretty_version' => 'v2.14.1',
'version' => '2.14.1.0',
'aliases' =>
array (
),
'reference' => '6595d2659ce7ebb940b8740a00ecd199128398f0',
),
'hyperf/engine-contract' =>
array (
'pretty_version' => 'v1.13.0',
'version' => '1.13.0.0',
'aliases' =>
array (
),
'reference' => '26a18ec0375147546bf9702b0fd737fdd2cec1d6',
),
'hyperf/pimple' =>
array (
'pretty_version' => 'v2.2.2',
'version' => '2.2.2.0',
'aliases' =>
array (
),
'reference' => '7bd07745c256b83679471c06ec2a11e901d37277',
),
'maennchen/zipstream-php' =>
array (
'pretty_version' => '2.4.0',

2
vendor/hyperf/context/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
/tests export-ignore
/.github export-ignore

21
vendor/hyperf/context/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Hyperf
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

40
vendor/hyperf/context/composer.json vendored Normal file
View File

@ -0,0 +1,40 @@
{
"name": "hyperf/context",
"description": "A coroutine/application context library.",
"license": "MIT",
"keywords": [
"php",
"swoole",
"hyperf",
"context"
],
"homepage": "https://hyperf.io",
"support": {
"docs": "https://hyperf.wiki",
"issues": "https://github.com/hyperf/hyperf/issues",
"pull-request": "https://github.com/hyperf/hyperf/pulls",
"source": "https://github.com/hyperf/hyperf"
},
"require": {
"php": ">=8.0",
"hyperf/engine": "^1.2|^2.0"
},
"autoload": {
"psr-4": {
"Hyperf\\Context\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"HyperfTest\\Context\\": "tests/"
}
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
}
}

View File

@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Context;
use Psr\Container\ContainerInterface;
use TypeError;
class ApplicationContext
{
protected static ?ContainerInterface $container = null;
/**
* @throws TypeError
*/
public static function getContainer(): ContainerInterface
{
return self::$container;
}
public static function hasContainer(): bool
{
return isset(self::$container);
}
public static function setContainer(ContainerInterface $container): ContainerInterface
{
self::$container = $container;
return $container;
}
}

125
vendor/hyperf/context/src/Context.php vendored Normal file
View File

@ -0,0 +1,125 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Context;
use Closure;
use Hyperf\Engine\Coroutine;
use function Hyperf\Support\value;
class Context
{
protected static array $nonCoContext = [];
public static function set(string $id, mixed $value, ?int $coroutineId = null): mixed
{
if (Coroutine::id() > 0) {
Coroutine::getContextFor($coroutineId)[$id] = $value;
} else {
static::$nonCoContext[$id] = $value;
}
return $value;
}
public static function get(string $id, mixed $default = null, ?int $coroutineId = null): mixed
{
if (Coroutine::id() > 0) {
return Coroutine::getContextFor($coroutineId)[$id] ?? $default;
}
return static::$nonCoContext[$id] ?? $default;
}
public static function has(string $id, ?int $coroutineId = null): bool
{
if (Coroutine::id() > 0) {
return isset(Coroutine::getContextFor($coroutineId)[$id]);
}
return isset(static::$nonCoContext[$id]);
}
/**
* Release the context when you are not in coroutine environment.
*/
public static function destroy(string $id, ?int $coroutineId = null): void
{
if (Coroutine::id() > 0) {
unset(Coroutine::getContextFor($coroutineId)[$id]);
}
unset(static::$nonCoContext[$id]);
}
/**
* Copy the context from a coroutine to current coroutine.
* This method will delete the origin values in current coroutine.
*/
public static function copy(int $fromCoroutineId, array $keys = []): void
{
$from = Coroutine::getContextFor($fromCoroutineId);
if ($from === null) {
return;
}
$current = Coroutine::getContextFor();
if ($keys) {
$map = array_intersect_key($from->getArrayCopy(), array_flip($keys));
} else {
$map = $from->getArrayCopy();
}
$current->exchangeArray($map);
}
/**
* Retrieve the value and override it by closure.
*/
public static function override(string $id, Closure $closure, ?int $coroutineId = null): mixed
{
$value = null;
if (self::has($id, $coroutineId)) {
$value = self::get($id, null, $coroutineId);
}
$value = $closure($value);
self::set($id, $value, $coroutineId);
return $value;
}
/**
* Retrieve the value and store it if not exists.
*/
public static function getOrSet(string $id, mixed $value, ?int $coroutineId = null): mixed
{
if (! self::has($id, $coroutineId)) {
return self::set($id, value($value), $coroutineId);
}
return self::get($id, null, $coroutineId);
}
public static function getContainer(?int $coroutineId = null)
{
if (Coroutine::id() > 0) {
return Coroutine::getContextFor($coroutineId);
}
return static::$nonCoContext;
}
}

View File

@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Context\Traits;
use Hyperf\Context\Context;
use RuntimeException;
trait CoroutineProxy
{
public function __call($name, $arguments)
{
$target = $this->getTargetObject();
return $target->{$name}(...$arguments);
}
public function __get($name)
{
$target = $this->getTargetObject();
return $target->{$name};
}
public function __set($name, $value)
{
$target = $this->getTargetObject();
return $target->{$name} = $value;
}
protected function getTargetObject()
{
if (! isset($this->proxyKey)) {
throw new RuntimeException(sprintf('Missing $proxyKey property in %s.', $this::class));
}
return Context::get($this->proxyKey);
}
}

2
vendor/hyperf/contract/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
/tests export-ignore
/.github export-ignore

21
vendor/hyperf/contract/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Hyperf
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

33
vendor/hyperf/contract/composer.json vendored Normal file
View File

@ -0,0 +1,33 @@
{
"name": "hyperf/contract",
"description": "The contracts of Hyperf.",
"license": "MIT",
"keywords": [
"php",
"swoole",
"hyperf"
],
"homepage": "https://hyperf.io",
"support": {
"docs": "https://hyperf.wiki",
"issues": "https://github.com/hyperf/hyperf/issues",
"pull-request": "https://github.com/hyperf/hyperf/pulls",
"source": "https://github.com/hyperf/hyperf"
},
"require": {
"php": ">=8.0"
},
"autoload": {
"psr-4": {
"Hyperf\\Contract\\": "src/"
}
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
}
}

View File

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Hyperf\Framework\ApplicationFactory;
/**
* @see ApplicationFactory
*/
interface ApplicationInterface
{
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
/**
* @template TKey of array-key
* @template TValue
*/
interface Arrayable
{
/**
* @return array<TKey, TValue>
*/
public function toArray(): array;
}

22
vendor/hyperf/contract/src/Castable.php vendored Normal file
View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface Castable
{
/**
* Get the name of the caster class to use when casting from / to this cast target.
*
* @return CastsAttributes|CastsInboundAttributes|string
*/
public static function castUsing();
}

View File

@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface CastsAttributes
{
/**
* Transform the attribute from the underlying model values.
*
* @param object $model
* @param mixed $value
* @return mixed
*/
public function get($model, string $key, $value, array $attributes);
/**
* Transform the attribute to its underlying model values.
*
* @param object $model
* @param mixed $value
* @return array|string
*/
public function set($model, string $key, $value, array $attributes);
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface CastsInboundAttributes
{
/**
* Transform the attribute to its underlying model values.
*
* @param object $model
* @param mixed $value
* @return array
*/
public function set($model, string $key, $value, array $attributes);
}

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface CompressInterface
{
public function compress(): UnCompressInterface;
}

View File

@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface ConfigInterface
{
/**
* Finds an entry of the container by its identifier and returns it.
*
* @param string $key identifier of the entry to look for
* @param mixed $default default value of the entry when does not found
* @return mixed entry
*/
public function get(string $key, mixed $default = null): mixed;
/**
* Returns true if the container can return an entry for the given identifier.
* Returns false otherwise.
*
* @param string $keys identifier of the entry to look for
*/
public function has(string $keys): bool;
/**
* Set a value to the container by its identifier.
*
* @param string $key identifier of the entry to set
* @param mixed $value the value that save to container
*/
public function set(string $key, mixed $value): void;
}

View File

@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface ConnectionInterface
{
/**
* Get the real connection from pool.
*/
public function getConnection();
/**
* Reconnect the connection.
*/
public function reconnect(): bool;
/**
* Check the connection is valid.
*/
public function check(): bool;
/**
* Close the connection.
*/
public function close(): bool;
/**
* Release the connection to pool.
*/
public function release(): void;
}

View File

@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Psr\Container\ContainerInterface as PsrContainerInterface;
interface ContainerInterface extends PsrContainerInterface
{
/**
* Build an entry of the container by its name.
* This method behave like get() except resolves the entry again every time.
* For example if the entry is a class then a new instance will be created each time.
* This method makes the container behave like a factory.
*
* @param string $name entry name or a class name
* @param array $parameters Optional parameters to use to build the entry. Use this to force specific parameters
* to specific values. Parameters not defined in this array will be resolved using
* the container.
* @throws InvalidArgumentException the name parameter must be of type string
* @throws NotFoundException no entry found for the given name
*/
public function make(string $name, array $parameters = []);
/**
* Bind an arbitrary resolved entry to an identifier.
* Useful for testing 'get'.
*
* @param mixed $entry
*/
public function set(string $name, $entry): void;
/**
* Unbind an arbitrary resolved entry.
*/
public function unbind(string $name): void;
/**
* Bind an arbitrary definition to an identifier.
* Useful for testing 'make'.
*
* @param array|callable|string $definition
*/
public function define(string $name, $definition): void;
}

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface DispatcherInterface
{
public function dispatch(...$params);
}

View File

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface FrequencyInterface
{
/**
* Number of hit per time.
*/
public function hit(int $number = 1): bool;
/**
* Hits per second.
*/
public function frequency(): float;
}

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface IPReaderInterface
{
public function read(): string;
}

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface IdGeneratorInterface
{
public function generate();
}

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface JsonDeSerializable
{
public static function jsonDeSerialize(mixed $data): static;
}

17
vendor/hyperf/contract/src/Jsonable.php vendored Normal file
View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface Jsonable
{
public function __toString(): string;
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface LengthAwarePaginatorInterface extends PaginatorInterface
{
/**
* Create a range of pagination URLs.
*/
public function getUrlRange(int $start, int $end): array;
/**
* Determine the total number of items in the data store.
*/
public function total(): int;
/**
* Get the page number of the last available page.
*/
public function lastPage(): int;
}

View File

@ -0,0 +1,87 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface MessageBag
{
/**
* Get the keys present in the message bag.
*/
public function keys(): array;
/**
* Add a message to the bag.
*/
public function add(string $key, string $message): MessageBag;
/**
* Merge a new array of messages into the bag.
*
* @param array|MessageProvider $messages
* @return $this
*/
public function merge($messages);
/**
* Determine if messages exist for a given key.
*
* @param array|string $key
*/
public function has($key): bool;
/**
* Get the first message from the bag for a given key.
*/
public function first(?string $key = null, ?string $format = null): string;
/**
* Get all of the messages from the bag for a given key.
*/
public function get(string $key, ?string $format = null): array;
/**
* Get all of the messages for every key in the bag.
*/
public function all(?string $format = null): array;
/**
* Get the raw messages in the container.
*/
public function getMessages(): array;
/**
* Get the default message format.
*/
public function getFormat(): string;
/**
* Set the default message format.
*
* @return $this
*/
public function setFormat(string $format = ':message');
/**
* Determine if the message bag has any messages.
*/
public function isEmpty(): bool;
/**
* Determine if the message bag has any messages.
*/
public function isNotEmpty(): bool;
/**
* Get the number of messages in the container.
*/
public function count(): int;
}

View File

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface MessageProvider
{
/**
* Get the messages for the instance.
*/
public function getMessageBag(): MessageBag;
}

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface MiddlewareInitializerInterface
{
public function initCoreMiddleware(string $serverName): void;
}

View File

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use ArrayObject;
interface NormalizerInterface
{
/**
* Normalizes an object into a set of arrays/scalars.
*
* @param mixed $object
* @return null|array|ArrayObject|bool|float|int|string
*/
public function normalize($object);
/**
* Denormalizes data back into an object of the given class.
*
* @param mixed $data Data to restore
* @param string $class The expected class to instantiate
* @return mixed|object
*/
public function denormalize($data, string $class);
}

View File

@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Swoole\Http\Response;
use Swoole\Server;
interface OnCloseInterface
{
/**
* @param Response|Server $server
*/
public function onClose($server, int $fd, int $reactorId): void;
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Swoole\Http\Request;
use Swoole\Http\Response;
interface OnHandShakeInterface
{
/**
* @param Request $request
* @param Response $response
*/
public function onHandShake($request, $response): void;
}

View File

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Swoole\Http\Response;
use Swoole\WebSocket\Frame;
use Swoole\WebSocket\Server;
interface OnMessageInterface
{
/**
* @param Response|Server $server
* @param Frame $frame
*/
public function onMessage($server, $frame): void;
}

View File

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Swoole\Http\Request;
use Swoole\Http\Response;
use Swoole\WebSocket\Server;
interface OnOpenInterface
{
/**
* @param Response|Server $server
* @param Request $request
*/
public function onOpen($server, $request): void;
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Swoole\WebSocket\Server;
interface OnPacketInterface
{
/**
* @param Server $server
* @param mixed $data
* @param array $clientInfo
*/
public function onPacket($server, $data, $clientInfo): void;
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Swoole\Coroutine\Server\Connection;
use Swoole\Server as SwooleServer;
use Swow\Socket;
interface OnReceiveInterface
{
/**
* @param Connection|Socket|SwooleServer $server
*/
public function onReceive($server, int $fd, int $reactorId, string $data): void;
}

View File

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface OnRequestInterface
{
/**
* @param mixed $request swoole request or psr server request
* @param mixed $response swoole response or swow session
*/
public function onRequest($request, $response): void;
}

View File

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface PackerInterface
{
public function pack($data): string;
public function unpack(string $data);
}

View File

@ -0,0 +1,95 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface PaginatorInterface
{
/**
* Get the URL for a given page.
*/
public function url(int $page): string;
/**
* Add a set of query string values to the paginator.
*
* @param array|string $key
* @return $this
*/
public function appends($key, ?string $value = null);
/**
* Get / set the URL fragment to be appended to URLs.
*
* @return $this|string
*/
public function fragment(?string $fragment = null);
/**
* The URL for the next page, or null.
*/
public function nextPageUrl(): ?string;
/**
* Get the URL for the previous page, or null.
*/
public function previousPageUrl(): ?string;
/**
* Get all of the items being paginated.
*/
public function items(): array;
/**
* Get the "index" of the first item being paginated.
*/
public function firstItem(): ?int;
/**
* Get the "index" of the last item being paginated.
*/
public function lastItem(): ?int;
/**
* Determine how many items are being shown per page.
*/
public function perPage(): int;
/**
* Determine the current page being paginated.
*/
public function currentPage(): int;
/**
* Determine if there are enough items to split into multiple pages.
*/
public function hasPages(): bool;
/**
* Determine if there is more items in the data store.
*/
public function hasMorePages(): bool;
/**
* Determine if the list of items is empty or not.
*/
public function isEmpty(): bool;
/**
* Determine if the list of items is not empty.
*/
public function isNotEmpty(): bool;
/**
* Render the paginator using a given view.
*/
public function render(?string $view = null, array $data = []): string;
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface PoolInterface
{
/**
* Get a connection from the connection pool.
*/
public function get(): ConnectionInterface;
/**
* Release a connection back to the connection pool.
*/
public function release(ConnectionInterface $connection): void;
/**
* Close and clear the connection pool.
*/
public function flush(): void;
public function getOption(): PoolOptionInterface;
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface PoolOptionInterface
{
public function getMaxConnections(): int;
public function getMinConnections(): int;
public function getConnectTimeout(): float;
public function getWaitTimeout(): float;
public function getHeartbeat(): float;
public function getMaxIdleTime(): float;
}

View File

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Swoole\Coroutine\Http\Server as CoHttpServer;
use Swoole\Coroutine\Server as CoServer;
use Swoole\Server;
interface ProcessInterface
{
/**
* Create the process object according to process number and bind to server.
* @param CoHttpServer|CoServer|Server $server
*/
public function bind($server): void;
/**
* Determine if the process should start ?
* @param CoServer|Server $server
*/
public function isEnable($server): bool;
/**
* The logical of process will place in here.
*/
public function handle(): void;
}

View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Psr\Http\Message\ResponseInterface;
interface ResponseEmitterInterface
{
/**
* @param mixed $connection swoole response or swow session
*/
public function emit(ResponseInterface $response, mixed $connection, bool $withContent = true): void;
}

View File

@ -0,0 +1,160 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use RuntimeException;
interface SessionInterface
{
/**
* Starts the session storage.
*
* @return bool True if session started
* @throws RuntimeException if session fails to start
*/
public function start(): bool;
/**
* Returns the session ID.
*
* @return string The session ID
*/
public function getId(): string;
/**
* Sets the session ID.
*/
public function setId(string $id);
/**
* Returns the session name.
*/
public function getName(): string;
/**
* Sets the session name.
*/
public function setName(string $name);
/**
* Invalidates the current session.
*
* Clears all session attributes and flashes and regenerates the
* session and deletes the old session from persistence.
*
* @param int $lifetime Sets the cookie lifetime for the session cookie. A null value
* will leave the system settings unchanged, 0 sets the cookie
* to expire with browser session. Time is in seconds, and is
* not a Unix timestamp.
*
* @return bool True if session invalidated, false if error
*/
public function invalidate(?int $lifetime = null): bool;
/**
* Migrates the current session to a new session id while maintaining all
* session attributes.
*
* @param bool $destroy Whether to delete the old session or leave it to garbage collection
* @param int $lifetime Sets the cookie lifetime for the session cookie. A null value
* will leave the system settings unchanged, 0 sets the cookie
* to expire with browser session. Time is in seconds, and is
* not a Unix timestamp.
*
* @return bool True if session migrated, false if error
*/
public function migrate(bool $destroy = false, ?int $lifetime = null): bool;
/**
* Force the session to be saved and closed.
*
* This method is generally not required for real sessions as
* the session will be automatically saved at the end of
* code execution.
*/
public function save(): void;
/**
* Checks if an attribute is defined.
*
* @param string $name The attribute name
*
* @return bool true if the attribute is defined, false otherwise
*/
public function has(string $name): bool;
/**
* Returns an attribute.
*
* @param string $name The attribute name
* @param mixed $default The default value if not found
*/
public function get(string $name, $default = null);
/**
* Sets an attribute.
* @param mixed $value
*/
public function set(string $name, $value): void;
/**
* Put a key / value pair or array of key / value pairs in the session.
*
* @param array|string $key
* @param null|mixed $value
*/
public function put($key, $value = null): void;
/**
* Returns attributes.
*/
public function all(): array;
/**
* Sets attributes.
*/
public function replace(array $attributes): void;
/**
* Removes an attribute, returning its value.
*
* @return mixed The removed value or null when it does not exist
*/
public function remove(string $name);
/**
* Remove one or many items from the session.
*
* @param array|string $keys
*/
public function forget($keys): void;
/**
* Clears all attributes.
*/
public function clear(): void;
/**
* Checks if the session was started.
*/
public function isStarted(): bool;
/**
* Get the previous URL from the session.
*/
public function previousUrl(): ?string;
/**
* Set the "previous" URL in the session.
*/
public function setPreviousUrl(string $url): void;
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Psr\Log\LoggerInterface;
interface StdoutLoggerInterface extends LoggerInterface
{
}

View File

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface Synchronized
{
/**
* Whether the data has been synchronized.
*/
public function isSynchronized(): bool;
}

View File

@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
use Countable;
interface TranslatorInterface
{
/**
* Get the translation for a given key.
*/
public function trans(string $key, array $replace = [], ?string $locale = null): array|string;
/**
* Get a translation according to an integer value.
*
* @param array|Countable|int $number
*/
public function transChoice(string $key, $number, array $replace = [], ?string $locale = null): string;
/**
* Get the default locale being used.
*/
public function getLocale(): string;
/**
* Set the default locale.
*/
public function setLocale(string $locale);
}

View File

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface TranslatorLoaderInterface
{
/**
* Load the messages for the given locale.
*/
public function load(string $locale, string $group, ?string $namespace = null): array;
/**
* Add a new namespace to the loader.
*/
public function addNamespace(string $namespace, string $hint);
/**
* Add a new JSON path to the loader.
*/
public function addJsonPath(string $path);
/**
* Get an array of all the registered namespaces.
*/
public function namespaces(): array;
}

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface UnCompressInterface
{
public function uncompress();
}

View File

@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface ValidatorInterface extends MessageProvider
{
/**
* Run the validator's rules against its data.
*/
public function validate(): array;
/**
* Get the attributes and values that were validated.
*/
public function validated(): array;
/**
* Determine if the data fails the validation rules.
*/
public function fails(): bool;
/**
* Get the failed validation rules.
*/
public function failed(): array;
/**
* Add conditions to a given field based on a Closure.
*
* @param array|string $attribute
* @param array|string $rules
* @return $this
*/
public function sometimes($attribute, $rules, callable $callback);
/**
* Add an after validation callback.
*
* @param callable|string $callback
* @return $this
*/
public function after($callback);
/**
* Get all of the validation error messages.
*/
public function errors(): MessageBag;
}

17
vendor/hyperf/contract/src/Xmlable.php vendored Normal file
View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Contract;
interface Xmlable
{
public function __toString(): string;
}

View File

@ -0,0 +1,2 @@
/tests export-ignore
/.github export-ignore

View File

@ -0,0 +1,6 @@
/vendor/
composer.lock
*.cache
*.log
.vscode
.idea/*

View File

@ -0,0 +1,104 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
$header = <<<'EOF'
This file is part of Hyperf.
@link https://www.hyperf.io
@document https://hyperf.wiki
@contact group@hyperf.io
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
EOF;
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => $header,
'separate' => 'none',
'location' => 'after_declare_strict',
],
'array_syntax' => [
'syntax' => 'short',
],
'list_syntax' => [
'syntax' => 'short',
],
'concat_space' => [
'spacing' => 'one',
],
'blank_line_before_statement' => [
'statements' => [
'declare',
],
],
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author',
],
],
'ordered_imports' => [
'imports_order' => [
'class', 'function', 'const',
],
'sort_algorithm' => 'alpha',
],
'single_line_comment_style' => [
'comment_types' => [
],
],
'yoda_style' => [
'always_move_variable' => false,
'equal' => false,
'identical' => false,
],
'phpdoc_align' => [
'align' => 'left',
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'constant_case' => [
'case' => 'lower',
],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'class_attributes_separation' => true,
'combine_consecutive_unsets' => true,
'declare_strict_types' => true,
'linebreak_after_opening_tag' => true,
'lowercase_static_reference' => true,
'no_useless_else' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'not_operator_with_space' => false,
'ordered_class_elements' => true,
'php_unit_strict' => false,
'phpdoc_separation' => false,
'single_quote' => true,
'standardize_not_equals' => true,
'multiline_comment_opening_closing' => true,
'single_line_empty_body' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
)
->setUsingCache(false);

View File

@ -0,0 +1,6 @@
<?php
namespace PHPSTORM_META {
// Reflect
override(\Psr\Container\ContainerInterface::get(0), map('@'));
}

21
vendor/hyperf/engine-contract/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Hyperf
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,9 @@
# Contract for Coroutine Engine
[![PHPUnit](https://github.com/hyperf/engine-contract/actions/workflows/test.yml/badge.svg)](https://github.com/hyperf/engine-contract/actions/workflows/test.yml)
## How to install
```
composer require hyperf/engine-contract
```

View File

@ -0,0 +1,53 @@
{
"name": "hyperf/engine-contract",
"type": "library",
"license": "MIT",
"keywords": [
"php",
"hyperf",
"coroutine",
"contract",
"engine"
],
"description": "Contract for Coroutine Engine",
"autoload": {
"psr-4": {
"Hyperf\\Engine\\Contract\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"HyperfTest\\": "tests"
}
},
"require": {
"php": ">=8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"mockery/mockery": "^1.0",
"phpstan/phpstan": "^1.0",
"phpunit/phpunit": ">=7.0",
"psr/http-message": "^1.0",
"swoole/ide-helper": "^4.5"
},
"suggest": {
"psr/http-message": "Required to use WebSocket Frame."
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"optimize-autoloader": true,
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "1.11-dev"
}
},
"scripts": {
"test": "phpunit -c phpunit.xml --colors=always",
"analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src",
"cs-fix": "php-cs-fixer fix $1"
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<testsuite name="Testsuite">
<directory>./tests/</directory>
</testsuite>
</phpunit>

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract;
interface BarrierInterface
{
/**
* Wait for the barrier to be released.
*/
public static function wait(object &$barrier, int $timeout = -1): void;
/**
* Create a new barrier instance.
*
* @return BarrierInterface
*/
public static function create(): object;
}

View File

@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract;
/**
* @template TValue of mixed
*/
interface ChannelInterface
{
/**
* @param TValue $data
* @param float|int $timeout seconds [optional] = -1
*/
public function push(mixed $data, float $timeout = -1): bool;
/**
* @param float $timeout seconds [optional] = -1
* @return false|TValue when pop failed, return false
*/
public function pop(float $timeout = -1): mixed;
/**
* Swow: When the channel is closed, all the data in it will be destroyed.
* Swoole: When the channel is closed, the data in it can still be popped out, but push behavior will no longer succeed.
*/
public function close(): bool;
public function getCapacity(): int;
public function getLength(): int;
public function isAvailable(): bool;
public function hasProducers(): bool;
public function hasConsumers(): bool;
public function isEmpty(): bool;
public function isFull(): bool;
public function isReadable(): bool;
public function isWritable(): bool;
public function isClosing(): bool;
public function isTimeout(): bool;
}

View File

@ -0,0 +1,96 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract;
use ArrayObject;
use Hyperf\Engine\Exception\CoroutineDestroyedException;
use Hyperf\Engine\Exception\RunningInNonCoroutineException;
interface CoroutineInterface
{
/**
* @param callable $callable [required]
*/
public function __construct(callable $callable);
/**
* @param mixed ...$data
*/
public function execute(...$data): static;
public function getId(): int;
/**
* @param callable $callable [required]
* @param mixed ...$data
* @return $this
*/
public static function create(callable $callable, ...$data): static;
/**
* @return int returns coroutine id from current coroutine, -1 in non coroutine environment
*/
public static function id(): int;
/**
* Returns the parent coroutine ID.
* Returns 0 when running in the top level coroutine.
* @throws RunningInNonCoroutineException when running in non-coroutine context
* @throws CoroutineDestroyedException when the coroutine has been destroyed
*/
public static function pid(?int $id = null): int;
/**
* Set config to coroutine.
*/
public static function set(array $config): void;
/**
* @param null|int $id coroutine id
*/
public static function getContextFor(?int $id = null): ?ArrayObject;
/**
* Execute callback when coroutine destruct.
*/
public static function defer(callable $callable): void;
/**
* Yield the current coroutine.
* @param mixed $data only Support Swow
* @return bool|mixed Swow:mixed, Swoole:bool
*/
public static function yield(mixed $data = null): mixed;
/**
* Resume the coroutine by coroutine Id.
* @param mixed $data only Support Swow
* @return bool|mixed Swow:mixed, Swoole:bool
*/
public static function resumeById(int $id, mixed ...$data): mixed;
/**
* Get the coroutine stats.
*/
public static function stats(): array;
/**
* Check if a coroutine exists or not.
*/
public static function exists(int $id): bool;
/**
* @return iterable<int> returns all coroutine IDs
*/
public static function list(): iterable;
}

View File

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract;
interface DefaultOptionInterface
{
/**
* Get Hook Coroutine Flags.
*/
public static function hookFlags(): int;
}

View File

@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http;
interface ClientInterface
{
public function set(array $settings): bool;
/**
* @param string[][] $headers
*/
public function request(string $method = 'GET', string $path = '/', array $headers = [], string $contents = '', string $version = '1.1'): RawResponseInterface;
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http;
use Stringable;
interface Http
{
public const DEFAULT_PROTOCOL_VERSION = '1.1';
public static function packRequest(string $method, string|Stringable $path, array $headers = [], string|Stringable $body = '', string $protocolVersion = self::DEFAULT_PROTOCOL_VERSION): string;
public static function packResponse(int $statusCode, string $reasonPhrase = '', array $headers = [], string|Stringable $body = '', string $protocolVersion = self::DEFAULT_PROTOCOL_VERSION): string;
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http;
interface RawResponseInterface
{
public function getStatusCode(): int;
/**
* @return string[][]
*/
public function getHeaders(): array;
public function getBody(): string;
public function getVersion(): string;
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http;
interface ServerFactoryInterface
{
public function make(string $name, int $port = 0): ServerInterface;
}

View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http;
interface ServerInterface
{
public function handle(callable $callable): static;
public function start(): void;
public function close(): bool;
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http\V2;
interface ClientFactoryInterface
{
public function make(string $host, int $port = 80, bool $ssl = false);
}

View File

@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http\V2;
interface ClientInterface
{
public function set(array $settings): bool;
/**
* @return int StreamID
*/
public function send(RequestInterface $request): int;
public function recv(float $timeout = 0): ResponseInterface;
public function write(int $streamId, mixed $data, bool $end = false): bool;
public function ping(): bool;
public function close(): bool;
public function isConnected(): bool;
}

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http\V2;
interface RequestInterface
{
public function getPath(): string;
public function getMethod(): string;
public function getHeaders(): array;
public function getBody(): string;
public function isPipeline(): bool;
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http\V2;
interface ResponseInterface
{
public function getStreamId(): int;
public function getStatusCode(): int;
public function getHeaders(): array;
public function getBody(): ?string;
}

View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Http;
interface Writable
{
public function getSocket(): mixed;
public function write(string $data): bool;
public function end(): ?bool;
}

View File

@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract;
use Psr\Http\Message\ResponseInterface;
interface ResponseEmitterInterface
{
/**
* @param mixed $connection swoole response or swow session
*/
public function emit(ResponseInterface $response, mixed $connection, bool $withContent = true): void;
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract;
interface SignalInterface
{
public static function wait(int $signo, float $timeout = -1): bool;
}

View File

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Socket;
use Hyperf\Engine\Contract\SocketInterface;
interface SocketFactoryInterface
{
public function make(SocketOptionInterface $option): SocketInterface;
}

View File

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\Socket;
interface SocketOptionInterface
{
public function getHost(): string;
public function getPort(): int;
/**
* Connect timeout, seconds.
*/
public function getTimeout(): ?float;
/**
* @return [
* 'open_length_check' => true,
* 'package_max_length' => 1024 * 1024 * 2,
* 'package_length_type' => 'N',
* 'package_length_offset' => 0,
* 'package_body_offset' => 4,
* ]
*/
public function getProtocol(): array;
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract;
interface SocketInterface
{
public function sendAll(string $data, float $timeout = 0): false|int;
public function recvAll(int $length = 65536, float $timeout = 0): false|string;
public function recvPacket(float $timeout = 0): false|string;
public function close(): bool;
}

View File

@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\WebSocket;
use Psr\Http\Message\StreamInterface;
use Stringable;
interface FrameInterface extends Stringable
{
public function getOpcode(): int;
public function setOpcode(int $opcode): static;
public function withOpcode(int $opcode): static;
public function getFin(): bool;
public function setFin(bool $fin): static;
public function withFin(bool $fin): static;
public function getRSV1(): bool;
public function setRSV1(bool $rsv1): static;
public function withRSV1(bool $rsv1): static;
public function getRSV2(): bool;
public function setRSV2(bool $rsv2): static;
public function withRSV2(bool $rsv2): static;
public function getRSV3(): bool;
public function setRSV3(bool $rsv3): static;
public function withRSV3(bool $rsv3): static;
public function getPayloadLength(): int;
public function setPayloadLength(int $payloadLength): static;
public function withPayloadLength(int $payloadLength): static;
public function getMask(): bool;
public function getMaskingKey(): string;
public function setMaskingKey(string $maskingKey): static;
public function withMaskingKey(string $maskingKey): static;
public function getPayloadData(): StreamInterface;
public function setPayloadData(mixed $payloadData): static;
public function withPayloadData(mixed $payloadData): static;
public function toString(bool $withoutPayloadData = false): string;
public static function from(mixed $frame): static;
}

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\WebSocket;
interface ResponseInterface
{
public function push(FrameInterface $frame): bool;
/**
* Init fd by frame or request and so on,
* Must be used in swoole process mode.
*/
public function init(mixed $frame): static;
public function getFd(): int;
public function close(): bool;
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Contract\WebSocket;
interface WebSocketInterface
{
public const ON_MESSAGE = 'message';
public const ON_CLOSE = 'close';
public function on(string $event, callable $callback): void;
public function start(): void;
}

4
vendor/hyperf/engine/.gitattributes vendored Normal file
View File

@ -0,0 +1,4 @@
/.github export-ignore
/examples export-ignore
/tests export-ignore

5
vendor/hyperf/engine/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/vendor/
composer.lock
*.cache
*.log
.idea/*

95
vendor/hyperf/engine/.php-cs-fixer.php vendored Normal file
View File

@ -0,0 +1,95 @@
<?php
$header = <<<'EOF'
This file is part of Hyperf.
@link https://www.hyperf.io
@document https://hyperf.wiki
@contact group@hyperf.io
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
EOF;
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => $header,
'separate' => 'none',
'location' => 'after_declare_strict',
],
'array_syntax' => [
'syntax' => 'short'
],
'list_syntax' => [
'syntax' => 'short'
],
'concat_space' => [
'spacing' => 'one'
],
'blank_line_before_statement' => [
'statements' => [
'declare',
],
],
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author'
],
],
'ordered_imports' => [
'imports_order' => [
'class', 'function', 'const',
],
'sort_algorithm' => 'alpha',
],
'single_line_comment_style' => [
'comment_types' => [
],
],
'yoda_style' => [
'always_move_variable' => false,
'equal' => false,
'identical' => false,
],
'phpdoc_align' => [
'align' => 'left',
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'constant_case' => [
'case' => 'lower',
],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'class_attributes_separation' => true,
'combine_consecutive_unsets' => true,
'declare_strict_types' => true,
'linebreak_after_opening_tag' => true,
'lowercase_static_reference' => true,
'no_useless_else' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'not_operator_with_space' => false,
'ordered_class_elements' => true,
'php_unit_strict' => false,
'phpdoc_separation' => false,
'single_quote' => true,
'standardize_not_equals' => true,
'multiline_comment_opening_closing' => true,
'single_line_empty_body' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
)
->setUsingCache(false);

View File

@ -0,0 +1,6 @@
<?php
namespace PHPSTORM_META {
// Reflect
override(\Psr\Container\ContainerInterface::get(0), map('@'));
}

44
vendor/hyperf/engine/Dockerfile vendored Normal file
View File

@ -0,0 +1,44 @@
# Default Dockerfile
#
# @link https://www.hyperf.io
# @document https://hyperf.wiki
# @contact group@hyperf.io
# @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
ARG PHP_VERSION
ARG ALPINE_VERSION
FROM hyperf/hyperf:${PHP_VERSION}-alpine-${ALPINE_VERSION}-swoole
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
ARG timezone
ARG PHP_VERSION
ENV TIMEZONE=${timezone:-"Asia/Shanghai"}
ENV COMPOSER_ROOT_VERSION="v2.0.0"
# update
RUN set -ex \
# show php version and extensions
&& php -v \
&& php -m \
&& php --ri swoole \
# ---------- some config ----------
&& cd /etc/php* \
# - config PHP
&& { \
echo "upload_max_filesize=128M"; \
echo "post_max_size=128M"; \
echo "memory_limit=1G"; \
echo "date.timezone=${TIMEZONE}"; \
} | tee conf.d/99_overrides.ini \
# - config timezone
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone \
# ---------- clear works ----------
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
WORKDIR /opt/www
COPY . /opt/www

7
vendor/hyperf/engine/README.md vendored Normal file
View File

@ -0,0 +1,7 @@
# Swoole Engine
[![Swoole Engine Test](https://github.com/hyperf/engine/actions/workflows/test.yml/badge.svg)](https://github.com/hyperf/engine/actions/workflows/test.yml)
```
composer require hyperf/engine
```

66
vendor/hyperf/engine/composer.json vendored Normal file
View File

@ -0,0 +1,66 @@
{
"name": "hyperf/engine",
"type": "library",
"license": "MIT",
"keywords": [
"php",
"hyperf",
"engine",
"swoole"
],
"description": "Coroutine engine provided by swoole.",
"autoload": {
"psr-4": {
"Hyperf\\Engine\\": "src/"
},
"files": [
"src/Functions.php"
]
},
"autoload-dev": {
"psr-4": {
"HyperfTest\\": "tests"
}
},
"require": {
"php": ">=8.0",
"hyperf/engine-contract": "~1.13.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"hyperf/guzzle": "^3.0",
"hyperf/http-message": "^3.0",
"mockery/mockery": "^1.5",
"phpstan/phpstan": "^1.0",
"phpunit/phpunit": "^9.4",
"swoole/ide-helper": "5.*"
},
"suggest": {
"ext-sockets": "*",
"ext-swoole": ">=5.0",
"psr/http-message": "Required to use WebSocket Frame.",
"hyperf/http-message": "Required to use ResponseEmitter."
},
"conflict": {
"ext-swoole": "<5.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"optimize-autoloader": true,
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "2.14-dev"
},
"hyperf": {
"config": "Hyperf\\Engine\\ConfigProvider"
}
},
"scripts": {
"test": "phpunit -c phpunit.xml --colors=always",
"analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src",
"cs-fix": "php-cs-fixer fix $1"
}
}

15
vendor/hyperf/engine/phpunit.xml vendored Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
verbose="true"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuite name="Testsuite">
<directory>./tests/</directory>
</testsuite>
</phpunit>

29
vendor/hyperf/engine/src/Barrier.php vendored Normal file
View File

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine;
use Hyperf\Engine\Contract\BarrierInterface;
use Swoole\Coroutine\Barrier as SwooleBarrier;
class Barrier implements BarrierInterface
{
public static function wait(object &$barrier, int $timeout = -1): void
{
SwooleBarrier::wait($barrier, $timeout);
}
public static function create(): object
{
return SwooleBarrier::make();
}
}

94
vendor/hyperf/engine/src/Channel.php vendored Normal file
View File

@ -0,0 +1,94 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine;
use Hyperf\Engine\Contract\ChannelInterface;
use Hyperf\Engine\Exception\RuntimeException;
/**
* @template TValue of mixed
* @implements ChannelInterface
*/
class Channel extends \Swoole\Coroutine\Channel implements ChannelInterface
{
protected bool $closed = false;
/**
* @param TValue $data
* @param float|int $timeout seconds [optional] = -1
*/
public function push(mixed $data, float $timeout = -1): bool
{
return parent::push($data, $timeout);
}
/**
* @param float $timeout seconds [optional] = -1
* @return false|TValue when pop failed, return false
*/
public function pop(float $timeout = -1): mixed
{
return parent::pop($timeout);
}
public function getCapacity(): int
{
return $this->capacity;
}
public function getLength(): int
{
return $this->length();
}
public function isAvailable(): bool
{
return ! $this->isClosing();
}
public function close(): bool
{
$this->closed = true;
return parent::close();
}
public function hasProducers(): bool
{
throw new RuntimeException('Not supported.');
}
public function hasConsumers(): bool
{
throw new RuntimeException('Not supported.');
}
public function isReadable(): bool
{
throw new RuntimeException('Not supported.');
}
public function isWritable(): bool
{
throw new RuntimeException('Not supported.');
}
public function isClosing(): bool
{
return $this->closed || $this->errCode === SWOOLE_CHANNEL_CLOSED;
}
public function isTimeout(): bool
{
return ! $this->closed && $this->errCode === SWOOLE_CHANNEL_TIMEOUT;
}
}

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine;
use Hyperf\Engine\Contract\Socket\SocketFactoryInterface;
use Hyperf\Engine\Socket\SocketFactory;
class ConfigProvider
{
public function __invoke(): array
{
return [
'dependencies' => [
SocketFactoryInterface::class => SocketFactory::class,
],
];
}
}

26
vendor/hyperf/engine/src/Constant.php vendored Normal file
View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine;
use Swoole\Coroutine\Http\Server as HttpServer;
use Swoole\Coroutine\Server;
class Constant
{
public const ENGINE = 'Swoole';
public static function isCoroutineServer($server): bool
{
return $server instanceof Server || $server instanceof HttpServer;
}
}

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Constant;
class SocketType
{
public const TCP = SWOOLE_SOCK_TCP;
public const TCP6 = SWOOLE_SOCK_TCP6;
public const UDP = SWOOLE_SOCK_UDP;
public const UDP6 = SWOOLE_SOCK_UDP6;
public const UNIX_STREAM = SWOOLE_SOCK_UNIX_STREAM;
public const UNIX_DGRAM = SWOOLE_SOCK_UNIX_DGRAM;
}

Some files were not shown because too many files have changed in this diff Show More