vask / laravel
Pusher-compatible websockets powered by vask.dev
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0||^12.0||^13.0
- pusher/pusher-php-server: ^7.2
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- driftingly/rector-laravel: ^1.0||^2.0
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^7.10||^8.0
- orchestra/testbench: ^8.22||^9.5||^10.0||^11.0
- pestphp/pest: ^2.34||^3.0||^4.0
- pestphp/pest-plugin-arch: ^2.7||^3.0||^4.0
- pestphp/pest-plugin-laravel: ^2.4||^3.0||^4.0
- pestphp/pest-plugin-type-coverage: ^2.0||^3.0||^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- rector/rector: ^1.0||^2.0
- roave/security-advisories: dev-latest
- spatie/laravel-ray: ^1.35
- dev-main
- 0.0.16
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- dev-dependabot/github_actions/ramsey/composer-install-4
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-7
- dev-dependabot/github_actions/aglipanci/laravel-pint-action-2.6
- dev-dependabot/github_actions/actions/checkout-6
- dev-dependabot/github_actions/dependabot/fetch-metadata-3.1.0
This package is auto-updated.
Last update: 2026-05-12 13:32:11 UTC
README
Drop-in Laravel integration for Vask, Pusher-compatible WebSockets running on Cloudflare. Run php artisan vask:install to OAuth into your account, write PUSHER_* credentials to .env, and verify the connection in one go. The package also ships a webhook handler for channel, presence, and client events, a vask:doctor diagnostic command, and a local-only /_vask/demo page that proves the round-trip end-to-end.
Installation
composer require vask/laravel
Sign up (or sign in) and wire credentials into .env in one command:
php artisan vask:install
This kicks off an OAuth device flow. You'll be shown a URL and a short code
to approve in your browser. Once approved, the command writes
PUSHER_* credentials to .env and runs vask:doctor to confirm the
configuration. No git config or local tokens are used to authenticate.
If you need to verify an existing setup at any time:
php artisan vask:doctor
php artisan vask:doctor --no-ping --no-broadcast # skip the live network checks
Try it in the browser
After vask:install, start your dev server and visit /_vask/demo. It's a
local-only page that subscribes to a private channel and lets you click emoji to
broadcast them, both via the server (POST to Laravel) and as Pusher client events
straight from the browser. It exercises the full round-trip (Laravel to Vask to
browser) and shows you the latency, so you can confirm both your server
credentials and the WebSocket leg without writing a single line of frontend code.
The demo route is only registered when app()->environment() === 'local'. To
turn it off entirely, set VASK_NO_DEMO=true in your .env.
Usage
Vask is a drop-in Pusher replacement, so use Laravel's standard broadcasting:
use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; class OrderShipped implements ShouldBroadcast { public function broadcastOn(): PrivateChannel { return new PrivateChannel('orders.'.$this->order->id); } }
Webhooks
Register handlers in a service provider. The package auto-registers
POST /webhooks/vask the first time it sees a handler. No handler, no route:
use Vask\Laravel\Facades\Vask; use Vask\Laravel\Webhooks\Payloads\ChannelOccupiedPayload; public function boot(): void { Vask::onChannelOccupied(fn (ChannelOccupiedPayload $event) => /* ... */); Vask::onMemberAdded([MemberHandler::class, 'joined']); Vask::onClientEvent(LogClientEvent::class); // invokable class }
The route is registered outside the web middleware group, so CSRF doesn't
apply. To customise: Vask::webhookPath('/api/vask-hooks') or
Vask::disableAutoWebhookRoute() to register your own.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.