Skip to content
33 changes: 22 additions & 11 deletions 014-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,37 @@ The guide should follow [Micosoft style guide](https://learn.microsoft.com/en-us

## Blocks

Blocks use the Markdown `> Type: `. There are four block types:
Blocks are in the [GitHub Alerts format](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts):

* `Warning`, for bad security things and other problems
* `Note`, to emphasize key concepts, things to avoid
* `Info`, general information (an aside); not as strong as a "Note"
* `Tip`, pro tips, extras. It can be useful but may not be needed by everyone all the time
```
> [!NOTE]
> Useful information that users should know, even when skimming content.

> [!TIP]
> Helpful advice for doing things better or more easily.

> [!IMPORTANT]
> Key information users need to know to achieve their goal.

The sentence after the colon should begin with a capital letter.
> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.

> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
```

When translating documentation, these Block indicators should not be translated.
Keeps them intact as they are and only translate the block content.
For translating the `Type` word, each guide translation should have a `blocktypes.json` file
For translating the label for the block, each guide translation should have a `blocktypes.json` file
containing the translations. The following shows an example for German:

```json
{
"Warning:": "Achtung:",
"Note:": "Hinweis:",
"Info:": "Info:",
"Tip:": "Tipp:"
"Note": "Hinweis",
"Tip": "Tipp",
"Important": "Wichtig",
"Warning": "Achtung",
"Caution": "Vorsicht"
}
```

Expand Down
3 changes: 2 additions & 1 deletion 015-phpstorm.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ We use the following set of coding styles for metadata.
- Metadata should be placed in `/.phpstorm.meta.php` directory.
- Configuration should be split into files. Each file should be named after a class it configures.

> Note: There is no support for subdirectories in PhpStorm yet.
> [!NOTE]
> There is no support for subdirectories in PhpStorm yet.

### Constants

Expand Down
1 change: 1 addition & 0 deletions cookbook/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ This book conforms to the [Terms of Yii Documentation](https://www.yiiframework.
- [Preface](preface.md)
- [Structuring code by use-case with vertical slices](organizing-code/structuring-by-use-case-with-vertical-slices.md)
- [Sentry integration](sentry-integration.md)
- [Configuring webservers](configuring-webservers/general.md)
46 changes: 46 additions & 0 deletions cookbook/en/configuring-webservers/apache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Configuring web servers: Apache

Use the following configuration in Apache's `httpd.conf` file or within a virtual host configuration. Note that you
should replace `path/to/app/public` with the actual path for `app/public`.

```apacheconfig
# Set document root to be "app/public"
DocumentRoot "path/to/app/public"

<Directory "path/to/app/public">
# use mod_rewrite for pretty URL support
RewriteEngine on

# if $showScriptName is false in UrlManager, do not allow accessing URLs with script name
RewriteRule ^index.php/ - [L,R=404]

# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Otherwise forward the request to index.php
RewriteRule . index.php

# ...other settings...
</Directory>
```

In case you have `AllowOverride All` you can add `.htaccess` file with the following configuration instead of
using `httpd.conf`:

```apacheconfig
# use mod_rewrite for pretty URL support
RewriteEngine on

# if $showScriptName is false in UrlManager, do not allow accessing URLs with script name
RewriteRule ^index.php/ - [L,R=404]

# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Otherwise forward the request to index.php
RewriteRule . index.php

# ...other settings...
```
16 changes: 16 additions & 0 deletions cookbook/en/configuring-webservers/general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Configuring web servers: General

On a production server, if you don't use Docker, configure your web server to serve only the application's public files.
Point the document root of your web server to the `app/public` folder.

> [!IMPORTANT]
> If you're running your Yii application behind a reverse proxy, you might need to configure
> [Trusted proxies and headers](../../../guide/en/security/trusted-request.md).

## Specific server configurations

- [Nginx](nginx.md)
- [Apache](apache.md)
- [Lighttpd](lighttpd.md)
- [Nginx Unit](nginx-unit.md)
- [IIS](iis.md)

Check notice on line 16 in cookbook/en/configuring-webservers/general.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/general.md#L16

[Microsoft.Acronyms] 'IIS' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'IIS' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/general.md", "range": {"start": {"line": 16, "column": 4}}}, "severity": "INFO"}
34 changes: 34 additions & 0 deletions cookbook/en/configuring-webservers/iis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Configuring web servers: IIS

Check warning on line 1 in cookbook/en/configuring-webservers/iis.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/iis.md#L1

[Microsoft.HeadingAcronyms] Avoid using acronyms in a title or heading.
Raw output
{"message": "[Microsoft.HeadingAcronyms] Avoid using acronyms in a title or heading.", "location": {"path": "cookbook/en/configuring-webservers/iis.md", "range": {"start": {"line": 1, "column": 28}}}, "severity": "WARNING"}

Check notice on line 1 in cookbook/en/configuring-webservers/iis.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/iis.md#L1

[Microsoft.Acronyms] 'IIS' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'IIS' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/iis.md", "range": {"start": {"line": 1, "column": 28}}}, "severity": "INFO"}

When you use [IIS](https://www.iis.net/), host the application in a virtual host (Website) where the document

Check notice on line 3 in cookbook/en/configuring-webservers/iis.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/iis.md#L3

[Microsoft.Acronyms] 'IIS' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'IIS' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/iis.md", "range": {"start": {"line": 3, "column": 15}}}, "severity": "INFO"}
root points to the `path/to/app/public` folder and configure the website to run PHP.
In that `public` folder, place a file named `web.config` at `path/to/app/public/web.config`.
Use the following content:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<rewrite>
<rules>
<rule name="Hide Yii Index" stopProcessing="true">
<match url="." ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile"
ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory"
ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
```

Also, the following list of Microsoft's official resources could be useful to configure PHP on IIS:

Check notice on line 31 in cookbook/en/configuring-webservers/iis.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/iis.md#L31

[Microsoft.Acronyms] 'IIS' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'IIS' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/iis.md", "range": {"start": {"line": 31, "column": 96}}}, "severity": "INFO"}

1. [How to set up your first IIS website](https://support.microsoft.com/en-us/help/323972/how-to-set-up-your-first-iis-web-site)

Check notice on line 33 in cookbook/en/configuring-webservers/iis.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/iis.md#L33

[Microsoft.Acronyms] 'IIS' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'IIS' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/iis.md", "range": {"start": {"line": 33, "column": 30}}}, "severity": "INFO"}
2. [Configure a PHP Website on IIS](https://docs.microsoft.com/en-us/iis/application-frameworks/scenario-build-a-php-website-on-iis/configure-a-php-website-on-iis)

Check notice on line 34 in cookbook/en/configuring-webservers/iis.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/iis.md#L34

[Microsoft.Acronyms] 'IIS' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'IIS' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/iis.md", "range": {"start": {"line": 34, "column": 32}}}, "severity": "INFO"}
7 changes: 7 additions & 0 deletions cookbook/en/configuring-webservers/lighttpd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Configuring web servers: lighttpd

Check notice on line 1 in cookbook/en/configuring-webservers/lighttpd.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/lighttpd.md#L1

[Microsoft.Headings] 'Configuring web servers: lighttpd' should use sentence-style capitalization.
Raw output
{"message": "[Microsoft.Headings] 'Configuring web servers: lighttpd' should use sentence-style capitalization.", "location": {"path": "cookbook/en/configuring-webservers/lighttpd.md", "range": {"start": {"line": 1, "column": 3}}}, "severity": "INFO"}

Check failure on line 1 in cookbook/en/configuring-webservers/lighttpd.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/lighttpd.md#L1

[Microsoft.HeadingColons] Capitalize ': l'.
Raw output
{"message": "[Microsoft.HeadingColons] Capitalize ': l'.", "location": {"path": "cookbook/en/configuring-webservers/lighttpd.md", "range": {"start": {"line": 1, "column": 26}}}, "severity": "ERROR"}

To use [lighttpd](https://www.lighttpd.net/) >= 1.4.24, put `index.php` in the web root and add the following to the configuration:

```
url.rewrite-if-not-file = ("(.*)" => "/index.php/$0")
```
60 changes: 60 additions & 0 deletions cookbook/en/configuring-webservers/nginx-unit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Configuring web servers: NGINX Unit

Check notice on line 1 in cookbook/en/configuring-webservers/nginx-unit.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/nginx-unit.md#L1

[Microsoft.Acronyms] 'NGINX' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'NGINX' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/nginx-unit.md", "range": {"start": {"line": 1, "column": 28}}}, "severity": "INFO"}

Run Yii-based apps using [NGINX Unit](https://unit.nginx.org/) with a PHP language module.

Check notice on line 3 in cookbook/en/configuring-webservers/nginx-unit.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/nginx-unit.md#L3

[Microsoft.Acronyms] 'NGINX' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'NGINX' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/nginx-unit.md", "range": {"start": {"line": 3, "column": 27}}}, "severity": "INFO"}
Here is a sample configuration.

Check notice on line 4 in cookbook/en/configuring-webservers/nginx-unit.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/nginx-unit.md#L4

[Microsoft.Vocab] Verify your use of 'sample' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'sample' with the A-Z word list.", "location": {"path": "cookbook/en/configuring-webservers/nginx-unit.md", "range": {"start": {"line": 4, "column": 11}}}, "severity": "INFO"}

```json
{
"listeners": {
"*:80": {
"pass": "routes/yii"
}
},

"routes": {
"yii": [
{
"match": {
"uri": [
"!/assets/*",
"*.php",
"*.php/*"
]
},

"action": {
"pass": "applications/yii/direct"
}
},
{
"action": {
"share": "/path/to/app/public/",
"fallback": {
"pass": "applications/yii/index"
}
}
}
]
},

"applications": {
"yii": {
"type": "php",
"user": "www-data",
"targets": {
"direct": {
"root": "/path/to/app/public/"
},

"index": {
"root": "/path/to/app/public/",
"script": "index.php"
}
}
}
}
}
```

You can also [set up](https://unit.nginx.org/configuration/#php) your PHP environment or supply a custom `php.ini`
in the same configuration.
56 changes: 56 additions & 0 deletions cookbook/en/configuring-webservers/nginx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Configuring web servers: Nginx

To use [Nginx](https://wiki.nginx.org/), install PHP as an [FPM SAPI](https://secure.php.net/install.fpm).

Check notice on line 3 in cookbook/en/configuring-webservers/nginx.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/nginx.md#L3

[Microsoft.Acronyms] 'FPM' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'FPM' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/nginx.md", "range": {"start": {"line": 3, "column": 61}}}, "severity": "INFO"}

Check notice on line 3 in cookbook/en/configuring-webservers/nginx.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/configuring-webservers/nginx.md#L3

[Microsoft.Acronyms] 'SAPI' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'SAPI' has no definition.", "location": {"path": "cookbook/en/configuring-webservers/nginx.md", "range": {"start": {"line": 3, "column": 65}}}, "severity": "INFO"}
Use the following Nginx configuration, replacing `path/to/app/public` with the actual path for
`app/public` and `mysite.test` with the actual hostname to serve.

```nginx
server {
charset utf-8;
client_max_body_size 128M;

listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6

server_name mysite.test;
root /path/to/app/public;
index index.php;

access_log /path/to/basic/log/access.log;
error_log /path/to/basic/log/error.log;

location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}

# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;

# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}

location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php8-fpm.sock;
try_files $uri =404;
}

location ~* /\. {
deny all;
}
}
```

When you use this configuration, also set `cgi.fix_pathinfo=0` in the `php.ini` file
to avoid many unnecessary system `stat()` calls.

Also, note that when running an HTTPS server, you need to add `fastcgi_param HTTPS on;` so that Yii
can detect if a connection is secure.
3 changes: 1 addition & 2 deletions cookbook/en/preface.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

Yii is a high-performance, package-based PHP framework for developing modern applications.
The name Yii (pronounced `Yee` or `[ji:]`) means "simple and evolutionary" in Chinese.
You can also think about it as an acronym for **Yes It Is**!

Check failure on line 5 in cookbook/en/preface.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/preface.md#L5

[Microsoft.Contractions] Use 'it's' instead of 'It Is'.
Raw output
{"message": "[Microsoft.Contractions] Use 'it's' instead of 'It Is'.", "location": {"path": "cookbook/en/preface.md", "range": {"start": {"line": 5, "column": 53}}}, "severity": "ERROR"}

Yii is a generic Web programming framework.
You can use it for developing all kinds of Web applications using PHP.
Because of its architecture and sophisticated caching support,
it's especially suitable for developing large-scale applications such as portals, content management systems,
e-commerce, REST APIs, etc.

Check notice on line 11 in cookbook/en/preface.md

View workflow job for this annotation

GitHub Actions / vale

[vale] cookbook/en/preface.md#L11

[Microsoft.Acronyms] 'REST' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'REST' has no definition.", "location": {"path": "cookbook/en/preface.md", "range": {"start": {"line": 11, "column": 13}}}, "severity": "INFO"}

Together with a comprehensive set of documentation and an enthusiastic user community, Yii can reduce your development
time in a long run significantly.
With comprehensive documentation and an enthusiastic user community, Yii can significantly reduce your development time in the long run.

## What's the book about

Expand Down
2 changes: 1 addition & 1 deletion guide/en/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The definitive guide to Yii 3.0

This guide is released under the [Terms of Yii Documentation](https://www.yiiframework.com/license#docs).
We release this guide under the [Terms of Yii Documentation](https://www.yiiframework.com/license#docs).

Check warning on line 3 in guide/en/README.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/README.md#L3

[Microsoft.We] Try to avoid using first-person plural like 'We'.
Raw output
{"message": "[Microsoft.We] Try to avoid using first-person plural like 'We'.", "location": {"path": "guide/en/README.md", "range": {"start": {"line": 3, "column": 1}}}, "severity": "WARNING"}

Introduction +
------------
Expand Down Expand Up @@ -46,7 +46,7 @@
Handling requests +
-----------------

* [Routing and URL generation](runtime/routing.md) +

Check warning on line 49 in guide/en/README.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/README.md#L49

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/README.md", "range": {"start": {"line": 49, "column": 16}}}, "severity": "WARNING"}
* [Request](runtime/request.md) +
* [Response](runtime/response.md) +
* [Sessions](runtime/sessions.md) +
Expand All @@ -71,7 +71,7 @@

* [Database access objects](db-dao.md): Connecting to a database, basic queries, transactions, and schema manipulation
* [Query builder](db-query-builder.md): Querying the database using a simple abstraction layer
* [Active record](db-active-record.md): The Active Record ORM, retrieving and manipulating records, and defining relations

Check notice on line 74 in guide/en/README.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/README.md#L74

[Microsoft.Acronyms] 'ORM' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'ORM' has no definition.", "location": {"path": "guide/en/README.md", "range": {"start": {"line": 74, "column": 59}}}, "severity": "INFO"}
* [Migrations](databases/db-migrations.md): +

Getting data from users -
Expand Down Expand Up @@ -113,7 +113,7 @@
* [HTTP caching](caching/http.md) -


REST APIs -

Check warning on line 116 in guide/en/README.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/README.md#L116

[Microsoft.HeadingAcronyms] Avoid using acronyms in a title or heading.
Raw output
{"message": "[Microsoft.HeadingAcronyms] Avoid using acronyms in a title or heading.", "location": {"path": "guide/en/README.md", "range": {"start": {"line": 116, "column": 1}}}, "severity": "WARNING"}

Check notice on line 116 in guide/en/README.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/README.md#L116

[Microsoft.Headings] 'REST APIs -' should use sentence-style capitalization.
Raw output
{"message": "[Microsoft.Headings] 'REST APIs -' should use sentence-style capitalization.", "location": {"path": "guide/en/README.md", "range": {"start": {"line": 116, "column": 1}}}, "severity": "INFO"}

Check notice on line 116 in guide/en/README.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/README.md#L116

[Microsoft.Acronyms] 'REST' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'REST' has no definition.", "location": {"path": "guide/en/README.md", "range": {"start": {"line": 116, "column": 1}}}, "severity": "INFO"}
-----------

* [Quick start](rest/quick-start.md)
Expand Down
3 changes: 2 additions & 1 deletion guide/en/caching/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,38 @@

## Cache handlers

The cache service uses [PSR-16](https://www.php-fig.org/psr/psr-16/) compatible cache handlers which represent various

Check notice on line 37 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L37

[Microsoft.Acronyms] 'PSR' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'PSR' has no definition.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 37, "column": 25}}}, "severity": "INFO"}
cache storages, such as memory, files, and databases.

Yii provides the following handlers:

- `NullCache` — a cache placeholder which does no real caching. The purpose of this handler is to simplify

Check failure on line 42 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L42

[Microsoft.Dashes] Remove the spaces around ' — '.
Raw output
{"message": "[Microsoft.Dashes] Remove the spaces around ' — '.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 42, "column": 14}}}, "severity": "ERROR"}
the code that needs to check the availability of cache. For example, during development or if the server doesn't have
actual cache support, you may configure a cache service to use this handler.
When you enable actual cache support, you can switch to using the corresponding cache handler.
In both cases, you may use the same code without extra checks.
- `ArrayCache` — provides caching for the current request only by storing the values in an array.

Check failure on line 47 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L47

[Microsoft.Dashes] Remove the spaces around ' — '.
Raw output
{"message": "[Microsoft.Dashes] Remove the spaces around ' — '.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 47, "column": 15}}}, "severity": "ERROR"}
- [APCu](https://github.com/yiisoft/cache-apcu) - uses a PHP [APC](https://secure.php.net/manual/en/book.apc.php) extension.

Check notice on line 48 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L48

[Microsoft.Acronyms] 'APC' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'APC' has no definition.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 48, "column": 63}}}, "severity": "INFO"}
You can consider this option as the fastest one when dealing with cache for a centralized thick application (e.g., one

Check failure on line 49 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L49

[Microsoft.Foreign] Use 'for example' instead of 'e.g.,'.
Raw output
{"message": "[Microsoft.Foreign] Use 'for example' instead of 'e.g.,'.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 49, "column": 112}}}, "severity": "ERROR"}
server, no dedicated load balancers, etc.).
- [Database](https://github.com/yiisoft/cache-db) — uses a database table to store cached data.

Check failure on line 51 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L51

[Microsoft.Dashes] Remove the spaces around ' — '.
Raw output
{"message": "[Microsoft.Dashes] Remove the spaces around ' — '.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 51, "column": 50}}}, "severity": "ERROR"}
- [File](https://github.com/yiisoft/cache-file) — uses standard files to store cached data. This is particularly suitable

Check failure on line 52 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L52

[Microsoft.Dashes] Remove the spaces around ' — '.
Raw output
{"message": "[Microsoft.Dashes] Remove the spaces around ' — '.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 52, "column": 48}}}, "severity": "ERROR"}
to cache large chunks of data, such as page content.
- [Memcached](https://github.com/yiisoft/cache-memcached) — uses a PHP [memcached](https://secure.php.net/manual/en/book.memcached.php)

Check failure on line 54 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L54

[Microsoft.Dashes] Remove the spaces around ' — '.
Raw output
{"message": "[Microsoft.Dashes] Remove the spaces around ' — '.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 54, "column": 58}}}, "severity": "ERROR"}
extension. You can consider this option as the fastest one when dealing with cache in distributed application
(e.g., with several servers, load balancers, etc.)

Check failure on line 56 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L56

[Microsoft.Foreign] Use 'for example' instead of 'e.g.,'.
Raw output
{"message": "[Microsoft.Foreign] Use 'for example' instead of 'e.g.,'.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 56, "column": 4}}}, "severity": "ERROR"}
- [Wincache](https://github.com/yiisoft/cache-wincache) — uses PHP [WinCache](https://iis.net/downloads/microsoft/wincache-extension)

Check failure on line 57 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L57

[Microsoft.Dashes] Remove the spaces around ' — '.
Raw output
{"message": "[Microsoft.Dashes] Remove the spaces around ' — '.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 57, "column": 56}}}, "severity": "ERROR"}
([see also](https://secure.php.net/manual/en/book.wincache.php)) extension.

[You could find more handlers at packagist.org](https://packagist.org/providers/psr/simple-cache-implementation).

> Tip: You may use different cache storage in the same application. A common strategy is:
> [!TIP]

Check notice on line 62 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L62

[Microsoft.Acronyms] 'TIP' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'TIP' has no definition.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 62, "column": 5}}}, "severity": "INFO"}
> You may use different cache storage in the same application. A common strategy is:
> - To use memory-based cache storage to store small but constantly used data (e.g., statistics)

Check failure on line 64 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L64

[Microsoft.Foreign] Use 'for example' instead of 'e.g.,'.
Raw output
{"message": "[Microsoft.Foreign] Use 'for example' instead of 'e.g.,'.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 64, "column": 80}}}, "severity": "ERROR"}
> - To use file-based or database-based cache storage to store big and less often used data (e.g., page content)

Check failure on line 65 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L65

[Microsoft.Foreign] Use 'for example' instead of 'e.g.,'.
Raw output
{"message": "[Microsoft.Foreign] Use 'for example' instead of 'e.g.,'.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 65, "column": 94}}}, "severity": "ERROR"}

Cache handlers are usually set up in a [dependency injection container](../concept/di-container.md) so that they can
be globally configurable and accessible.

Check notice on line 68 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L68

[Microsoft.Vocab] Verify your use of 'accessible' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'accessible' with the A-Z word list.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 68, "column": 30}}}, "severity": "INFO"}

Because all cache handlers support the same set of APIs, you can swap the underlying cache handler
with a different one. You can do it by reconfiguring the application without modifying the code that uses the cache.
Expand Down Expand Up @@ -93,7 +94,7 @@

A data item stored in a cache will remain there forever unless it's removed because of some caching policy
enforcement. For example, caching space is full and cache storage removes the oldest data.
To change this behavior, you can set a TTL parameter when calling a method to store a data item:

Check notice on line 97 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L97

[Microsoft.Acronyms] 'TTL' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'TTL' has no definition.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 97, "column": 40}}}, "severity": "INFO"}

```php
$ttl = 3600;
Expand All @@ -106,7 +107,7 @@
the data item, if it has passed the expiration time, the method will execute the function and set the resulting value
into cache.

You may set default TTL for the cache:

Check notice on line 110 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L110

[Microsoft.Acronyms] 'TTL' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'TTL' has no definition.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 110, "column": 21}}}, "severity": "INFO"}

