Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions resources/views/docs/desktop/2/the-basics/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Copy link
Member

@simonhamp simonhamp Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nicer if the sound method added the file:// prefix rather than forcing the developer to apply it

->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.
Expand Down