Add MyLiveChat to your Laravel app

Laravel renders every page from a shared Blade layout, so a single edit covers the whole application. Add the chat code to the layout that your pages @extends — usually resources/views/layouts/app.blade.php — and it appears everywhere that layout is used.

Use this guide to add MyLiveChat to Laravel. The free plan includes one agent, unlimited chats, and unlimited websites — no credit card required.

If you do not have a MyLiveChat account yet, create a free MyLiveChat account.

Start free
Live chat setup guide

Step 1. Get your MyLiveChat code

Sign in to the MyLiveChat web console and click Deployment menu on the left. Choose Embedded Chat tab and copy the MyLiveChat code.

Step 2. Add the code to your Laravel project

  1. Open resources/views/layouts/app.blade.php, or whichever layout your pages extend.
  2. Paste the MyLiveChat code from Step 1 immediately before the closing </body> tag.
  3. Save the file, then run php artisan view:clear so the compiled Blade views are rebuilt.
  4. Reload a page and confirm the launcher appears.

If your app uses more than one layout — a marketing layout and an authenticated layout, for example — add the code to each one, or pull it into a partial such as resources/views/partials/livechat.blade.php and @include it from every layout so there is only one copy to maintain.

Check that live chat is working

Do not assume the install worked because you saw no error. Open your site in a private browsing window and walk through this once:

  1. Look for the chat launcher on the page. If it is missing, view the page source and search for mylivechat to confirm the code is really being served.
  2. Start a chat as a visitor and send a test message.
  3. Sign in to the web console and confirm the message arrives and that you can reply.
  4. Close the chat and check the transcript is saved, so you know follow-up will work.

If the code does not appear in the page source, clear the view cache. Blade compiles templates to PHP and serves the compiled copy, so an edit that is not reflected in the browser is almost always a stale compiled view.

Common Laravel setup mistakes

  • The view cache was not cleared. Blade serves compiled templates. Run php artisan view:clear after editing a layout, especially on a server where view:cache has been run.
  • Only one of several layouts was edited. Pages that extend a different layout will have no chat button. Check each layout, or use a shared partial.
  • A Content Security Policy blocked the script. If your app sends a CSP header, it must allow the MyLiveChat domain in script-src or the widget will never load.
  • The code went into a page view instead of the layout. That gives you chat on one route only. Put it in the layout so it covers the application.

What happens next?

After setup, sign in to the web console to answer visitors from your browser. You can also use the desktop app from the download page if your team prefers it.

Want the AI to answer first? Point the AI assistant at your site content and it handles routine questions 24/7, then hands off to a human with the full transcript when one is needed.

Why add live chat to a Laravel app?

Laravel powers a great many SaaS products and customer portals — places where the visitor already has an account and a specific, urgent problem. Chat reaches them before they open a ticket.

Because the widget is one line in a layout, it costs no routes, no controllers and no migrations. Nothing about your application structure has to change.

Laravel live chat FAQ

Which Blade file should I edit?

The layout your pages extend, typically resources/views/layouts/app.blade.php. Add the code just before the closing body tag.

I edited the layout and nothing changed. Why?

Blade serves compiled views. Run php artisan view:clear so the template is recompiled.

How do I cover several layouts at once?

Put the code in a partial and include it from each layout, so there is a single copy to update later.

Does it work with Livewire or Inertia?

Yes. The widget attaches to the document, so partial page updates and client-side navigation do not remove it.

Is it really free?

Yes. One agent, unlimited chats, and unlimited websites are free forever, with no credit card required.

Make the chat window fit your site

Colours, position, language, the pre-chat form and your offline message are all set in your MyLiveChat dashboard rather than in your Laravel code, so you can change them without editing your project again. See customization options for what can be changed, and visitor monitoring if you want to see which page a visitor is on before you reply.

Related guides

New to live chat? Start with how to add live chat to your website and the live chat launch checklist, then live chat best practices once you are answering real conversations. Also useful: Live chat for SaaS onboarding and Securing chat integrations and API keys. If you are worried about page speed, see does live chat slow down your website.

Any questions?

If anything is unclear, contact our support team from the chat button on this page or visit the Support page. We can help you choose the right setup path.

Free forever for 1 agent

Give every visitor an instant way to reach you.

Launch live chat, connect your knowledge base, and add AI answers when you are ready. No credit card, no trial clock.