```php
$cache = new \Yiisoft\Cache\Cache($arrayCache, 60 * 60); // 1 hour
Expand Down Expand Up @@ -151,7 +152,7 @@
is different.
- `\Yiisoft\Cache\Dependency\FileDependency`: invalidates the cache when the file's last modification time is different.
- `\Yiisoft\Cache\Dependency\TagDependency`: associates a cached data item with one or many tags. You may invalidate
the cached data items with the specified tag(s) by calling `TagDependency::invalidate()`.

Check failure on line 155 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L155

[Microsoft.Plurals] Don't add '(s)' to a singular noun. Use plural instead.
Raw output
{"message": "[Microsoft.Plurals] Don't add '(s)' to a singular noun. Use plural instead.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 155, "column": 47}}}, "severity": "ERROR"}

You may combine many dependencies using `\Yiisoft\Cache\Dependency\AnyDependency` or `\Yiisoft\Cache\Dependency\AllDependencies`.

Expand All @@ -164,8 +165,8 @@
This behavior is sometimes also called dog-piling.

The `\Yiisoft\Cache\Cache` uses a built-in "Probably early expiration" algorithm that prevents cache stampede.
This algorithm randomly fakes a cache miss for one user while others are still served the cached value.

Check warning on line 168 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L168

[Microsoft.Adverbs] Remove 'randomly' if it's not important to the meaning of the statement.
Raw output
{"message": "[Microsoft.Adverbs] Remove 'randomly' if it's not important to the meaning of the statement.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 168, "column": 16}}}, "severity": "WARNING"}
You can control its behavior with the fifth optional parameter of `getOrSet()`, which is a float value called `$beta`.

Check notice on line 169 in guide/en/caching/data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/caching/data.md#L169

[Microsoft.Vocab] Verify your use of 'beta' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'beta' with the A-Z word list.", "location": {"path": "guide/en/caching/data.md", "range": {"start": {"line": 169, "column": 113}}}, "severity": "INFO"}
By default, beta is `1.0`, which is usually enough.
The higher the value the earlier cache will be re-created.

Expand Down
6 changes: 4 additions & 2 deletions guide/en/concept/aliases.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Aliases

You can use aliases to represent file paths or URLs so that you don't have to hard-code absolute paths or URLs in your
project. An alias must start with the `@` character to be differentiated from normal file paths and URLs. Alias defined

Check notice on line 4 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L4

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 4, "column": 13}}}, "severity": "INFO"}

Check notice on line 4 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L4

[Microsoft.Passive] 'be differentiated' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be differentiated' looks like passive voice.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 4, "column": 56}}}, "severity": "INFO"}

Check notice on line 4 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L4

[Microsoft.Vocab] Verify your use of 'Alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'Alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 4, "column": 107}}}, "severity": "INFO"}
without leading `@` will be prefixed with `@` character.

Check notice on line 5 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L5

[Microsoft.Passive] 'be prefixed' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be prefixed' looks like passive voice.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 5, "column": 26}}}, "severity": "INFO"}

Default Yii application has some aliases pre-defined in `config/params.php`. For example, the alias `@public` represents
the web root path; `@baseUrl` represents the base URL for the currently running Web application.

Check notice on line 8 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L8

[Microsoft.Semicolon] Try to simplify this sentence.
Raw output
{"message": "[Microsoft.Semicolon] Try to simplify this sentence.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 8, "column": 18}}}, "severity": "INFO"}

Check warning on line 8 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L8

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 8, "column": 51}}}, "severity": "WARNING"}

Check notice on line 8 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L8

[Microsoft.URLFormat] Use 'of' (not 'for') to describe the relationship of the word URL to a resource.
Raw output
{"message": "[Microsoft.URLFormat] Use 'of' (not 'for') to describe the relationship of the word URL to a resource.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 8, "column": 51}}}, "severity": "INFO"}

## Defining aliases <span id="defining-aliases"></span>

You can define an alias via application's `config/params.php`:

Check notice on line 12 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L12

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 12, "column": 19}}}, "severity": "INFO"}

```php
return [
Expand All @@ -32,12 +32,13 @@
];
```

> Note: The file path or URL being aliased may *not* necessarily refer to an existing file or resource.
> [!NOTE]
> The file path or URL being aliased may *not* necessarily refer to an existing file or resource.

Check warning on line 36 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L36

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 36, "column": 20}}}, "severity": "WARNING"}

Check notice on line 36 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L36

[Microsoft.Passive] 'being aliased' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'being aliased' looks like passive voice.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 36, "column": 24}}}, "severity": "INFO"}

Given a defined alias, you may derive a new alias by appending a slash `/` followed with one or more path segments.

Check notice on line 38 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L38

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 38, "column": 17}}}, "severity": "INFO"}

Check notice on line 38 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L38

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 38, "column": 45}}}, "severity": "INFO"}
For example, `@foo` is a root alias, while `@foo/bar/file.php` is a derived alias.

Check notice on line 39 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L39

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 39, "column": 31}}}, "severity": "INFO"}

You can define an alias using another alias (either root or derived):

Check notice on line 41 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L41

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 41, "column": 19}}}, "severity": "INFO"}

```php
'@foobar' => '@foo/bar',
Expand Down Expand Up @@ -78,7 +79,7 @@

