Skip to content

Commit 3dee8ca

Browse files
committed
Update En Docs
1 parent c34fd98 commit 3dee8ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+496
-374
lines changed

en/components/amqp-job.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
## Introduction
44

5-
`friendsofhyperf/amqp-job` is an asynchronous job component based on the `hyperf/amqp` component. It supports dispatching jobs to an AMQP service and then consuming the jobs through consumers.
6-
It encapsulates the `hyperf/amqp` component and provides a more convenient way to dispatch and consume jobs.
5+
`friendsofhyperf/amqp-job` is an asynchronous task component built on the `hyperf/amqp` package. It supports distributing tasks to the AMQP service and consuming these tasks through consumers. It encapsulates the `hyperf/amqp` package and provides a more convenient way to distribute and consume tasks.
76

87
## Installation
98

@@ -13,7 +12,7 @@ composer require friendsofhyperf/amqp-job
1312

1413
## Usage
1514

16-
### Dispatch Job
15+
### Dispatching Tasks
1716

1817
```php
1918
use FriendsOfHyperf\AmqpJob\Job;
@@ -38,9 +37,10 @@ class FooJob extends Job
3837
dispatch(new FooJob());
3938
```
4039

41-
### Register Consumer [Optional]
40+
### Registering a Consumer [Optional]
4241

4342
```php
43+
4444
namespace App\Amqp\Consumer;
4545

4646
use FriendsOfHyperf\AmqpJob\JobConsumer;
@@ -55,4 +55,6 @@ use Hyperf\Amqp\Annotation\Consumer;
5555
)]
5656
class MyConsumer extends JobConsumer
5757
{
58+
//
5859
}
60+
```

en/components/cache.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Cache
22

3+
## Introduction
4+
5+
`friendsofhyperf/cache` is a component based on `hyperf/cache`. It provides additional simplified extension methods.
6+
37
## Installation
48

59
```shell
@@ -8,7 +12,7 @@ composer require friendsofhyperf/cache
812

913
## Usage
1014

11-
### Annotation
15+
### Annotations
1216

1317
```php
1418
namespace App\Controller;
@@ -41,7 +45,7 @@ Cache::remember($key, $ttl=60, function() {
4145
});
4246
```
4347

44-
### Switch Driver
48+
### Switching Drivers
4549

4650
```php
4751
use FriendsOfHyperf\Cache\Facade\Cache;
@@ -55,3 +59,7 @@ di(CacheManager::class)->store('co')->remember($key, $ttl=60, function() {
5559
// return sth
5660
});
5761
```
62+
63+
## References
64+
65+
Similar to [Laravel-Cache](https://laravel.com/docs/8.x/cache)

en/components/command-signals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Command Signals
22

3-
The signals component for Hyperf Command.
3+
The signal handling component of Hyperf Command.
44

55
## Installation
66

@@ -47,7 +47,7 @@ class FooCommand extends HyperfCommand
4747
}
4848
```
4949

50-
## Running
50+
## Execution
5151

5252
- `Ctrl + C`
5353

@@ -62,4 +62,4 @@ $ hyperf foo
6262
$ hyperf foo
6363
Received signal 15, exiting...
6464
[1] 51936 terminated php bin/hyperf.php foo
65-
```
65+
```

en/components/command-validation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Command Validation
22

3-
The command validation component for Hyperf.
3+
Validation component for Hyperf command-line usage.
44

55
## Installation
66

@@ -27,7 +27,7 @@ class FooCommand extends HyperfCommand
2727
use ValidatesInput;
2828

2929
/**
30-
* The command to execute
30+
* The command line to execute
3131
*/
3232
protected string $name = 'foo:hello {?name : The name of the person to greet.}';
3333

