From 529e5a7a416e2f2a67a601ef7de43afa8b463101 Mon Sep 17 00:00:00 2001 From: Jibbe Winands Date: Mon, 27 Oct 2025 14:51:27 +0100 Subject: [PATCH 1/2] Update Notifications.md --- .../desktop/2/the-basics/notifications.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/resources/views/docs/desktop/2/the-basics/notifications.md b/resources/views/docs/desktop/2/the-basics/notifications.md index d4344671..7098ddbd 100644 --- a/resources/views/docs/desktop/2/the-basics/notifications.md +++ b/resources/views/docs/desktop/2/the-basics/notifications.md @@ -127,6 +127,38 @@ Notification::title('Hello from NativePHP') ->show(); ``` +### Notification Sounds + +You may set a custom audio by using the `sound()` method. + +Setting a sound overrides the system's default notification sound for that notification. + +You can use the system's default notification sounds. On macOS, for example, set the sound to `'Ping'`. + +```php +Notification::title('Hello from NativePHP') + ->sound('Ping') + ->show(); +``` + +You can also provide a custom audio file. If you pass a relative path, prefix it with `file://`; absolute paths don't need the prefix. + +```php +Notification::title('Hello from NativePHP') + ->sound('file://' . resource_path('example.mp3')) + ->show(); +``` + +### Silent Notifications + +Make a notification silent with the `silent()` method: + +```php +Notification::title('Hello from NativePHP') + ->silent() + ->show(); +``` + ### Notification Actions On macOS, you can add action buttons to a notification using the `addAction()` method. From 8f4078141f9a983ebb05a75207c9a35339ff008d Mon Sep 17 00:00:00 2001 From: Jibbe Winands Date: Tue, 28 Oct 2025 17:39:20 +0100 Subject: [PATCH 2/2] Remove file:// prefix --- resources/views/docs/desktop/2/the-basics/notifications.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/docs/desktop/2/the-basics/notifications.md b/resources/views/docs/desktop/2/the-basics/notifications.md index 7098ddbd..d0d145d7 100644 --- a/resources/views/docs/desktop/2/the-basics/notifications.md +++ b/resources/views/docs/desktop/2/the-basics/notifications.md @@ -141,11 +141,11 @@ Notification::title('Hello from NativePHP') ->show(); ``` -You can also provide a custom audio file. If you pass a relative path, prefix it with `file://`; absolute paths don't need the prefix. +You can also provide a custom audio file. ```php Notification::title('Hello from NativePHP') - ->sound('file://' . resource_path('example.mp3')) + ->sound(resource_path('example.mp3')) ->show(); ```