Skip to content

Commit 39cbb5d

Browse files
committed
Merge branch '10.x' into 11.x
# Conflicts: # broadcasting.md # dusk.md # releases.md # reverb.md # upgrade.md
2 parents e4e7008 + 08354a7 commit 39cbb5d

11 files changed

+248
-14
lines changed

broadcasting.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ To assist you in building these types of features, Laravel makes it easy to "bro
5050

5151
The core concepts behind broadcasting are simple: clients connect to named channels on the frontend, while your Laravel application broadcasts events to these channels on the backend. These events can contain any additional data you wish to make available to the frontend.
5252

53-
> [!NOTE]
53+
<a name="supported-drivers"></a>
54+
#### Supported Drivers
55+
56+
By default, Laravel includes three server-side broadcasting drivers for you to choose from: [Laravel Reverb](https://reverb.laravel.com), [Pusher Channels](https://pusher.com/channels), and [Ably](https://ably.com).
57+
58+
> [!NOTE]
5459
> Before diving into event broadcasting, make sure you have read Laravel's documentation on [events and listeners](/docs/{{version}}/events).
5560
5661
<a name="server-side-installation"></a>
@@ -98,6 +103,23 @@ php artisan reverb:install
98103

99104
You can find detailed Reverb installation and usage instructions in the [Reverb documentation](/docs/{{version}}/reverb).
100105

106+
<a name="reverb"></a>
107+
### Reverb
108+
109+
You may install Reverb using the Composer package manager. Since Reverb is currently in beta, you will need to explicitly install the beta release:
110+
111+
```sh
112+
composer require laravel/reverb:@beta
113+
```
114+
115+
Once the package is installed, you may run Reverb's installation command to publish the configuration, update your applications's broadcasting configuration, and add Reverb's required environment variables:
116+
117+
```sh
118+
php artisan reverb:install
119+
```
120+
121+
You can find detailed Reverb installation and usage instructions in the [Reverb documentation](/docs/{{version}}/reverb).
122+
101123
<a name="pusher-channels"></a>
102124
### Pusher Channels
103125

@@ -161,6 +183,43 @@ Finally, you are ready to install and configure [Laravel Echo](#client-side-inst
161183
<a name="client-reverb"></a>
162184
### Reverb
163185

186+
[Laravel Echo](https://github.com/laravel/echo) is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting driver. You may install Echo via the NPM package manager. In this example, we will also install the `pusher-js` package since Reverb utilizes the Pusher protocol for WebSocket subscriptions, channels, and messages:
187+
188+
```shell
189+
npm install --save-dev laravel-echo pusher-js
190+
```
191+
192+
Once Echo is installed, you are ready to create a fresh Echo instance in your application's JavaScript. A great place to do this is at the bottom of the `resources/js/bootstrap.js` file that is included with the Laravel framework. By default, an example Echo configuration is already included in this file - you simply need to uncomment it and update the `broadcaster` configuration option to `reverb`:
193+
194+
```js
195+
import Echo from 'laravel-echo';
196+
197+
import Pusher from 'pusher-js';
198+
window.Pusher = Pusher;
199+
200+
window.Echo = new Echo({
201+
broadcaster: 'reverb',
202+
key: import.meta.env.VITE_REVERB_APP_KEY,
203+
wsHost: import.meta.env.VITE_REVERB_HOST,
204+
wsPort: import.meta.env.VITE_REVERB_PORT,
205+
wssPort: import.meta.env.VITE_REVERB_PORT,
206+
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
207+
enabledTransports: ['ws', 'wss'],
208+
});
209+
```
210+
211+
Next, you should compile your application's assets:
212+
213+
```shell
214+
npm run build
215+
```
216+
217+
> [!WARNING]
218+
> The Laravel Echo `reverb` broadcaster requires laravel-echo v1.16.0+.
219+
220+
<a name="client-pusher-channels"></a>
221+
### Pusher Channels
222+
164223
[Laravel Echo](https://github.com/laravel/echo) is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting driver. Echo also leverages the `pusher-js` NPM package to implement the Pusher protocol for WebSocket subscriptions, channels, and messages.
165224
166225
The `install:broadcasting` Artisan command automatically installs the `laravel-echo` and `pusher-js` packages for you; however, you may also install these packages manually via NPM:

configuration.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,6 @@ To set configuration values at runtime, you may invoke the `Config` facade's `se
203203

204204
config(['app.timezone' => 'America/Chicago']);
205205

206-
To assist with static analysis, the `Config` facade also provides typed configuration retrieval methods. If the retrieved configuration value does not match the expected type, an exception will be thrown:
207-
208-
Config::string('config-key');
209-
Config::integer('config-key');
210-
Config::float('config-key');
211-
Config::boolean('config-key');
212-
Config::array('config-key');
213-
214206
<a name="configuration-caching"></a>
215207
## Configuration Caching
216208

dusk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ If you had test failures the last time you ran the `dusk` command, you may save
281281
php artisan dusk:fails
282282
```
283283

284-
The `dusk` command accepts any argument that is normally accepted by the Pest / PHPUnit test runner, such as allowing you to only run the tests for a given [group](https://phpunit.readthedocs.io/en/10.1/annotations.html#group):
284+
The `dusk` command accepts any argument that is normally accepted by the Pest / PHPUnit test runner, such as allowing you to only run the tests for a given [group](https://docs.phpunit.de/en/10.5/annotations.html#group):
285285

286286
```shell
287287
php artisan dusk --group=foo

installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Before creating your first Laravel project, make sure that your local machine ha
5858
After you have installed PHP and Composer, you may create a new Laravel project via Composer's `create-project` command:
5959

6060
```nothing
61-
composer create-project laravel/laravel example-app
61+
composer create-project laravel/laravel:^10.0 example-app
6262
```
6363

6464
Or, you may create new Laravel projects by globally installing [the Laravel installer](https://github.com/laravel/installer) via Composer:

octane.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,28 @@ services:
8282
laravel.test:
8383
environment:
8484
SUPERVISOR_PHP_COMMAND: "/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --server=frankenphp --host=0.0.0.0 --admin-port=2019 --port=80" # [tl! add]
85+
XDG_CONFIG_HOME: /var/www/html/config # [tl! add]
86+
XDG_DATA_HOME: /var/www/html/data # [tl! add]
8587
```
8688
89+
To enable HTTPS, HTTP/2, and HTTP/3, apply these modifications instead:
90+
91+
```yaml
92+
services:
93+
laravel.test:
94+
ports:
95+
- '${APP_PORT:-80}:80'
96+
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
97+
- '443:443' # [tl! add]
98+
- '443:443/udp' # [tl! add]
99+
environment:
100+
SUPERVISOR_PHP_COMMAND: "/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --host=localhost --port=443 --admin-port=2019 --https" # [tl! add]
101+
XDG_CONFIG_HOME: /var/www/html/config # [tl! add]
102+
XDG_DATA_HOME: /var/www/html/data # [tl! add]
103+
```
104+
105+
Typically, you should access your FrankenPHP Sail application via `https://localhost`, as using `https://127.0.0.1` requires additional configuration and is [discouraged](https://frankenphp.dev/docs/known-issues/#using-https127001-with-docker).
106+
87107
<a name="frankenphp-via-docker"></a>
88108
#### FrankenPHP via Docker
89109

pennant.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,14 +796,26 @@ If you would like to purge _all_ features from storage, you may invoke the `purg
796796
Feature::purge();
797797
```
798798

799-
As it can be useful to purge features as part of your application's deployment pipeline, Pennant includes a `pennant:purge` Artisan command:
799+
As it can be useful to purge features as part of your application's deployment pipeline, Pennant includes a `pennant:purge` Artisan command which will purge the provided features from storage:
800800

801801
```sh
802802
php artisan pennant:purge new-api
803803

804804
php artisan pennant:purge new-api purchase-button
805805
```
806806

807+
It is also possible to purge all features _except_ those in a given feature list. For example, imagine you wanted to purge all features but keep the values for the "new-api" and "purchase-button" features in storage. To accomplish this, you can pass those feature names to the `--except` option:
808+
809+
```sh
810+
php artisan pennant:purge --except=new-api --except=purchase-button
811+
```
812+
813+
For convenience, the `pennant:purge` command also supports an `--except-registered` flag. This flag indicates that all features except those explicitly registered in a service provider should be purged:
814+
815+
```sh
816+
php artisan pennant:purge --except-registered
817+
```
818+
807819
<a name="testing"></a>
808820
## Testing
809821

pulse.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,15 @@ php artisan pulse:check
249249
> [!NOTE]
250250
> To keep the `pulse:check` process running permanently in the background, you should use a process monitor such as Supervisor to ensure that the command does not stop running.
251251
252+
As the `pulse:check` command is a long-lived process, it will not see changes to your codebase without being restarted. You should gracefully restart the command by calling the `pulse:restart` command during your application's deployment process:
253+
254+
```sh
255+
php artisan pulse:restart
256+
```
257+
258+
> [!NOTE]
259+
> Pulse uses the [cache](/docs/{{version}}/cache) to store restart signals, so you should verify that a cache driver is properly configured for your application before using this feature.
260+
252261
<a name="recorders"></a>
253262
### Recorders
254263

@@ -425,6 +434,15 @@ php artisan pulse:work
425434
> [!NOTE]
426435
> To keep the `pulse:work` process running permanently in the background, you should use a process monitor such as Supervisor to ensure that the Pulse worker does not stop running.
427436
437+
As the `pulse:work` command is a long-lived process, it will not see changes to your codebase without being restarted. You should gracefully restart the command by calling the `pulse:restart` command during your application's deployment process:
438+
439+
```sh
440+
php artisan pulse:restart
441+
```
442+
443+
> [!NOTE]
444+
> Pulse uses the [cache](/docs/{{version}}/cache) to store restart signals, so you should verify that a cache driver is properly configured for your application before using this feature.
445+
428446
<a name="sampling"></a>
429447
### Sampling
430448

queries.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [Where Clauses](#where-clauses)
1414
- [Or Where Clauses](#or-where-clauses)
1515
- [Where Not Clauses](#where-not-clauses)
16+
- [Where Any / All Clauses](#where-any-all-clauses)
1617
- [JSON Where Clauses](#json-where-clauses)
1718
- [Additional Where Clauses](#additional-where-clauses)
1819
- [Logical Grouping](#logical-grouping)
@@ -501,6 +502,53 @@ The `whereNot` and `orWhereNot` methods may be used to negate a given group of q
501502
})
502503
->get();
503504

505+
<a name="where-any-all-clauses"></a>
506+
### Where Any / All Clauses
507+
508+
Sometimes you may need to apply the same query constraints to multiple columns. For example, you may want to retrieve all records where any columns in a given list are `LIKE` a given value. You may accomplish this using the `whereAny` method:
509+
510+
$users = DB::table('users')
511+
->where('active', true)
512+
->whereAny([
513+
'name',
514+
'email',
515+
'phone',
516+
], 'LIKE', 'Example%')
517+
->get();
518+
519+
The query above will result in the following SQL:
520+
521+
```sql
522+
SELECT *
523+
FROM users
524+
WHERE active = true AND (
525+
name LIKE 'Example%' OR
526+
email LIKE 'Example%' OR
527+
phone LIKE 'Example%'
528+
)
529+
```
530+
531+
Similarly, the `whereAll` method may be used to retrieve records where all of the given columns match a given constraint:
532+
533+
$posts = DB::table('posts')
534+
->where('published', true)
535+
->whereAll([
536+
'title',
537+
'content',
538+
], 'LIKE', '%Laravel%')
539+
->get();
540+
541+
The query above will result in the following SQL:
542+
543+
```sql
544+
SELECT *
545+
FROM posts
546+
WHERE published = true AND (
547+
title LIKE '%Laravel%' AND
548+
content LIKE '%Laravel%'
549+
)
550+
```
551+
504552
<a name="json-where-clauses"></a>
505553
### JSON Where Clauses
506554

releases.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,3 @@ Laravel 11 provides additional database schema operation and inspection methods,
365365
$columns = Schema::getColumns('users');
366366
$indexes = Schema::getIndexes('users');
367367
$foreignKeys = Schema::getForeignKeys('users');
368-

reverb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ php artisan reverb:restart
150150

151151
Due to the long-running nature of WebSocket servers, you may need to make some optimizations to your server and hosting environment to ensure your Reverb server can effectively handle the optimal number of connections for the resources available on your server.
152152

153-
> **Note**
153+
> [!NOTE]
154154
> If your site is managed by [Laravel Forge](https://forge.laravel.com), you may automatically optimize your server for Reverb directly from the "Application" panel. By enabling the Reverb integration, Forge will ensure your server is production-ready, including installing any required extensions and increasing the allowed number of connections.
155155
156156
<a name="open-files"></a>

0 commit comments

Comments
 (0)