@@ -50,3 +50,4 @@ class FooCommand extends HyperfCommand
5050
];
5151
}
5252
}
53+
```

en/components/compoships.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Compoships
22

3-
**Compoships** provides the ability to specify relationships based on two (or more) columns in Hyperf's Model ORM. The need to match multiple columns in Eloquent relationship definitions often arises when dealing with third-party or pre-existing schemas/databases.
3+
**Compoships** provides the ability to specify relationships in Hyperf's Model ORM based on two (or more) columns. This is commonly needed when working with third-party or pre-existing schemas/databases where relationships in Eloquent are defined by matching multiple columns.
44

5-
## Problem
5+
## Issue
66

7-
Eloquent doesn't support composite keys. Therefore, it's not possible to define a relationship from one model to another by matching multiple columns. Attempting to use a `where` clause (as shown in the example below) won't work with eager loading relationships because **$this->team_id** is null when processing the relationship.
7+
Eloquent does not support composite keys. As a result, it is not possible to define relationships from one model to another by matching multiple columns. Attempting to use a `where` clause (as shown below) will not work when eager-loading the relationship, because **$this->team_id** is null during relationship processing.
88

99
```php
1010
namespace App;
@@ -23,27 +23,27 @@ class User extends Model
2323

2424
## Installation
2525

26-
It's recommended to install **Compoships** component through [Composer](http://getcomposer.org/).
26+
It is recommended to install the **Compoships** package via [Composer](http://getcomposer.org/).
2727

2828
```shell
2929
composer require friendsofhyperf/compoships
3030
```
3131

3232
## Usage
3333

34-
### Using `FriendsOfHyperf\Compoships\Database\Eloquent\Model` Class
34+
### Using the `FriendsOfHyperf\Compoships\Database\Eloquent\Model` Class
3535

36-
Simply make your model class derive from the `FriendsOfHyperf\Compoships\Database\Eloquent\Model` base class. `FriendsOfHyperf\Compoships\Database\Eloquent\Model` extends the `Eloquent` base class without changing its core functionality.
36+
Simply extend your model class from the `FriendsOfHyperf\Compoships\Database\Eloquent\Model` base class. `FriendsOfHyperf\Compoships\Database\Eloquent\Model` extends the `Eloquent` base class without altering its core functionality.
3737

38-
### Using `FriendsOfHyperf\Compoships\Compoships` Trait
38+
### Using the `FriendsOfHyperf\Compoships\Compoships` Trait
3939

40-
If for some reason you can't derive your models from `FriendsOfHyperf\Compoships\Database\Eloquent\Model`, you can use the `FriendsOfHyperf\Compoships\Compoships` trait. Simply use this trait in your models.
40+
If, for some reason, you cannot extend your model from `FriendsOfHyperf\Compoships\Database\Eloquent\Model`, you can use the `FriendsOfHyperf\Compoships\Compoships` trait. Simply include the trait in your model.
4141

42-
**Note:** To define a multi-column relationship from model *A* to another model *B*, **both models must extend `FriendsOfHyperf\Compoships\Database\Eloquent\Model` or use the `FriendsOfHyperf\Compoships\Compoships` trait**
42+
**Note:** To define multi-column relationships from model *A* to another model *B*, **both models must either extend `FriendsOfHyperf\Compoships\Database\Eloquent\Model` or use the `FriendsOfHyperf\Compoships\Compoships` trait**.
4343

44-
### Usage
44+
### How It Works
4545

46-
... Now we can define relationships from model *A* to another model *B* by matching two or more columns (by passing arrays of columns instead of a string).
46+
... Now we can define relationships from model *A* to another model *B* by matching two or more columns (by passing an array of columns instead of a string).
4747

4848
```php
4949
namespace App;
@@ -61,7 +61,7 @@ class A extends Model
6161
}
6262
```
6363

64-
We can use the same syntax to define the inverse of the relationship:
64+
We can use the same syntax to define the inverse relationship:
6565

6666
```php
6767
namespace App;
@@ -81,15 +81,15 @@ class B extends Model
8181

8282
### Example
8383

84-
As an example, let's say we have a task list with categories managed by multiple user teams where:
84+
For example, suppose we have a task list with categories that are managed by multiple user teams, where:
8585

8686
- A task belongs to a category
8787
- A task is assigned to a team
8888
- A team has many users
8989
- A user belongs to a team
9090
- A user is responsible for tasks in a category
9191

92-
The user responsible for a specific task is the user currently responsible for that category within their team.
92+
The user responsible for a specific task is the current user in charge of that category within the team.
9393

9494
```php
9595
namespace App;
@@ -107,7 +107,7 @@ class User extends Model
107107
}
108108
```
109109

110-
The same syntax can be used to define the inverse of the relationship:
110+
The same syntax applies to defining the inverse relationship:
111111

112112
```php
113113
namespace App;