## Resolving aliases <span id="resolving-aliases"></span>

You can use `Aliases` service to resolve an alias or derived alias into the file path or URL it represents:

Check notice on line 82 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L82

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 82, "column": 45}}}, "severity": "INFO"}

Check warning on line 82 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L82

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 82, "column": 90}}}, "severity": "WARNING"}

```php
use \Yiisoft\Aliases\Aliases;
Expand All @@ -91,15 +92,16 @@
}
```

The path/URL represented by a derived alias is determined by replacing the root alias part with its corresponding

Check warning on line 95 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L95

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 95, "column": 10}}}, "severity": "WARNING"}

Check notice on line 95 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L95

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 95, "column": 39}}}, "severity": "INFO"}

Check notice on line 95 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L95

[Microsoft.Passive] 'is determined' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is determined' looks like passive voice.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 95, "column": 45}}}, "severity": "INFO"}
path/URL in the derived alias.

Check warning on line 96 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L96

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 96, "column": 6}}}, "severity": "WARNING"}

> Note: The `get()` method doesn't check whether the resulting path/URL refers to an existing file or resource.
> [!NOTE]
> The `get()` method doesn't check whether the resulting path/URL refers to an existing file or resource.

Check warning on line 99 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L99

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 99, "column": 63}}}, "severity": "WARNING"}


