From ab61b774107a9a0db540bce25d70ae2964411753 Mon Sep 17 00:00:00 2001 From: Ahmed Alaa <92916738+AhmedAlaa4611@users.noreply.github.com> Date: Mon, 9 Jun 2025 17:57:20 +0300 Subject: [PATCH 1/2] Add decrypt and encrypt methods to strings --- strings.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/strings.md b/strings.md index 9d8c4654a8..8ee9ecab18 100644 --- a/strings.md +++ b/strings.md @@ -145,8 +145,10 @@ Laravel includes a variety of functions for manipulating string values. Many of [chopEnd](#method-fluent-str-chop-end) [contains](#method-fluent-str-contains) [containsAll](#method-fluent-str-contains-all) +[decrypt](#method-fluent-str-decrypt) [deduplicate](#method-fluent-str-deduplicate) [dirname](#method-fluent-str-dirname) +[encrypt](#method-fluent-str-encrypt) [endsWith](#method-fluent-str-ends-with) [exactly](#method-fluent-str-exactly) [excerpt](#method-fluent-str-excerpt) @@ -2140,6 +2142,21 @@ $containsAll = Str::of('This is my name')->containsAll(['MY', 'NAME'], ignoreCas // true ``` + +#### `decrypt` {.collection-method} + +The `decrypt` method decrypts the encrypted string: + +```php +use Illuminate\Support\Str; + +$decrypted = $encrypted->decrypt(); + +// 'secret' +``` + +For the inverse of `decrypt`, see the [encrypt](#method-fluent-str-encrypt) method. + #### `deduplicate` {.collection-method} @@ -2186,6 +2203,21 @@ $string = Str::of('/foo/bar/baz')->dirname(2); // '/foo' ``` + +#### `encrypt` {.collection-method} + +The `encrypt` method encrypts the string: + +```php +use Illuminate\Support\Str; + +$encrypted = Str::of('secret')->encrypt(); + +// 'The result is different each time...' +``` + +For the inverse of `encrypt`, see the [decrypt](#method-fluent-str-decrypt) method. + #### `endsWith` {.collection-method} From 32411936c6e725aca2f501f797e998ed09976556 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 9 Jun 2025 12:28:26 -0500 Subject: [PATCH 2/2] formatting --- strings.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/strings.md b/strings.md index 8ee9ecab18..4ce05c113f 100644 --- a/strings.md +++ b/strings.md @@ -2145,7 +2145,7 @@ $containsAll = Str::of('This is my name')->containsAll(['MY', 'NAME'], ignoreCas #### `decrypt` {.collection-method} -The `decrypt` method decrypts the encrypted string: +The `decrypt` method [decrypts](/docs/{{version}}/encryption) the encrypted string: ```php use Illuminate\Support\Str; @@ -2206,14 +2206,12 @@ $string = Str::of('/foo/bar/baz')->dirname(2); #### `encrypt` {.collection-method} -The `encrypt` method encrypts the string: +The `encrypt` method [encrypts](/docs/{{version}}/encryption) the string: ```php use Illuminate\Support\Str; $encrypted = Str::of('secret')->encrypt(); - -// 'The result is different each time...' ``` For the inverse of `encrypt`, see the [decrypt](#method-fluent-str-decrypt) method.