Here’s a third-party PHP implementation of RiveScript that I know about: https://github.com/vulcan-project/rivescript-php but it doesn’t seem very complete.
As an alternative, you can have the PHP script use one of the other RiveScript implementations in other programming languages. There are two general approaches to get PHP to communicate with another programming language: via shell commands or a network.
The Python version includes a command-line client where you can communicate using JSON over standard input/output. i.e., PHP would open a process pipe to `python -m rivescript /path/to/brain`, write a JSON message into its standard input, and read a JSON response from RiveScript’s standard output.
The JavaScript version includes a handful of bot example scripts in its `eg` folder for running RiveScript as various kinds of web services:
* Telnet Server is very similar to the Python CLI client, except it listens on a network socket; a PHP front-end would connect to the socket instead of opening a process pipe but it otherwise would work the same way.
* JSON Server runs a RiveScript bot as a RESTful web API that speaks JSON. PHP could access the bot using standard HTTP request libraries—or you could just have your HTML front-end make ajax requests directly to the RiveScript server and not even need PHP to get involved.
And as a simple option, the JavaScript version of RiveScript can also run directly from the end user’s web browser, without any server-side work needed. The source *.rive files can be loaded via ajax requests. The down side is that anybody could download your .rive sources, and, while you can write object macros in JavaScript to do cool things with the bot, those things are limited by standard web browser security features (can’t do anything that JavaScript can’t normally do in a web browser; but you could post ajax requests to PHP scripts at least).