A root alias may also contain slash `/` characters. The `get()` method

Check notice on line 102 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L102

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 102, "column": 8}}}, "severity": "INFO"}
is intelligent enough to tell, which part of an alias is a root alias and thus correctly determines
the corresponding file path or URL:

Check warning on line 104 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L104

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 104, "column": 32}}}, "severity": "WARNING"}

```php
use \Yiisoft\Aliases\Aliases;
Expand All @@ -114,7 +116,7 @@
}
```

If `@foo/bar` isn't defined as a root alias, the last statement would display `/path/to/foo/bar/file.php`.

Check notice on line 119 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L119

[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alias' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 119, "column": 39}}}, "severity": "INFO"}


## Predefined aliases <span id="predefined-aliases"></span>
Expand All @@ -123,12 +125,12 @@

- `@root` - the base directory of the currently running application.
- `@assets` - application's public directory where it publishes assets.
- `@assetsUrl` - URL of base directory with published assets.

Check warning on line 128 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L128

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 128, "column": 18}}}, "severity": "WARNING"}
- `@baseUrl` - the base URL of the currently running Web application. Defaults to `/`.

Check warning on line 129 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L129

[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.
Raw output
{"message": "[Microsoft.GeneralURL] For a general audience, use 'address' rather than 'URL'.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 129, "column": 25}}}, "severity": "WARNING"}
- `@npm` - node packages directory.
- `@bower` - bower packages directory.
- `@vendor` - Composer's `vendor` directory.
- `@public` - application's publicly accessible directory that with `index.php`.

Check notice on line 133 in guide/en/concept/aliases.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/aliases.md#L133

[Microsoft.Vocab] Verify your use of 'accessible' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'accessible' with the A-Z word list.", "location": {"path": "guide/en/concept/aliases.md", "range": {"start": {"line": 133, "column": 38}}}, "severity": "INFO"}
- `@runtime` - the runtime path of the currently running application. Defaults to `@root/runtime`.
- `@layout` - the directory with layouts.
- `@resources` - directory with views, asset sources and other resources.
Expand Down
3 changes: 2 additions & 1 deletion guide/en/concept/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration

There are many ways to configure your application. We will focus on concepts used in

Check warning on line 3 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L3

[Microsoft.We] Try to avoid using first-person plural like 'We'.
Raw output
{"message": "[Microsoft.We] Try to avoid using first-person plural like 'We'.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 3, "column": 52}}}, "severity": "WARNING"}
the [default project template](https://github.com/yiisoft/app).

Yii3 configs are part of the application. You can change many aspects of how the application works by editing
Expand All @@ -8,15 +8,15 @@

## Config plugin

In the application template [yiisoft/config](https://github.com/yiisoft/config) is used. Since writing all application

Check notice on line 11 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L11

[Microsoft.Passive] 'is used' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is used' looks like passive voice.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 11, "column": 81}}}, "severity": "INFO"}
configurations from scratch is a tedious process, many packages offer default configs, and the plugin helps with
copying these into the application.

To offer default configs, `composer.json` of the package has to have `config-plugin` section.
When installing or updating packages with Composer, the plugin reads `config-plugin` sections for each dependency,

Check notice on line 16 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L16

[Microsoft.SentenceLength] Try to keep sentences short (< 30 words).
Raw output
{"message": "[Microsoft.SentenceLength] Try to keep sentences short (\u003c 30 words).", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 16, "column": 1}}}, "severity": "INFO"}
copies files themselves to application `config/packages/` if they don't yet exist and writes a merge plan to
`config/packages/merge_plan.php`. The merge plan defines how to merge the configs into a single big array
ready to be passed to [DI container](di-container.md).

Check notice on line 19 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L19

[Microsoft.Passive] 'be passed' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be passed' looks like passive voice.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 19, "column": 10}}}, "severity": "INFO"}

Take a look at what's in the "yiisoft/app" `composer.json` by default:

Expand Down Expand Up @@ -107,7 +107,7 @@

The application consists of a set of services registered in a [dependency container](di-container.md). The config files
that responsible for direct dependency container configuration are under `common/`, `console/` and `web/` directories.
We use `web/` for config specific to web application and `console/` for config specific to console commands. Both web and

Check warning on line 110 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L110

[Microsoft.We] Try to avoid using first-person plural like 'We'.
Raw output
{"message": "[Microsoft.We] Try to avoid using first-person plural like 'We'.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 110, "column": 1}}}, "severity": "WARNING"}
console are sharing configuration under `common/`.

```php
Expand Down Expand Up @@ -220,7 +220,7 @@
];
```

Read more about it in ["Routes"](../runtime/routing.md).

Check failure on line 223 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L223

[Microsoft.Quotes] Punctuation should be inside the quotes.
Raw output
{"message": "[Microsoft.Quotes] Punctuation should be inside the quotes.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 223, "column": 1}}}, "severity": "ERROR"}

### Events

Expand Down Expand Up @@ -258,15 +258,16 @@
];
```

Read more about it in ["Events"](events.md).

Check failure on line 261 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L261

[Microsoft.Quotes] Punctuation should be inside the quotes.
Raw output
{"message": "[Microsoft.Quotes] Punctuation should be inside the quotes.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 261, "column": 1}}}, "severity": "ERROR"}


### Parameters

Parameters, `config/params.php` store configuration values that are used in other config files to configuring services

Check notice on line 266 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L266

[Microsoft.Passive] 'are used' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'are used' looks like passive voice.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 266, "column": 65}}}, "severity": "INFO"}
and service providers.

> Tip: Don't use parameters, constants or environment variables directly in your application, configure
> [!TIP]

Check notice on line 269 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L269

[Microsoft.Acronyms] 'TIP' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'TIP' has no definition.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 269, "column": 5}}}, "severity": "INFO"}
> Don't use parameters, constants or environment variables directly in your application, configure
> services instead.

Default application `params.php` looks like the following:
Expand Down Expand Up @@ -334,9 +335,9 @@

Config plugin described copy default package configurations to `packages/` directory. Once copied you
own the configs, so you can adjust these as you like. `yiisoft/` in the default template stands for package vendor. Since
only `yiisoft` packages are in template, there's a single directory. `merge_plan.php` is used in runtime to get the order

Check notice on line 338 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L338

[Microsoft.Passive] 'is used' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is used' looks like passive voice.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 338, "column": 87}}}, "severity": "INFO"}
on how configs are merged.

Check notice on line 339 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L339

[Microsoft.Passive] 'are merged' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'are merged' looks like passive voice.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 339, "column": 16}}}, "severity": "INFO"}
Note that for config keys there should be a single source of truth.
One config can't override values of another config.

`dist.lock` is used by the plugin to keep track of changes and display diff between current config and example one.

Check notice on line 343 in guide/en/concept/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/concept/configuration.md#L343

[Microsoft.Passive] 'is used' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is used' looks like passive voice.", "location": {"path": "guide/en/concept/configuration.md", "range": {"start": {"line": 343, "column": 13}}}, "severity": "INFO"}
15 changes: 10 additions & 5 deletions guide/en/runtime/logging.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Logging

Yii relies on [PSR-3 interfaces](https://www.php-fig.org/psr/psr-3/) for logging, so you could configure any PSR-3

Check notice on line 3 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L3

[Microsoft.Acronyms] 'PSR' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'PSR' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 3, "column": 16}}}, "severity": "INFO"}

Check notice on line 3 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L3

[Microsoft.Acronyms] 'PSR' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'PSR' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 3, "column": 110}}}, "severity": "INFO"}
compatible logging library to do the actual job.

Yii provides its own logger that's highly customizable and extensible.
Expand All @@ -11,13 +11,13 @@

* Record [log messages](#log-messages) at various places in your code;
* Configure [log targets](#log-targets) in the application configuration to filter and export log messages;
* Examine the filtered logged messages exported by different targets (e.g. the [Yii debugger](../tool/debugger.md)).

Check failure on line 14 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L14

[Microsoft.Foreign] Use 'for example' instead of 'e.g. '.
Raw output
{"message": "[Microsoft.Foreign] Use 'for example' instead of 'e.g. '.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 14, "column": 71}}}, "severity": "ERROR"}

In this section, the focus in on the first two steps.

## Log Messages <span id="log-messages"></span>

Check notice on line 18 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L18

[Microsoft.Headings] 'Log Messages' should use sentence-style capitalization.
Raw output
{"message": "[Microsoft.Headings] 'Log Messages' should use sentence-style capitalization.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 18, "column": 4}}}, "severity": "INFO"}

To record log messages, you need an instance of PSR-3 logger.

Check notice on line 20 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L20

[Microsoft.Acronyms] 'PSR' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'PSR' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 20, "column": 49}}}, "severity": "INFO"}
A class that writes log messages should receive it as a dependency:

```php
Expand All @@ -35,11 +35,11 @@
Recording a log message is as simple as calling one of the following logging methods that correspond to log levels:

- `emergency` - System is unusable.
- `alert` - Action must be taken immediately.

Check notice on line 38 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L38

[Microsoft.Passive] 'be taken' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be taken' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 38, "column": 25}}}, "severity": "INFO"}
Example: Entire website down, database unavailable, etc.
This should trigger the SMS alerts and wake you up.

Check notice on line 40 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L40

[Microsoft.Acronyms] 'SMS' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'SMS' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 40, "column": 27}}}, "severity": "INFO"}
- `critical` - Critical conditions. Example: Application component unavailable, unexpected exception.
- `error` - Runtime errors that don't require immediate action but should typically be logged and monitored.

