Server library

Realtime Laravel with WebSockets

Laravel Broadcasting on the server and Laravel Echo in the browser, with no code changes.

Sign in to see these snippets with your own cluster host. Sign in

Using an AI coding agent? Copy the agent prompt ↓

  1. Install

    composer require pusher/pusher-php-server
    npm install --save-dev laravel-echo pusher-js
  2. Set your app credentials

    BROADCAST_CONNECTION=pusher
    PUSHER_APP_ID=YOUR_APP_ID
    PUSHER_APP_KEY=YOUR_APP_KEY
    PUSHER_APP_SECRET=YOUR_APP_SECRET
    PUSHER_HOST=ws.hibira.io
    PUSHER_PORT=443
    PUSHER_SCHEME=https
    PUSHER_APP_CLUSTER=ap
    
    VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
    VITE_PUSHER_HOST="${PUSHER_HOST}"
    VITE_PUSHER_PORT="${PUSHER_PORT}"
    VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
  3. Configure the client

    // resources/js/echo.js
    import Echo from 'laravel-echo';
    import Pusher from 'pusher-js';
    window.Pusher = Pusher;
    
    window.Echo = new Echo({
      broadcaster: 'pusher',
      key: import.meta.env.VITE_PUSHER_APP_KEY,
      cluster: 'ap',
      wsHost: import.meta.env.VITE_PUSHER_HOST,
      wsPort: import.meta.env.VITE_PUSHER_PORT,
      wssPort: import.meta.env.VITE_PUSHER_PORT,
      forceTLS: import.meta.env.VITE_PUSHER_SCHEME === 'https',
      enabledTransports: ['ws', 'wss'],
    });
    
    window.Echo.private('orders.' + orderId)
      .listen('OrderShipped', (e) => console.log(e.order));
  4. Publish an event

    // Any event that implements ShouldBroadcast
    OrderShipped::dispatch($order);

Agent prompt

Paste this into Claude Code, Cursor, GitHub Copilot or another AI coding agent, and it will wire Hibira into your Laravel project with the settings above.

Replace YOUR_APP_KEY and the other placeholders with the values from your dashboard, or let the agent leave them as environment variables for you to fill in.

Or connect the Hibira MCP server, and your agent can create the app and fill in its credentials itself. Connect your AI coding agent →

Use the app key and secret from your dashboard. Channels, events and authorization endpoints work exactly as they do with Pusher. Library reference ↗