en/components/confd.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Confd
22

3-
The confd component for Hyperf.
3+
The configuration management component for Hyperf.
44

55
## Installation
66

@@ -13,13 +13,13 @@ composer require friendsofhyperf/nacos
1313

1414
## Commands
1515

16-
Get configuration from `etcd/nacos` and update `.env`.
16+
Fetch configuration from `etcd/nacos` and update the `.env` file.
1717

1818
```shell
1919
php bin/hyperf.php confd:env
2020
```
2121

22-
## Define Listener
22+
## Define a Listener
2323

2424
```php
2525
<?php
@@ -48,7 +48,7 @@ class ConfigChangedListener implements ListenerInterface
4848
public function process(object $event): void
4949
{
5050
$this->logger->warning('[confd] ConfdChanged');
51-
// do something
51+
// Handle changes
5252
}
5353
}
5454
```
@@ -57,4 +57,4 @@ class ConfigChangedListener implements ListenerInterface
5757

5858
- [x] Etcd
5959
- [x] Nacos
60-
- [ ] Consul
60+
- [ ] Consul

en/components/config-consul.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Config Consul
22

3-
The consul config component for Hyperf.
3+
Consul configuration component for Hyperf.
44

55
## Installation
66

@@ -33,4 +33,4 @@ return [
3333
],
3434
],
3535
];
36-
```
36+
```

en/components/console-spinner.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Console Spinner
22

3-
The progress bar component For Hyperf.
3+
A progress bar component for the Hyperf framework.
44

55
## Installation
66

@@ -37,10 +37,10 @@ class FooCommand extends Command
3737
}
3838
```
3939

40-
The `$spinner` is compatible with Symfony ProgressBar, so you can run any method of this class. Alternatively, you can also use the `withSpinner` method by providing an iterable object.
40+
The `$spinner` is compatible with Symfony ProgressBar, so you can call any method of that class. Alternatively, you can use the `withSpinner` method by providing an iterable object.
4141

4242
```php
4343
$this->withSpinner(User::all(), function($user) {
4444
// Do your stuff with $user
4545
}, 'Loading...');
46-
```
46+
```

en/components/di-plus.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# DI Plus
22

3-
The di plus component for Hyperf.
3+
The dependency injection enhancement component for Hyperf.
44

55
## Installation
66

@@ -36,23 +36,25 @@ class Foo2
3636
{
3737
}
3838
}
39+
```
3940

40-
class Bar
41-
{
42-
}
41+
Support for annotation-based configuration:
42+
43+
```php
44+
<?php
45+
namespace App;
4346

44-
class BarAtFoo1Factory
47+
use Hyperf\Di\Annotation\Inject;
48+
49+
class Foo1
4550
{
46-
public function __invoke()
47-
{
48-
return new Bar();
49-
}
51+
#[Inject]
52+
public Bar $bar;
5053
}
5154

52-
class BarAtFoo2Factory
55+
class Foo2
5356
{
54-
public function __invoke()
55-
{
56-
return new Bar();
57-
}
57+
#[Inject]
58+
public Bar $bar;
5859
}
60+
```

en/components/elasticsearch.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Elasticsearch
22

3-
The Elasticsearch client for Hyperf.
3+
A customized Elasticsearch client component for Hyperf.
44

55
## Installation
66

@@ -25,4 +25,4 @@ class Foo
2525
// ...
2626
}
2727
}
28-
```
28+
```

0 commit comments

Comments
 (0)