Check notice on line 42 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L42

[Microsoft.Passive] 'be logged' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be logged' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 42, "column": 85}}}, "severity": "INFO"}
- `warning` - Exceptional occurrences that aren't errors. Example: Use of deprecated APIs, poor use of an API,
undesirable things that aren't necessarily wrong.
- `notice` - Normal but significant events.
Expand Down Expand Up @@ -78,20 +78,21 @@

The `__METHOD__` constant evaluates as the name of the method (prefixed with the fully qualified class name) where
the constant appears.
For example, it's equal to the string `'App\\Service\\MyService::serve'` if the above line of code is called within

Check notice on line 81 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L81

[Microsoft.Vocab] Verify your use of 'above' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'above' with the A-Z word list.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 81, "column": 81}}}, "severity": "INFO"}

Check notice on line 81 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L81

[Microsoft.Passive] 'is called' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is called' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 81, "column": 100}}}, "severity": "INFO"}
this method.

> Info: The logging methods described above are actually shortcuts to the [[\Psr\Log\LoggerInterface::log()]].
> [!IMPORTANT]
> The logging methods described above are actually shortcuts to the [[\Psr\Log\LoggerInterface::log()]].

Check notice on line 85 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L85

[Microsoft.Vocab] Verify your use of 'above' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'above' with the A-Z word list.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 85, "column": 33}}}, "severity": "INFO"}

