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.
- Under 60 seconds
- Zero dependencies
- No build step
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.