Welcome to the Build A Bot workshop! This branch represents the finished project. To pick up at an earlier stage of the project, use one of these branches:
If you haven't already, please review the requirements for this workshop, and join the PNWPHP 2017 Slack to get help when you need it.
Happy hacking!
P.S. This is the only branch that has a composer.lock file. For quicker dependency downloads,
composer install
from here before switching to another branch. Installing from here means
you'll have all the dependencies you'll need for the workshop.
- PHP 7.1
- OpenSSL + ctype extensions (See Dockerfile for a full extension list)
- DOM + mbstring extensions for PHPUnit (included in Docker build)
- Composer
- An api.ai account; you'll need a "Client access token" from there to populate the API_AI_KEY environment variable.
Run using one of the below methods, then visit http://localhost:9000/bot
to view
the bot page. Use a tool like ngrok to make your application
available to the outside world, then set https://your-hostname-here.ngrok.io/hook
as the destination of your api.ai agent web hook.
docker build . -t build-a-bot
docker run -p 9000:80 -e API_AI_KEY=xxxxxxxxx -v $(pwd):/var/app build-a-bot
Some quick notes:
- This container uses nginx and php-fpm, managed by runit. I tried to minimize image size and resource usage while still providing a self-contained appliance.
- App files are copied on build. If you don't need live updating, remove the
volume mount (
-v
) parameter in the second command above.
API_AI_KEY=xxxxxxxx php -S 0.0.0.0:9000 -t public