Note that PSR-3 package provides `\Psr\Log\NullLogger` class that provides the same set of methods but doesn't log

Check notice on line 87 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L87

[Microsoft.Acronyms] 'PSR' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'PSR' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 87, "column": 11}}}, "severity": "INFO"}
anything. That means that you don't have to check if logger is configured with `if ($logger !== null)` and, instead,

Check notice on line 88 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L88

[Microsoft.Passive] 'is configured' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is configured' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 88, "column": 61}}}, "severity": "INFO"}
can assume that logger is always present.


## Log targets <span id="log-targets"></span>

A log target is an instance of a class that extends the [[\Yiisoft\Log\Target]]. It filters the log messages by their
severity levels and categories and then exports them to some medium. For example,

Check notice on line 95 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L95

[Microsoft.SentenceLength] Try to keep sentences short (< 30 words).
Raw output
{"message": "[Microsoft.SentenceLength] Try to keep sentences short (\u003c 30 words).", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 95, "column": 70}}}, "severity": "INFO"}
a [[\Yiisoft\Log\Target\File\FileTarget|file target]]exports the filtered log messages to a file,
while a [[Yiisoft\Log\Target\Email\EmailTarget|email target]] exports the log messages to specified email addresses.

Expand All @@ -113,26 +114,26 @@
]);
```

In the above code, two log targets are registered:

Check notice on line 117 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L117

[Microsoft.Vocab] Verify your use of 'above' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'above' with the A-Z word list.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 117, "column": 8}}}, "severity": "INFO"}

Check notice on line 117 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L117

[Microsoft.Passive] 'are registered' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'are registered' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 117, "column": 36}}}, "severity": "INFO"}

* the first target selects error and warning messages and writes them to `/path/to/app.log` file;
* the second target selects emergency, alert, and critical messages under the categories whose names start with

Check notice on line 120 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L120

[Microsoft.Vocab] Verify your use of 'alert' with the A-Z word list.
Raw output
{"message": "[Microsoft.Vocab] Verify your use of 'alert' with the A-Z word list.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 120, "column": 40}}}, "severity": "INFO"}
`Yiisoft\Cache\`, and sends them in an email to both `[email protected]` and `[email protected]`.

Yii comes with the following built-in log targets. Please refer to the API documentation about these classes to
learn how to configure and use them.

* [[\Yiisoft\Log\PsrTarget]]: passes log messages to another PSR-3 compatible logger.

Check notice on line 126 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L126

[Microsoft.Acronyms] 'PSR' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'PSR' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 126, "column": 62}}}, "severity": "INFO"}
* [[\Yiisoft\Log\StreamTarget]]: writes log messages into a specified output stream.
* [[\Yiisoft\Log\Target\Db\DbTarget]]: saves log messages in database.
* [[\Yiisoft\Log\Target\Email\EmailTarget]]: sends log messages to pre-specified email addresses.
* [[\Yiisoft\Log\Target\File\FileTarget]]: saves log messages in files.
* [[\Yiisoft\Log\Target\Syslog\SyslogTarget]]: saves log messages to syslog by calling the PHP function `syslog()`.

In the following, we will describe the features common to all log targets.

Check warning on line 133 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L133

[Microsoft.We] Try to avoid using first-person plural like 'we'.
Raw output
{"message": "[Microsoft.We] Try to avoid using first-person plural like 'we'.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 133, "column": 19}}}, "severity": "WARNING"}


### Message Filtering <span id="message-filtering"></span>

Check notice on line 136 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L136

[Microsoft.Headings] 'Message Filtering' should use sentence-style capitalization.
Raw output
{"message": "[Microsoft.Headings] 'Message Filtering' should use sentence-style capitalization.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 136, "column": 5}}}, "severity": "INFO"}

For each log target, you can configure its levels and categories to specify
which severity levels and categories of the messages the target should process.
Expand All @@ -142,7 +143,7 @@
By default, the target will process messages of *any* severity level.

The target `setCategories()` method takes an array consisting of message category names or patterns.
A target will only process messages whose category can be found or match one of the patterns in this array.

Check notice on line 146 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L146

[Microsoft.Passive] 'be found' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be found' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 146, "column": 56}}}, "severity": "INFO"}
A category pattern is a category name prefix with an asterisk `*` at its end. A category name matches a category pattern
if it starts with the same prefix of the pattern. For example, `Yiisoft\Cache\Cache::set` and `Yiisoft\Cache\Cache::get`
both match the pattern `Yiisoft\Cache\*`.
Expand All @@ -151,8 +152,8 @@

Besides allowing the categories by the `setCategories()` method, you may also
deny certain categories by the `setExcept()` method.
If the category of a message is found or matches one of the patterns in this property,

Check notice on line 155 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L155

[Microsoft.Passive] 'is found' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is found' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 155, "column": 30}}}, "severity": "INFO"}
the target will NOT process it.

Check failure on line 156 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L156

[Microsoft.Contractions] Use 'won't' instead of 'will NOT'.
Raw output
{"message": "[Microsoft.Contractions] Use 'won't' instead of 'will NOT'.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 156, "column": 12}}}, "severity": "ERROR"}

Check notice on line 156 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L156

[Microsoft.Acronyms] 'NOT' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'NOT' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 156, "column": 17}}}, "severity": "INFO"}

The following target configuration specifies that the target should only process error and warning messages
under the categories whose names match either `Yiisoft\Cache\*` or `App\Exceptions\HttpException:*`,
Expand All @@ -165,7 +166,7 @@
$fileTarget->setExcept(['App\Exceptions\HttpException:404']);
```

