This library provides a lightweight PHP chatbot engine based on regular expression rules. Developers can simply load this package into any PHP project using composer and immediately deploy the chatbot. The agent can match key words and have “short-term memory” by pattern matching. An example with simple UI and engine is also included in the repository. It is available at


//initialise bot
$chatbot = new Jincongho\Chatbot\Engine;

//add rules using regular expression
//first param is regular pattern
//second param is an array of random reply
$chatbot->add_rule("/(.*)\bAm I\b(.*)/i", array(
    "Would you want to be $2?",
    "What would it mean if you were $2?"

//start conversation!
echo $chatbot->chat("Am I too young?");

//an UI template is also included in the repo