PHP code example of jeyroik / extas-players

1. Go to this page and download the library: Download jeyroik/extas-players library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeyroik / extas-players example snippets


use extas\components\players\PlayerService;

$currentPlayer = PlayerService::getCurrentPlayer();

$identity = //get user identity form outside service
$playerName = $currentPlayer ? $currentPlayer->getName() : $identity;

$player = null;
$playerIdentity = $playerIdentityService->getIdentityByValue($this->client->getId(), $identity);
if (!$playerIdentity) {
        $playerIdentity = $playerIdentityService->createIdentity($this->client->getProvider(), $playerName, $identity) ;
}      
$player = $currentPlayer ?: $playerIdentity->getPlayer();
$playerService->login($player);