A simple Battlesnake AI written in PHP.
Visit https://github.com/battlesnakeio/community/blob/master/starter-snakes.md for API documentation and instructions for running your AI.
This is a bare-bones PHP Battlesnake AI with no frameworks or external dependencies. Composer is recommended for PHP dependencies if you wish to include external libraries during development.
A minimal composer.json
file is included in the project in order to enable deployments on Heroku.
Heroku deployments are configured to use the
nginx webserver with all requests routed to the index.php file in the root of the project.
- PHP 7.3 installed (installation guide). 7.3 is the currently supported version on Heroku.
- Ability to deploy PHP apps to Heroku
-
Clone repo to your development environment:
git clone git@github.com:<your github username>/starter-snake-php.git
-
Start the PHP built-in web server:
php -S localhost:8080
-
Test your snake by sending a POST request with a JSON body to it with cURL
curl -XPOST -H 'Content-Type: application/json' -d '{"hello": "world"}' http://localhost:8080/start
- Create a new Heroku app:
heroku create [APP_NAME]
- Deploy code to Heroku servers:
git push heroku master
- Open Heroku app in browser:
or visit http://APP_NAME.herokuapp.com.
heroku open
- View server logs with the
heroku logs
command:heroku logs --tail
Email battlesnake@sendwithus.com, or tweet @send_with_us.