Jump to content

check-side

New Members
  • Posts

    2
  • Joined

  • Last visited

check-side's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey everyone, I'm trying to use a library called php-chess, which can be found here: https://github.com/programarivm/php-chess/ As described in the readme-File, I installed (at my local computer under /opt/lampp/htdocs/chess) it via composer with composer require programarivm/php-chess Imho the installation was successful, since some composer files were created and also the directory '/opt/lampp/htdocs/chess/vendor/programarivm/php-chess', where all the files from the library are stored. After creating the file 'index.php' (stored under /opt/lampp/htdocs/chess) I wrote the following lines: <?php require __DIR__ . '/vendor/autoload.php'; use Chess\Game; $game = new Game(); $isLegalMove = $game->play('w', 'e4'); ?> I'm new to this topic, but I think I did the right thing to load the library with the require-statement in the 1st line. The other lines are copied from the readme-file from the project, because I just wanted to test it. But when loading http://localhost/chess/index.php I get an error: Fatal error: Uncaught Error: Class 'Chess\Game' not found in /opt/lampp/htdocs/chess/index.php:4 Stack trace: #0 {main} thrown in /opt/lampp/htdocs/chess/index.php on line 4 I don't understand what I did wrong here. I loaded the library and the other lines are copied from the author of the project, and I assume he didn't make a mistake. Where is my mistake? How can I use that library? Thanks for your help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.