Hi @codingdefined, thanks again for the review! Happy to know this post is a bit better than the previous ones.
Good point on the .pgn
files. I am not convinced that they should be written in the .gitignore
file though because this data is required by the tests in order to pass OK as shown in https://travis-ci.org/programarivm/pgn-chess/jobs/420206833.
However, the .pgn
files, which are all included in the tests
folder, are ignored in the .gitattributes
file:
/examples/ export-ignore
/resources/ export-ignore
/tests/ export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
This way the tests
folder is not installed locally when doing
composer require programarivm/pgn-chess
Let me show you something regarding the frontend. I wrote this prototype with React and ReactPHP -- the frontend prototype is still sketchy, needs some improvement.
Anyway, here is how the React frontend uses the ReactPHP chess server:
import React from 'react';
import ReactDOM from 'react-dom';
import Board from './components/Board.js';
import './index.css';
var BoardElement = React.createElement(Board, {server: "localhost:3001"});
ReactDOM.render(
BoardElement,
document.getElementById('chess-board')
);
The server looks like this:
namespace ReactPgnChess;
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use ReactPgnChess\PgnChessGame;
require __DIR__ . '/../vendor/autoload.php';
$server = IoServer::factory(
new HttpServer(
new WsServer(
new PgnChessGame()
)
),
3001
);
$server->run();