mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
v2.0.12 (#2555)
* Update CHANGELOG-2.0.md * Update * Update doc and translate Co-authored-by: huangzhhui <huangzhwork@gmail.com>
This commit is contained in:
parent
7fc9e40994
commit
e259a59184
@ -1,4 +1,6 @@
|
|||||||
# v2.0.12 - TBD
|
# v2.0.13 - TBD
|
||||||
|
|
||||||
|
# v2.0.12 - 2020-09-21
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
@ -6,10 +8,15 @@
|
|||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) Fixed streaming grpc-client does not works.
|
||||||
- [#2509](https://github.com/hyperf/hyperf/pull/2509) Fixed mutated attributes do not work in camel case for `hyperf/database`.
|
- [#2509](https://github.com/hyperf/hyperf/pull/2509) Fixed mutated attributes do not work in camel case for `hyperf/database`.
|
||||||
- [#2535](https://github.com/hyperf/hyperf/pull/2535) Fixed `@property` of mutated attribute will be replaced by morphTo for `gen:model`.
|
- [#2535](https://github.com/hyperf/hyperf/pull/2535) Fixed `@property` of mutated attribute will be replaced by morphTo for `gen:model`.
|
||||||
- [#2546](https://github.com/hyperf/hyperf/pull/2546) Fixed db connection don't destruct when using left join.
|
- [#2546](https://github.com/hyperf/hyperf/pull/2546) Fixed db connection don't destruct when using left join.
|
||||||
|
|
||||||
|
## Optimized
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) Optimized exception and test cases for grpc-client.
|
||||||
|
|
||||||
# v2.0.11 - 2020-09-14
|
# v2.0.11 - 2020-09-14
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
# Changelogs
|
# Changelogs
|
||||||
|
|
||||||
|
# v2.0.12 - 2020-09-21
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- [#2512](https://github.com/hyperf/hyperf/pull/2512) Added `column_type` for `MySqlGrammar::compileColumnListing`.
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) Fixed streaming grpc-client does not works.
|
||||||
|
- [#2509](https://github.com/hyperf/hyperf/pull/2509) Fixed mutated attributes do not work in camel case for `hyperf/database`.
|
||||||
|
- [#2535](https://github.com/hyperf/hyperf/pull/2535) Fixed `@property` of mutated attribute will be replaced by morphTo for `gen:model`.
|
||||||
|
- [#2546](https://github.com/hyperf/hyperf/pull/2546) Fixed db connection don't destruct when using left join.
|
||||||
|
|
||||||
|
## Optimized
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) Optimized exception and test cases for grpc-client.
|
||||||
|
|
||||||
# v2.0.11 - 2020-09-14
|
# v2.0.11 - 2020-09-14
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
# 版本更新记录
|
# 版本更新记录
|
||||||
|
|
||||||
|
# v2.0.12 - 2020-09-21
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- [#2512](https://github.com/hyperf/hyperf/pull/2512) 为 [hyperf/database](https://github.com/hyperf/database) 组件方法 `MySqlGrammar::compileColumnListing` 新增返回字段 `column_type`。
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) 修复 [hyperf/grpc-client](https://github.com/hyperf/grpc-client) 组件中,流式客户端无法正常工作的问题。
|
||||||
|
- [#2509](https://github.com/hyperf/hyperf/pull/2509) 修复 [hyperf/database](https://github.com/hyperf/database) 组件中,使用小驼峰模式后,访问器无法正常工作的问题。
|
||||||
|
- [#2535](https://github.com/hyperf/hyperf/pull/2535) 修复 [hyperf/database](https://github.com/hyperf/database) 组件中,使用 `gen:model` 后,通过访问器生成的注释 `@property` 会被 `morphTo` 覆盖的问题。
|
||||||
|
- [#2546](https://github.com/hyperf/hyperf/pull/2546) 修复 [hyperf/db-connection](https://github.com/hyperf/db-connection) 组件中,使用 `left join` 等复杂查询后,`MySQL` 连接无法正常释放的问题。
|
||||||
|
|
||||||
|
## Optimized
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) 优化 [hyperf/grpc-client](https://github.com/hyperf/grpc-client) 组件中的异常和单元测试。
|
||||||
|
|
||||||
# v2.0.11 - 2020-09-14
|
# v2.0.11 - 2020-09-14
|
||||||
|
|
||||||
## 新增
|
## 新增
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
- [hyperf/database](https://github.com/hyperf/database) Hyperf 官方提供的基於 Eloquent 衍生的數據庫 ORM,可複用於其它框架
|
- [hyperf/database](https://github.com/hyperf/database) Hyperf 官方提供的基於 Eloquent 衍生的數據庫 ORM,可複用於其它框架
|
||||||
- [hyperf/model](https://github.com/hyperf/model) Hyperf 官方提供的基於 [hyperf/database](https://github.com/hyperf/database) 組件的自動模型緩存組件
|
- [hyperf/model](https://github.com/hyperf/model) Hyperf 官方提供的基於 [hyperf/database](https://github.com/hyperf/database) 組件的自動模型緩存組件
|
||||||
- [reasno/fastmongo](https://github.com/Reasno/fastmongo) 基於 `hyperf/gotask` 實現的協程化 `MongoDB` 客户端
|
- [reasno/fastmongo](https://github.com/Reasno/fastmongo) 基於 `hyperf/gotask` 實現的協程化 `MongoDB` 客户端
|
||||||
|
- [hyperf-ext/translatable](https://github.com/hyperf-ext/translatable) 為模型提供多語言能力
|
||||||
|
|
||||||
## 依賴注入容器
|
## 依賴注入容器
|
||||||
|
|
||||||
@ -122,12 +123,15 @@
|
|||||||
- [mabu233/sdebug](https://github.com/mabu233/sdebug) 用於協助開發與調試,`xdebug`的協程改造版
|
- [mabu233/sdebug](https://github.com/mabu233/sdebug) 用於協助開發與調試,`xdebug`的協程改造版
|
||||||
- [firstphp/wsdebug](https://github.com/lamplife/wsdebug) 通過 `WebSocket` 實時觀測異常錯誤的開發調試組件
|
- [firstphp/wsdebug](https://github.com/lamplife/wsdebug) 通過 `WebSocket` 實時觀測異常錯誤的開發調試組件
|
||||||
- [qbhy/hyperf-multi-env](https://github.com/qbhy/hyperf-multi-env) 支持與 laravel 類似的多 env 配置文件功能,通過 `APP_ENV=testing` 可以加載 `.env.testing` 配置覆蓋默認的 `.env`
|
- [qbhy/hyperf-multi-env](https://github.com/qbhy/hyperf-multi-env) 支持與 laravel 類似的多 env 配置文件功能,通過 `APP_ENV=testing` 可以加載 `.env.testing` 配置覆蓋默認的 `.env`
|
||||||
|
- [qiutuleng/hyperf-dump-server](https://github.com/qiutuleng/hyperf-dump-server) 提供一個 `dump` 函數,可以將程序內的變量或數據打印到另一個命令行窗口中,基於 Symfony 的 `Var-Dump Server` 組件
|
||||||
|
|
||||||
## 權限認證
|
## 權限認證
|
||||||
|
|
||||||
- [donjan-deng/hyperf-permission](https://github.com/donjan-deng/hyperf-permission) 基於 [spatie/laravel-permission](https://github.com/spatie/laravel-permission) 開發的適配 Hyperf 的權限組件
|
- [donjan-deng/hyperf-permission](https://github.com/donjan-deng/hyperf-permission) 基於 [spatie/laravel-permission](https://github.com/spatie/laravel-permission) 開發的適配 Hyperf 的權限組件
|
||||||
- [fx/hyperf-http-auth](https://github.com/nfangxu/hyperf-http-auth) 根據 laravel 中的 auth 組件改寫的, 適配 hyperf 框架
|
- [fx/hyperf-http-auth](https://github.com/nfangxu/hyperf-http-auth) 根據 laravel 中的 auth 組件改寫的, 適配 hyperf 框架
|
||||||
- [96qbhy/hyperf-auth](https://github.com/qbhy/hyperf-auth) 參考 laravel 的 auth 組件設計,支持 jwt 和 session 驅動,更輕巧更好用
|
- [96qbhy/hyperf-auth](https://github.com/qbhy/hyperf-auth) 參考 laravel 的 auth 組件設計,支持 jwt 和 session 驅動,更輕巧更好用
|
||||||
|
- [hyperf-ext/jwt](https://github.com/hyperf-ext/jwt) JWT 組件,實現了完整用於 JWT 認證的能力
|
||||||
|
- [hyperf-ext/auth](https://github.com/hyperf-ext/auth) 移植自 `illuminate/auth`,基本完整的實現了 Laravel Auth 的功能特性
|
||||||
|
|
||||||
## 第三方 SDK
|
## 第三方 SDK
|
||||||
|
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
# 版本更新記錄
|
# 版本更新記錄
|
||||||
|
|
||||||
|
# v2.0.12 - 2020-09-21
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- [#2512](https://github.com/hyperf/hyperf/pull/2512) 為 [hyperf/database](https://github.com/hyperf/database) 組件方法 `MySqlGrammar::compileColumnListing` 新增返回字段 `column_type`。
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) 修復 [hyperf/grpc-client](https://github.com/hyperf/grpc-client) 組件中,流式客户端無法正常工作的問題。
|
||||||
|
- [#2509](https://github.com/hyperf/hyperf/pull/2509) 修復 [hyperf/database](https://github.com/hyperf/database) 組件中,使用小駝峯模式後,訪問器無法正常工作的問題。
|
||||||
|
- [#2535](https://github.com/hyperf/hyperf/pull/2535) 修復 [hyperf/database](https://github.com/hyperf/database) 組件中,使用 `gen:model` 後,通過訪問器生成的註釋 `@property` 會被 `morphTo` 覆蓋的問題。
|
||||||
|
- [#2546](https://github.com/hyperf/hyperf/pull/2546) 修復 [hyperf/db-connection](https://github.com/hyperf/db-connection) 組件中,使用 `left join` 等複雜查詢後,`MySQL` 連接無法正常釋放的問題。
|
||||||
|
|
||||||
|
## Optimized
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) 優化 [hyperf/grpc-client](https://github.com/hyperf/grpc-client) 組件中的異常和單元測試。
|
||||||
|
|
||||||
# v2.0.11 - 2020-09-14
|
# v2.0.11 - 2020-09-14
|
||||||
|
|
||||||
## 新增
|
## 新增
|
||||||
@ -29,7 +46,7 @@
|
|||||||
## 新增
|
## 新增
|
||||||
|
|
||||||
- [#2411](https://github.com/hyperf/hyperf/pull/2411) 為 [hyperf/database](https://github.com/hyperf/database) 組件新增 `Hyperf\Database\Query\Builder::forPageBeforeId` 方法。
|
- [#2411](https://github.com/hyperf/hyperf/pull/2411) 為 [hyperf/database](https://github.com/hyperf/database) 組件新增 `Hyperf\Database\Query\Builder::forPageBeforeId` 方法。
|
||||||
- [#2420](https://github.com/hyperf/hyperf/pull/2420) 為 [#2426](https://github.com/hyperf/hyperf/pull/2426) [hyperf/command](https://github.com/hyperf/command) 組件新增默認選項 `enable-event-dispatcher` 用於初始化事件觸發器。
|
- [#2420](https://github.com/hyperf/hyperf/pull/2420) [#2426](https://github.com/hyperf/hyperf/pull/2426) 為 [hyperf/command](https://github.com/hyperf/command) 組件新增默認選項 `enable-event-dispatcher` 用於初始化事件觸發器。
|
||||||
- [#2433](https://github.com/hyperf/hyperf/pull/2433) 為 [hyperf/grpc-server](https://github.com/hyperf/grpc-server) 組件路由新增匿名函數支持。
|
- [#2433](https://github.com/hyperf/hyperf/pull/2433) 為 [hyperf/grpc-server](https://github.com/hyperf/grpc-server) 組件路由新增匿名函數支持。
|
||||||
- [#2441](https://github.com/hyperf/hyperf/pull/2441) 為 [hyperf/socketio-server](https://github.com/hyperf/socketio-server) 組件中 `SocketIO` 新增了一些 `setters`。
|
- [#2441](https://github.com/hyperf/hyperf/pull/2441) 為 [hyperf/socketio-server](https://github.com/hyperf/socketio-server) 組件中 `SocketIO` 新增了一些 `setters`。
|
||||||
|
|
||||||
|
@ -190,3 +190,17 @@ foreach ($books as $book){
|
|||||||
var_dump($book->user);
|
var_dump($book->user);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 緩存適配器
|
||||||
|
|
||||||
|
您可以根據自己的實際情況實現緩存適配器,只需要實現接口 `Hyperf\ModelCache\Handler\HandlerInterface` 即可。
|
||||||
|
|
||||||
|
框架提供了兩個 Handler 可供選擇:
|
||||||
|
|
||||||
|
- Hyperf\ModelCache\Handler\RedisHandler
|
||||||
|
|
||||||
|
使用 `HASH` 存儲緩存,可以有效的處理 `Model::increament()`,不足是因為數據類型只有 `String`,所以對 `null` 支持較差。
|
||||||
|
|
||||||
|
- Hyperf\ModelCache\Handler\RedisStringHandler
|
||||||
|
|
||||||
|
使用 `String` 存儲緩存,因為是序列化的數據,所以支持所有數據類型,不足是無法有效處理 `Model::increament()`,當模型調用累加時,通過刪除緩存,解決一致性的問題。
|
||||||
|
@ -129,6 +129,7 @@ gRPC server 如何進行 gRPC 響應, 相信你可以根據上面的信息, 自
|
|||||||
```php
|
```php
|
||||||
public function hello()
|
public function hello()
|
||||||
{
|
{
|
||||||
|
// 這個client是協程安全的,可以複用
|
||||||
$client = new \App\Grpc\HiClient('127.0.0.1:9503', [
|
$client = new \App\Grpc\HiClient('127.0.0.1:9503', [
|
||||||
'credentials' => null,
|
'credentials' => null,
|
||||||
]);
|
]);
|
||||||
@ -166,6 +167,28 @@ class HiClient extends BaseClient
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
gRPC客户端還支持 gRPC 的 Streaming 模式。以雙向流為例:
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?
|
||||||
|
public function hello()
|
||||||
|
{
|
||||||
|
$client = new RouteGuideClient('127.0.0.1:50051');
|
||||||
|
|
||||||
|
$note = new RouteNote();
|
||||||
|
|
||||||
|
$call = $client->routeChat();
|
||||||
|
$call->push($note);
|
||||||
|
$call->push($note);
|
||||||
|
|
||||||
|
/** @var RouteNote $note */
|
||||||
|
[$note,] = $call->recv();
|
||||||
|
[$note,] = $call->recv();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> 請注意在 streaming 模式下,您必須手動捕獲連接斷開的異常 (`Hyperf\GrpcClient\Exception\GrpcClientException`) 並根據需要選擇是否重試。
|
||||||
|
|
||||||
## 寫在後面
|
## 寫在後面
|
||||||
|
|
||||||
如果你是 gRPC 的重度使用者, 歡迎關注 hyperf 的後續開發者工具, 可以根據 .proto 文件生成全套 gRPC 代碼.
|
如果你是 gRPC 的重度使用者, 歡迎關注 hyperf 的後續開發者工具, 可以根據 .proto 文件生成全套 gRPC 代碼.
|
||||||
|
@ -338,6 +338,58 @@ docker run --rm -i -v $basepath/.env:/opt/www/.env \
|
|||||||
/opt/www/bin/hyperf.php your_command
|
/opt/www/bin/hyperf.php your_command
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 內核優化
|
||||||
|
|
||||||
|
> 本小節內容,有待驗證,謹慎使用
|
||||||
|
|
||||||
|
安裝 `KONG` 網關時,有介紹 `Ingress 網絡` 存在設計的缺陷,這塊可以通過 `優化內核` 處理。
|
||||||
|
|
||||||
|
- 指定 TLinux 源
|
||||||
|
|
||||||
|
```
|
||||||
|
tee /etc/yum.repos.d/CentOS-TLinux.repo <<-'EOF'
|
||||||
|
[Tlinux]
|
||||||
|
name=Tlinux for redhat/centos $releasever - $basearch
|
||||||
|
failovermethod=priority
|
||||||
|
gpgcheck=0
|
||||||
|
gpgkey=http://mirrors.tencentyun.com/epel/RPM-GPG-KEY-EPEL-7
|
||||||
|
enabled=1
|
||||||
|
baseurl=https://mirrors.tencent.com/tlinux/2.4/tlinux/x86_64/
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
- 安裝指定內核
|
||||||
|
|
||||||
|
```
|
||||||
|
yum -y install kernel-devel-4.14.105-19.0012.tl2.x86_64 kernel-4.14.105-19.0013.tl2.x86_64 kernel-headers-4.14.105-19.0013.tl2.x86_64
|
||||||
|
```
|
||||||
|
|
||||||
|
- 使內核生效
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
|
||||||
|
grub2-set-default 0
|
||||||
|
grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||||
|
```
|
||||||
|
|
||||||
|
- 重啟機器
|
||||||
|
|
||||||
|
```
|
||||||
|
reboot
|
||||||
|
```
|
||||||
|
|
||||||
|
### 容器參數優化
|
||||||
|
|
||||||
|
> 需要 Docker 19.09.0 以上支持,與 image 配置同級
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
sysctls:
|
||||||
|
# 網絡連接複用模式的選擇
|
||||||
|
- net.ipv4.vs.conn_reuse_mode=0
|
||||||
|
# 當LVS轉發數據包,發現目的RS無效(刪除)時,會丟棄該數據包,但不刪除相應連接。值為1時,則馬上釋放相應連接
|
||||||
|
- net.ipv4.vs.expire_nodest_conn=1
|
||||||
|
```
|
||||||
|
|
||||||
## 常見問題
|
## 常見問題
|
||||||
|
|
||||||
### fatal: git fetch-pack: expected shallow list
|
### fatal: git fetch-pack: expected shallow list
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
- [hyperf/database](https://github.com/hyperf/database) Hyperf 官方提供的基於 Eloquent 衍生的資料庫 ORM,可複用於其它框架
|
- [hyperf/database](https://github.com/hyperf/database) Hyperf 官方提供的基於 Eloquent 衍生的資料庫 ORM,可複用於其它框架
|
||||||
- [hyperf/model](https://github.com/hyperf/model) Hyperf 官方提供的基於 [hyperf/database](https://github.com/hyperf/database) 元件的自動模型快取元件
|
- [hyperf/model](https://github.com/hyperf/model) Hyperf 官方提供的基於 [hyperf/database](https://github.com/hyperf/database) 元件的自動模型快取元件
|
||||||
- [reasno/fastmongo](https://github.com/Reasno/fastmongo) 基於 `hyperf/gotask` 實現的協程化 `MongoDB` 客戶端
|
- [reasno/fastmongo](https://github.com/Reasno/fastmongo) 基於 `hyperf/gotask` 實現的協程化 `MongoDB` 客戶端
|
||||||
|
- [hyperf-ext/translatable](https://github.com/hyperf-ext/translatable) 為模型提供多語言能力
|
||||||
|
|
||||||
## 依賴注入容器
|
## 依賴注入容器
|
||||||
|
|
||||||
@ -122,12 +123,15 @@
|
|||||||
- [mabu233/sdebug](https://github.com/mabu233/sdebug) 用於協助開發與除錯,`xdebug`的協程改造版
|
- [mabu233/sdebug](https://github.com/mabu233/sdebug) 用於協助開發與除錯,`xdebug`的協程改造版
|
||||||
- [firstphp/wsdebug](https://github.com/lamplife/wsdebug) 通過 `WebSocket` 實時觀測異常錯誤的開發除錯元件
|
- [firstphp/wsdebug](https://github.com/lamplife/wsdebug) 通過 `WebSocket` 實時觀測異常錯誤的開發除錯元件
|
||||||
- [qbhy/hyperf-multi-env](https://github.com/qbhy/hyperf-multi-env) 支援與 laravel 類似的多 env 配置檔案功能,通過 `APP_ENV=testing` 可以載入 `.env.testing` 配置覆蓋預設的 `.env`
|
- [qbhy/hyperf-multi-env](https://github.com/qbhy/hyperf-multi-env) 支援與 laravel 類似的多 env 配置檔案功能,通過 `APP_ENV=testing` 可以載入 `.env.testing` 配置覆蓋預設的 `.env`
|
||||||
|
- [qiutuleng/hyperf-dump-server](https://github.com/qiutuleng/hyperf-dump-server) 提供一個 `dump` 函式,可以將程式內的變數或資料列印到另一個命令列視窗中,基於 Symfony 的 `Var-Dump Server` 元件
|
||||||
|
|
||||||
## 許可權認證
|
## 許可權認證
|
||||||
|
|
||||||
- [donjan-deng/hyperf-permission](https://github.com/donjan-deng/hyperf-permission) 基於 [spatie/laravel-permission](https://github.com/spatie/laravel-permission) 開發的適配 Hyperf 的許可權元件
|
- [donjan-deng/hyperf-permission](https://github.com/donjan-deng/hyperf-permission) 基於 [spatie/laravel-permission](https://github.com/spatie/laravel-permission) 開發的適配 Hyperf 的許可權元件
|
||||||
- [fx/hyperf-http-auth](https://github.com/nfangxu/hyperf-http-auth) 根據 laravel 中的 auth 元件改寫的, 適配 hyperf 框架
|
- [fx/hyperf-http-auth](https://github.com/nfangxu/hyperf-http-auth) 根據 laravel 中的 auth 元件改寫的, 適配 hyperf 框架
|
||||||
- [96qbhy/hyperf-auth](https://github.com/qbhy/hyperf-auth) 參考 laravel 的 auth 元件設計,支援 jwt 和 session 驅動,更輕巧更好用
|
- [96qbhy/hyperf-auth](https://github.com/qbhy/hyperf-auth) 參考 laravel 的 auth 元件設計,支援 jwt 和 session 驅動,更輕巧更好用
|
||||||
|
- [hyperf-ext/jwt](https://github.com/hyperf-ext/jwt) JWT 元件,實現了完整用於 JWT 認證的能力
|
||||||
|
- [hyperf-ext/auth](https://github.com/hyperf-ext/auth) 移植自 `illuminate/auth`,基本完整的實現了 Laravel Auth 的功能特性
|
||||||
|
|
||||||
## 第三方 SDK
|
## 第三方 SDK
|
||||||
|
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
# 版本更新記錄
|
# 版本更新記錄
|
||||||
|
|
||||||
|
# v2.0.12 - 2020-09-21
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- [#2512](https://github.com/hyperf/hyperf/pull/2512) 為 [hyperf/database](https://github.com/hyperf/database) 元件方法 `MySqlGrammar::compileColumnListing` 新增返回欄位 `column_type`。
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) 修復 [hyperf/grpc-client](https://github.com/hyperf/grpc-client) 元件中,流式客戶端無法正常工作的問題。
|
||||||
|
- [#2509](https://github.com/hyperf/hyperf/pull/2509) 修復 [hyperf/database](https://github.com/hyperf/database) 元件中,使用小駝峰模式後,訪問器無法正常工作的問題。
|
||||||
|
- [#2535](https://github.com/hyperf/hyperf/pull/2535) 修復 [hyperf/database](https://github.com/hyperf/database) 元件中,使用 `gen:model` 後,通過訪問器生成的註釋 `@property` 會被 `morphTo` 覆蓋的問題。
|
||||||
|
- [#2546](https://github.com/hyperf/hyperf/pull/2546) 修復 [hyperf/db-connection](https://github.com/hyperf/db-connection) 元件中,使用 `left join` 等複雜查詢後,`MySQL` 連線無法正常釋放的問題。
|
||||||
|
|
||||||
|
## Optimized
|
||||||
|
|
||||||
|
- [#2490](https://github.com/hyperf/hyperf/pull/2490) 優化 [hyperf/grpc-client](https://github.com/hyperf/grpc-client) 元件中的異常和單元測試。
|
||||||
|
|
||||||
# v2.0.11 - 2020-09-14
|
# v2.0.11 - 2020-09-14
|
||||||
|
|
||||||
## 新增
|
## 新增
|
||||||
@ -29,7 +46,7 @@
|
|||||||
## 新增
|
## 新增
|
||||||
|
|
||||||
- [#2411](https://github.com/hyperf/hyperf/pull/2411) 為 [hyperf/database](https://github.com/hyperf/database) 元件新增 `Hyperf\Database\Query\Builder::forPageBeforeId` 方法。
|
- [#2411](https://github.com/hyperf/hyperf/pull/2411) 為 [hyperf/database](https://github.com/hyperf/database) 元件新增 `Hyperf\Database\Query\Builder::forPageBeforeId` 方法。
|
||||||
- [#2420](https://github.com/hyperf/hyperf/pull/2420) 為 [#2426](https://github.com/hyperf/hyperf/pull/2426) [hyperf/command](https://github.com/hyperf/command) 元件新增預設選項 `enable-event-dispatcher` 用於初始化事件觸發器。
|
- [#2420](https://github.com/hyperf/hyperf/pull/2420) [#2426](https://github.com/hyperf/hyperf/pull/2426) 為 [hyperf/command](https://github.com/hyperf/command) 元件新增預設選項 `enable-event-dispatcher` 用於初始化事件觸發器。
|
||||||
- [#2433](https://github.com/hyperf/hyperf/pull/2433) 為 [hyperf/grpc-server](https://github.com/hyperf/grpc-server) 元件路由新增匿名函式支援。
|
- [#2433](https://github.com/hyperf/hyperf/pull/2433) 為 [hyperf/grpc-server](https://github.com/hyperf/grpc-server) 元件路由新增匿名函式支援。
|
||||||
- [#2441](https://github.com/hyperf/hyperf/pull/2441) 為 [hyperf/socketio-server](https://github.com/hyperf/socketio-server) 元件中 `SocketIO` 新增了一些 `setters`。
|
- [#2441](https://github.com/hyperf/hyperf/pull/2441) 為 [hyperf/socketio-server](https://github.com/hyperf/socketio-server) 元件中 `SocketIO` 新增了一些 `setters`。
|
||||||
|
|
||||||
|
@ -190,3 +190,17 @@ foreach ($books as $book){
|
|||||||
var_dump($book->user);
|
var_dump($book->user);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 快取介面卡
|
||||||
|
|
||||||
|
您可以根據自己的實際情況實現快取介面卡,只需要實現介面 `Hyperf\ModelCache\Handler\HandlerInterface` 即可。
|
||||||
|
|
||||||
|
框架提供了兩個 Handler 可供選擇:
|
||||||
|
|
||||||
|
- Hyperf\ModelCache\Handler\RedisHandler
|
||||||
|
|
||||||
|
使用 `HASH` 儲存快取,可以有效的處理 `Model::increament()`,不足是因為資料型別只有 `String`,所以對 `null` 支援較差。
|
||||||
|
|
||||||
|
- Hyperf\ModelCache\Handler\RedisStringHandler
|
||||||
|
|
||||||
|
使用 `String` 儲存快取,因為是序列化的資料,所以支援所有資料型別,不足是無法有效處理 `Model::increament()`,當模型呼叫累加時,通過刪除快取,解決一致性的問題。
|
||||||
|
@ -129,6 +129,7 @@ gRPC server 如何進行 gRPC 響應, 相信你可以根據上面的資訊, 自
|
|||||||
```php
|
```php
|
||||||
public function hello()
|
public function hello()
|
||||||
{
|
{
|
||||||
|
// 這個client是協程安全的,可以複用
|
||||||
$client = new \App\Grpc\HiClient('127.0.0.1:9503', [
|
$client = new \App\Grpc\HiClient('127.0.0.1:9503', [
|
||||||
'credentials' => null,
|
'credentials' => null,
|
||||||
]);
|
]);
|
||||||
@ -166,6 +167,28 @@ class HiClient extends BaseClient
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
gRPC客戶端還支援 gRPC 的 Streaming 模式。以雙向流為例:
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?
|
||||||
|
public function hello()
|
||||||
|
{
|
||||||
|
$client = new RouteGuideClient('127.0.0.1:50051');
|
||||||
|
|
||||||
|
$note = new RouteNote();
|
||||||
|
|
||||||
|
$call = $client->routeChat();
|
||||||
|
$call->push($note);
|
||||||
|
$call->push($note);
|
||||||
|
|
||||||
|
/** @var RouteNote $note */
|
||||||
|
[$note,] = $call->recv();
|
||||||
|
[$note,] = $call->recv();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> 請注意在 streaming 模式下,您必須手動捕獲連線斷開的異常 (`Hyperf\GrpcClient\Exception\GrpcClientException`) 並根據需要選擇是否重試。
|
||||||
|
|
||||||
## 寫在後面
|
## 寫在後面
|
||||||
|
|
||||||
如果你是 gRPC 的重度使用者, 歡迎關注 hyperf 的後續開發者工具, 可以根據 .proto 檔案生成全套 gRPC 程式碼.
|
如果你是 gRPC 的重度使用者, 歡迎關注 hyperf 的後續開發者工具, 可以根據 .proto 檔案生成全套 gRPC 程式碼.
|
||||||
|
@ -338,6 +338,58 @@ docker run --rm -i -v $basepath/.env:/opt/www/.env \
|
|||||||
/opt/www/bin/hyperf.php your_command
|
/opt/www/bin/hyperf.php your_command
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 核心優化
|
||||||
|
|
||||||
|
> 本小節內容,有待驗證,謹慎使用
|
||||||
|
|
||||||
|
安裝 `KONG` 閘道器時,有介紹 `Ingress 網路` 存在設計的缺陷,這塊可以通過 `優化核心` 處理。
|
||||||
|
|
||||||
|
- 指定 TLinux 源
|
||||||
|
|
||||||
|
```
|
||||||
|
tee /etc/yum.repos.d/CentOS-TLinux.repo <<-'EOF'
|
||||||
|
[Tlinux]
|
||||||
|
name=Tlinux for redhat/centos $releasever - $basearch
|
||||||
|
failovermethod=priority
|
||||||
|
gpgcheck=0
|
||||||
|
gpgkey=http://mirrors.tencentyun.com/epel/RPM-GPG-KEY-EPEL-7
|
||||||
|
enabled=1
|
||||||
|
baseurl=https://mirrors.tencent.com/tlinux/2.4/tlinux/x86_64/
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
- 安裝指定核心
|
||||||
|
|
||||||
|
```
|
||||||
|
yum -y install kernel-devel-4.14.105-19.0012.tl2.x86_64 kernel-4.14.105-19.0013.tl2.x86_64 kernel-headers-4.14.105-19.0013.tl2.x86_64
|
||||||
|
```
|
||||||
|
|
||||||
|
- 使核心生效
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
|
||||||
|
grub2-set-default 0
|
||||||
|
grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||||
|
```
|
||||||
|
|
||||||
|
- 重啟機器
|
||||||
|
|
||||||
|
```
|
||||||
|
reboot
|
||||||
|
```
|
||||||
|
|
||||||
|
### 容器引數優化
|
||||||
|
|
||||||
|
> 需要 Docker 19.09.0 以上支援,與 image 配置同級
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
sysctls:
|
||||||
|
# 網路連線複用模式的選擇
|
||||||
|
- net.ipv4.vs.conn_reuse_mode=0
|
||||||
|
# 當LVS轉發資料包,發現目的RS無效(刪除)時,會丟棄該資料包,但不刪除相應連線。值為1時,則馬上釋放相應連線
|
||||||
|
- net.ipv4.vs.expire_nodest_conn=1
|
||||||
|
```
|
||||||
|
|
||||||
## 常見問題
|
## 常見問題
|
||||||
|
|
||||||
### fatal: git fetch-pack: expected shallow list
|
### fatal: git fetch-pack: expected shallow list
|
||||||
|
Loading…
Reference in New Issue
Block a user