### Message Formatting <span id="message-formatting"></span>

Check notice on line 169 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L169

[Microsoft.Headings] 'Message Formatting' should use sentence-style capitalization.
Raw output
{"message": "[Microsoft.Headings] 'Message Formatting' should use sentence-style capitalization.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 169, "column": 5}}}, "severity": "INFO"}

Log targets export the filtered log messages in a certain format.
For example, if you install a log target of the class [[\Yiisoft\Log\Target\File\FileTarget]],
Expand Down Expand Up @@ -205,11 +206,11 @@
// (APP) [info] Text message
```

In addition, if you're comfortable with the default message format but need to change the timestamp format

Check notice on line 209 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L209

[Microsoft.SentenceLength] Try to keep sentences short (< 30 words).
Raw output
{"message": "[Microsoft.SentenceLength] Try to keep sentences short (\u003c 30 words).", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 209, "column": 1}}}, "severity": "INFO"}

Check notice on line 209 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L209

[Microsoft.Wordiness] Consider using 'also' instead of 'In addition'.
Raw output
{"message": "[Microsoft.Wordiness] Consider using 'also' instead of 'In addition'.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 209, "column": 1}}}, "severity": "INFO"}
or add custom data to the message, you can call the [[\Yiisoft\Log\Target::setTimestampFormat()|setTimestampFormat()]]
and [[\Yiisoft\Log\Target::setPrefix()|setPrefix()]] methods. For example, the following code changes the timestamp

Check notice on line 211 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L211

[Microsoft.SentenceLength] Try to keep sentences short (< 30 words).
Raw output
{"message": "[Microsoft.SentenceLength] Try to keep sentences short (\u003c 30 words).", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 211, "column": 63}}}, "severity": "INFO"}
format and configures a log target to prefix each log message with the current user ID
(IP address and Session ID are removed for privacy reasons).

Check notice on line 213 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L213

[Microsoft.Passive] 'are removed' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'are removed' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 213, "column": 28}}}, "severity": "INFO"}

```php
$fileTarget = new \Yiisoft\Log\Target\File\FileTarget('/path/to/app.log');
Expand Down Expand Up @@ -240,7 +241,7 @@
You may adjust this behavior by calling target [[\Yiisoft\Log\Target::setCommonContext()|setCommonContext()]]
method, passing an array of data in the `key => value` format that you want to include.
For example, the following log target configuration specifies that only the
value of the `$_SERVER` variable will be appended to the log messages.

Check notice on line 244 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L244

[Microsoft.Passive] 'be appended' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be appended' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 244, "column": 39}}}, "severity": "INFO"}

```php
$fileTarget = new \Yiisoft\Log\Target\File\FileTarget('/path/to/app.log');
Expand All @@ -248,7 +249,7 @@
```


### Message Trace Level <span id="trace-level"></span>

Check notice on line 252 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L252

[Microsoft.Headings] 'Message Trace Level' should use sentence-style capitalization.
Raw output
{"message": "[Microsoft.Headings] 'Message Trace Level' should use sentence-style capitalization.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 252, "column": 5}}}, "severity": "INFO"}

During development, it's often desirable to see where each log message is coming from.
You can achieve this by calling the [[\Yiisoft\Log\Logger::setTraceLevel()|setTraceLevel()]] method like the following:
Expand All @@ -258,8 +259,8 @@
$logger->setTraceLevel(3);
```

This application configuration sets the trace level to be 3, so each log message will be appended with at most three

Check notice on line 262 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L262

[Microsoft.SentenceLength] Try to keep sentences short (< 30 words).
Raw output
{"message": "[Microsoft.SentenceLength] Try to keep sentences short (\u003c 30 words).", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 262, "column": 1}}}, "severity": "INFO"}

Check notice on line 262 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L262

[Microsoft.Passive] 'be appended' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be appended' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 262, "column": 87}}}, "severity": "INFO"}
levels of the call stack at which the log message is recorded. You can also set a list of paths to exclude

Check notice on line 263 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L263

[Microsoft.Passive] 'is recorded' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is recorded' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 263, "column": 51}}}, "severity": "INFO"}
from the trace by calling the [[\Yiisoft\Log\Logger::setExcludedTracePaths()|setExcludedTracePaths()]] method.

```php
Expand All @@ -267,13 +268,14 @@
$logger->setExcludedTracePaths(['/path/to/file', '/path/to/folder']);
```

> Info: Getting call stack information isn't trivial. Therefore, you should only use this feature during development
> [!IMPORTANT]
> Getting call stack information isn't trivial. Therefore, you should only use this feature during development
or when debugging an application.


### Message flushing and exporting <span id="flushing-exporting"></span>

As aforementioned, log messages are maintained in an array by [[\Yiisoft\Log\Logger|logger object]]. To limit the

Check notice on line 278 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L278

[Microsoft.Passive] 'are maintained' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'are maintained' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 278, "column": 33}}}, "severity": "INFO"}
memory consumption by this array, the logger will flush the recorded messages to the [log targets](#log-targets)
each time the array accumulates a certain number of log messages. You can customize this number by calling
the [[\Yiisoft\Log\Logger::setFlushInterval()]] method:
Expand All @@ -284,7 +286,8 @@
$logger->setFlushInterval(100); // default is 1000
```

> Info: Message flushing also occurs when the application ends,
> [!IMPORTANT]
> Message flushing also occurs when the application ends,
which ensures log targets can receive complete log messages.

When the [[\Yiisoft\Log\Logger|logger object]] flushes log messages to [log targets](#log-targets),
Expand All @@ -299,7 +302,7 @@
```

Because of the flushing and exporting level setting, by default when you call any logging
method, you will NOT see the log message immediately in the log targets. This could be a problem for some long-running

Check failure on line 305 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L305

[Microsoft.Contractions] Use 'won't' instead of 'will NOT'.
Raw output
{"message": "[Microsoft.Contractions] Use 'won't' instead of 'will NOT'.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 305, "column": 13}}}, "severity": "ERROR"}

Check notice on line 305 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L305

[Microsoft.Acronyms] 'NOT' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'NOT' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 305, "column": 18}}}, "severity": "INFO"}
console applications. To make each log message appear immediately in the log targets, you should set both
flush interval and export interval to be 1, as shown below:

Expand All @@ -311,7 +314,8 @@
$logger->setFlushInterval(1);
```

> Note: Frequent message flushing and exporting will degrade the performance of your application.
> [!NOTE]
> Frequent message flushing and exporting will degrade the performance of your application.


### Toggling log targets <span id="toggling-log-targets"></span>
Expand All @@ -331,9 +335,9 @@
}
```

To check whether the log target is enabled, call the `isEnabled()` method.

Check notice on line 338 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L338

[Microsoft.Passive] 'is enabled' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is enabled' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 338, "column": 33}}}, "severity": "INFO"}
You also may pass callable to [[\Yiisoft\Log\Target::setEnabled()|setEnabled()]]
to define a dynamic condition for whether the log target should be enabled or not.

Check notice on line 340 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L340

[Microsoft.Passive] 'be enabled' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be enabled' looks like passive voice.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 340, "column": 65}}}, "severity": "INFO"}


### Creating new targets <span id="new-targets"></span>
Expand All @@ -350,7 +354,8 @@

For more details, you may refer to any of the log target classes included in the package.

> Tip: Instead of creating your own loggers, you may try any PSR-3 compatible logger such
> [!TIP]

Check notice on line 357 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L357

[Microsoft.Acronyms] 'TIP' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'TIP' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 357, "column": 5}}}, "severity": "INFO"}
> Instead of creating your own loggers, you may try any PSR-3 compatible logger such

Check notice on line 358 in guide/en/runtime/logging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] guide/en/runtime/logging.md#L358

[Microsoft.Acronyms] 'PSR' has no definition.
Raw output
{"message": "[Microsoft.Acronyms] 'PSR' has no definition.", "location": {"path": "guide/en/runtime/logging.md", "range": {"start": {"line": 358, "column": 57}}}, "severity": "INFO"}
as [Monolog](https://github.com/Seldaek/monolog) by using [[\Yii\Log\PsrTarget]].

```php
Expand Down
Loading
Loading