Yes, it is absolutely possible.
An O program would be a good way to start creating a bot without reinventing the wheel, an O program is an AIML interpreter written in PHP and uses a MySQL database to store chatbot, including AIML files used to formulate chatbot responses.
You can get it on gitHub too
source share