How to Add an AI Chatbot to a PHP Website
PHP powers the majority of the web. Adding a Tuqlas AI chatbot to any PHP site is as simple as echoing a script tag in your layout — no packages, no backend integration required.
01
Create a chatbot on Tuqlas
Sign up at tuqlas.com, create a chatbot, and copy your embed key.
02
Add the script to your layout
In your shared layout or footer partial, add the Tuqlas script tag before the closing </body> tag.
03
Reload
The chat widget appears on every page that includes your layout. No server-side changes needed.
layout.php
<!-- layout.php — before </body> --> <script src="https://tuqlas.com/chatbot.js" data-key="<?= htmlspecialchars($embedKey) ?>" defer ></script> </body> </html>
💡 Tip
Store your embed key in an environment variable or config file and output it with htmlspecialchars to keep things clean and safe.
Ready to add a chatbot to PHP?
Create your chatbot and get your embed key in under a minute.