This is a Tic Tac Toe game built in PHP 7 with Symfony 4!
- PHP 7.2.6
- Docker Compose (for docker usage)
Clone this repository using HTTPS or SSH
$ git clone [email protected]:programadormarin/tictactoe.git
Install all the backend dependencies using composer
$ composer install
If you don't have PHP running in your local machine, user Docker Compose to build this application.
$ docker-compose up --build -d
Now just go to http://localhost:8000
and enjoy!
To run the tests just access the path of project and run:
$ bin/phpunit
If you are using docker for application and not running PHP on your local machine please run the following commmands:
$ docker-compose exec php ./bin/phpunit
POST http://localhost:8000/api/move
{
"playerUnit" : "X",
"boardState" :
[
["X", "O", ""],
["X", "O", "O"],
["", "", ""]
]
}
Response 200 OK
{
"nextMove": [0, 1, 'O'],
"winner": "X",
"tied": false
}
Using curl:
curl -X POST \
http://localhost:8000/api/move \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"playerUnit" : "X",
"boardState" :
[
["X", "O", ""],
["X", "O", "O"],
["", "", ""]
]
}'