PHP code example of vectorxhd / trophy-bundle
1. Go to this page and download the library: Download vectorxhd/trophy-bundle 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/ */
vectorxhd / trophy-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ...
new VectorXHD\TrophyBundle\VectorXHDTrophyBundle(),
];
}
$badge = new Badge();
$badge->setName("Premier badge");
$badge->setActionName('comment');
$badge->setActionCount(1);
// Recuperer le manager
/** @var TrophyManager $trophyManager */
$trophyManager = $this->get('vectorxhd_trophy.manager.trophy');
// Debloquage d'un trophée
$trophyManager->checkAndUnlock($user, 'comment', $commentsUserCount);