Skip to content

Commit

Permalink
Statamic 5: Docs Update (#94)
Browse files Browse the repository at this point in the history
* Update installation docs

* Bump vite from 4.3.9 to 4.5.2 (#93)

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.3.9 to 4.5.2.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.2/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.2/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Ability to disable sound effects (#96)

* Sound effects should be enabled by default.

* Document the config option to disable sound effects

Related: #96

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
duncanmcclean and dependabot[bot] authored Apr 15, 2024
1 parent 36d0846 commit 6a2c519
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 132 deletions.
85 changes: 63 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- statamic:hide -->
# Collaboration

> Realtime collaboration and multi-user authoring for Statamic Pro.
> Real-time collaboration and multi-user authoring for Statamic Pro.
<!-- /statamic:hide -->
## Features
Expand All @@ -12,40 +12,81 @@

## Installation

Require it using Composer, as well as the Pusher library.
You can install and configure the Collaboration addon using a single command:

```
composer require statamic/collaboration
composer require pusher/pusher-php-server "^5.0"
php please install:collaboration
```

Uncomment `BroadcastServiceProvider` from `config/app.php`'s `providers` array if it isn't already.
The command will install the `statamic/collaboration` addon, setup Laravel's broadcast scaffolding and prompt you to select which broadcast driver you wish to use.

``` php
'providers' => [
// ...
App\Providers\BroadcastServiceProvider::class,
// ...
]
```
For more information on the specifics for each broadcast driver, please review the following:

### Laravel Reverb

The `install:collaboration` command will install Laravel Reverb into your application. After installation, run `php artisan reverb:start` to run Reverb's WebSockets server, then the Collaboration addon should start working in the Control Panel.

When you deploy your application to a server, you will need to run the Reverb WebSockets server as a daemon (`php artisan reverb:start`). If you're using Laravel Forge, there's a Reverb toggle in your site's "Application" panel.

For further information on Reverb, please review the [Laravel documentation](https://laravel.com/docs/master/reverb#introduction).

In your `.env` file, make sure the `pusher` broadcast driver is used:
### Pusher

The `install:collaboration` command will install [Pusher](https://pusher.com/)'s PHP SDK into your application. After installation, you should add your Pusher credentials to your `.env` file:

```
BROADCAST_DRIVER=pusher
PUSHER_APP_ID="your-pusher-app-id"
PUSHER_APP_KEY="your-pusher-key"
PUSHER_APP_SECRET="your-pusher-secret"
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME="https"
PUSHER_APP_CLUSTER="mt1"
```

Create an app inside your [Pusher account](https://pusher.com).
You should also ensure you have enabled the "Client Events" setting (found under the "App Settings" page in the Pusher Dashboard).

### Other

If you're planning on using a different broadcasting driver, there are a few additional steps you'll need to take to get it working:

1. Install & configure your broadcasting driver (obviously)
2. Update the `BROADCAST_DRIVER` in your `.env`
3. Create a `resources/js/cp.js` file and add it to the Control Panel.
* [For more information, follow this guide on our documentation site](https://statamic.dev/extending/control-panel#adding-css-and-js-assets).
4. In your `resources/js/cp.js` file, register a callback to override Statamic's [Echo](https://laravel.com/docs/10.x/broadcasting#client-side-installation) config:

```js
Statamic.booting(() => {
Statamic.$echo.config(() => ({
broadcaster: "pusher",
key: Statamic.$config.get('broadcasting.pusher.key'),
cluster: Statamic.$config.get('broadcasting.pusher.cluster'),
wsHost: Statamic.$config.get('broadcasting.pusher.host'),
wsPort: Statamic.$config.get('broadcasting.pusher.port'),
wssPort: Statamic.$config.get('broadcasting.pusher.port'),
forceTLS: false,
encrypted: true,
disableStats: true,
enabledTransports: ["ws", "wss"],
}));
});
```

Be sure to enable the "Client Events" setting (under the "App Settings" page in your Pusher App Dashboard).
## Configuration

Add your Pusher app credentials to your `.env` file:
### Sound Effects

```
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=
By default, the Collaboration addon plays sound effects when other users join & leave entries.

If you wish to disable these, you may publish the configuration file (via `php artisan vendor:publish --tag=collaboration`) and set `sound_effects` to `false`.

```php
// config/collaboration.php

return [
'sound_effects' => false,
];
```

## Advanced Usage
Expand Down
17 changes: 17 additions & 0 deletions config/collaboration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Sound Effects
|--------------------------------------------------------------------------
|
| This determines whether or not the open sound effects are played when a
| user joins or leaves a room.
|
*/

'sound_effects' => true,

];
Loading

0 comments on commit 6a2c519

Please sign in to comment.