You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alias names must be strings, cannot collide with existing services/aliases, and the target service must already exist.
1263
+
1264
+
You can register one or more aliases for an existing service name. Once aliases are set, calls such as `get()`, `getShared()`, `getService()`, `set()`, and `remove()` can resolve through the alias chain.
When you request a service from the container, if it cannot be found by using the same name, it will try to load a class with the same name. This behavior allows you to replace any service with another, by simply registering a service with the common name:
Copy file name to clipboardExpand all lines: docs/encryption-security-jwt.md
+26-3Lines changed: 26 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -292,9 +292,10 @@ public function addClaim(string $name, mixed $value): Builder
292
292
Adds a custom claim in the claims collection
293
293
294
294
```php
295
-
public function getAudience(): array|string
295
+
public function getAudience(): array
296
296
```
297
-
Returns the `aud` contents
297
+
---
298
+
Returns the `aud` contents. If `aud` is not set, this method returns an empty array.
298
299
299
300
```php
300
301
public function getClaims(): array
@@ -394,7 +395,14 @@ Sets the subject (`sub`).
394
395
```php
395
396
public function setPassphrase(string $passphrase): Builder
396
397
```
397
-
Sets the passphrase. If the `$passphrase` is weak, a [Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException][security-jwt-exceptions-validatorexception] will be thrown.
398
+
Sets the passphrase. A weak passphrase raises a [Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException][security-jwt-exceptions-validatorexception].
399
+
400
+
The passphrase must:
401
+
- be at least 16 characters long
402
+
- contain at least one uppercase letter
403
+
- contain at least one lowercase letter
404
+
- contain at least one digit
405
+
- contain at least one special character
398
406
399
407
```php
400
408
private function setClaim(string $name, $value): Builder
@@ -492,6 +500,21 @@ public function validateAudience(array|string $audience): Validator
492
500
```
493
501
Validates the audience. If it is not included in the token's `aud`, a [Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException][security-jwt-exceptions-validatorexception] will be thrown.
494
502
503
+
```php
504
+
public function validateClaim(string $name, mixed $value): Validator
505
+
```
506
+
Validates a custom claim by name against an expected value.
507
+
508
+
In a validator example chain, include one custom claim check, e.g.:
509
+
```php
510
+
$validator
511
+
->validateAudience($audience)
512
+
->validateIssuer($issuer)
513
+
->validateClaim("tenantId", "acme")
514
+
;
515
+
```
516
+
517
+
495
518
```php
496
519
public function validateExpiration(int $timestamp): Validator
Copy file name to clipboardExpand all lines: docs/filter-filter.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,9 +119,9 @@ Remove all characters except digits, plus and minus sign, and casts the value as
119
119
120
120
#### `ip`
121
121
```php
122
-
Ip( string input, int filter = 0 ): int
122
+
Ip( string $input, int $filter = 0 ): string|false
123
123
```
124
-
Sanitize the IP address or CIDR IP range. Internally it uses [filter_var][filter_var]. You can pass specific filters to sanitize your input:
124
+
Sanitizes an IP address or CIDR IP range. Internally it uses [filter_var][filter_var] for IP validation. CIDR masks are validated according to IP family (`0-32` for IPv4, `0-128` for IPv6). Returns `false` for invalid values.
Copy file name to clipboardExpand all lines: docs/forms.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -334,6 +334,10 @@ The second optional parameter is `entity` (object). If passed, internally the co
334
334
335
335
Once the `bind()` process finishes, the modified `entity` will be passed in the `beforeValidation` event (if events are enabled) and after that, all the validators will be called on the form using the modified `entity` object.
336
336
337
+
!!! info "NOTE"
338
+
339
+
During `isValid()`, field filters are applied through the form binding flow even when an element has no validators. This keeps entity/input normalization consistent across validated and non-validated fields.
340
+
337
341
!!! info "NOTE"
338
342
339
343
Passing an `entity` object will result in the object being modified by the user input as described above. If you do not wish this behavior, you can clone the entity before passing it, to keep a copy of the original object
Copy file name to clipboardExpand all lines: docs/logger.md
+23-19Lines changed: 23 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,15 +159,15 @@ $logger->warning("This is a warning message");
159
159
The log generated is as follows:
160
160
161
161
```bash
162
-
[Tue, 25 Dec 18 12:13:14 -0400][ALERT] This is an alert message
163
-
[Tue, 25 Dec 18 12:13:14 -0400][CRITICAL] This is a critical message
164
-
[Tue, 25 Dec 18 12:13:14 -0400][DEBUG] This is a debug message
165
-
[Tue, 25 Dec 18 12:13:14 -0400][ERROR] This is an error message
166
-
[Tue, 25 Dec 18 12:13:14 -0400][EMERGENCY] This is an emergency message
167
-
[Tue, 25 Dec 18 12:13:14 -0400][INFO] This is an info message
168
-
[Tue, 25 Dec 18 12:13:14 -0400][CRITICAL] This is a log message
169
-
[Tue, 25 Dec 18 12:13:14 -0400][NOTICE] This is a notice message
170
-
[Tue, 25 Dec 18 12:13:14 -0400][WARNING] This is warning message
162
+
[Tue, 25 Dec 18 12:13:14 -0400][alert] This is an alert message
163
+
[Tue, 25 Dec 18 12:13:14 -0400][critical] This is a critical message
164
+
[Tue, 25 Dec 18 12:13:14 -0400][debug] This is a debug message
165
+
[Tue, 25 Dec 18 12:13:14 -0400][error] This is an error message
166
+
[Tue, 25 Dec 18 12:13:14 -0400][emergency] This is an emergency message
167
+
[Tue, 25 Dec 18 12:13:14 -0400][info] This is an info message
168
+
[Tue, 25 Dec 18 12:13:14 -0400][critical] This is a log message
169
+
[Tue, 25 Dec 18 12:13:14 -0400][notice] This is a notice message
170
+
[Tue, 25 Dec 18 12:13:14 -0400][warning] This is warning message
171
171
```
172
172
173
173
## Multiple Adapters
@@ -295,10 +295,10 @@ $logger->warning("This is a warning message");
295
295
The log generated is as follows:
296
296
297
297
```bash
298
-
[Tue, 25 Dec 18 12:13:14 -0400][ALERT] This is an alert message
299
-
[Tue, 25 Dec 18 12:13:14 -0400][CRITICAL] This is a critical message
300
-
[Tue, 25 Dec 18 12:13:14 -0400][EMERGENCY] This is an emergency message
301
-
[Tue, 25 Dec 18 12:13:14 -0400][CRITICAL] This is a log message
298
+
[Tue, 25 Dec 18 12:13:14 -0400][alert] This is an alert message
299
+
[Tue, 25 Dec 18 12:13:14 -0400][critical] This is a critical message
300
+
[Tue, 25 Dec 18 12:13:14 -0400][emergency] This is an emergency message
301
+
[Tue, 25 Dec 18 12:13:14 -0400][critical] This is a log message
302
302
```
303
303
304
304
The above can be used in situations where you want to log messages above a certain severity based on conditions in your application such as development mode vs. production.
@@ -307,6 +307,10 @@ The above can be used in situations where you want to log messages above a certa
307
307
308
308
The log level set is included in the logging. Anything **below** that level (i.e. higher number) will not be logged
309
309
310
+
!!! info "NOTE"
311
+
312
+
Log level names are emitted in lowercase (for example: `error`, `warning`, `info`).
313
+
310
314
!!! danger "DANGER"
311
315
312
316
It is **never** a good idea to suppress logging levels in your application since even warning errors do require CPU cycles to be processed, and neglecting these errors could potentially lead to unintended circumstances
@@ -376,11 +380,11 @@ Formats the messages using a one-line string. The default logging format is:
376
380
#### Message Format
377
381
If the default format of the message does not fit the needs of your application you can change it using the `setFormat()` method. The log format variables allowed are:
0 commit comments