koraktor / steam-condenser

A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers
https://koraktor.de/steam-condenser
Other
356 stars 67 forks source link

i can't get steam-condenser PHP to work #281

Closed Qoraiche closed 8 years ago

Qoraiche commented 8 years ago

hi , i install steam-condenser and all modules with composer and i create exemple.php file and i add the following code just to test library :

<?php require_once('./lib/SteamCondenser.php'); $server = new SourceServer('193.192.59.19', 27031); ?>

but i always get this error : Fatal error: Class 'SourceServer' not found in C:\wamp\www\steam-condenser-php-master\exemple.php on line 4

koraktor commented 8 years ago

Looking at your code and the error message this seems to be the same problem as mentioned on the mailing list: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/steam-condenser/rmiEzxG01TM/AuqAPrPOCQAJ

So I'm just repeating my reply here:

The master branch is already namespaced. You have to include the classes that you want to use:

use SteamCondenser\Servers\SourceServer;

Add this line after the require_once().

Qoraiche commented 8 years ago

i do what you say here is the code :

<?php

require_once('./lib/SteamCondenser.php'); use SteamCondenser\Servers\SourceServer; $server = new SourceServer('192.168.0.114', 27015); $server->initialize(); print_r($server->getPlayers());

?>

another error :

Fatal error: Class 'SteamCondenser\Servers\SourceServer' not found in C:\wamp\www\steam-condenser-php-master\ex.php on line 7

koraktor commented 8 years ago

Oh, didn’t notice that you’re not using Composer (See https://getcomposer.org/doc/). Install Composer and run composer install.

After that use the following require:

require_once "./vendor/autoload.php";

If you don’t want to use Composer, you can only require all needed files manually.

Qoraiche commented 8 years ago

thanks , fixed now , nice day bro