Skip to content

kschatzle/starter-snake-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

starter-snake-php

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.

Deploy

Requirements

Running the snake locally

  1. Fork this repo.

  2. Clone repo to your development environment:

    git clone git@github.com:<your github username>/starter-snake-php.git
    
  3. Start the PHP built-in web server:

    php -S localhost:8080
    
  4. 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
    

Deploying to Heroku

  1. Create a new Heroku app:
    heroku create [APP_NAME]
    
  2. Deploy code to Heroku servers:
    git push heroku master
    
  3. Open Heroku app in browser:
    heroku open
    
    or visit http://APP_NAME.herokuapp.com.
  4. View server logs with the heroku logs command:
    heroku logs --tail
    

Questions?

Email battlesnake@sendwithus.com, or tweet @send_with_us.

About

Starter Battlesnake written in PHP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%