PHP code example of varandas / epic-free-games

1. Go to this page and download the library: Download varandas/epic-free-games 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/ */

    

varandas / epic-free-games example snippets




use Varandas\EpicFreeGames\EpicFreeGames\EpicGamesService;

// Create an instance
$epicGamesService = new EpicGamesService();

// Get free games
$games = $epicGamesService->getFreeGames();

// Process the retrieved games
// ...



use Varandas\EpicFreeGames\EpicFreeGames\EpicGamesService;

// Create an instance
$epicGamesService = new EpicGamesService();

// Set country and locale
$epicGamesService->setCountry('BR')->setLocale('pt-BR');

// Get free games
$games = $epicGamesService->getFreeGames();

// Process the retrieved games
// ...



use Varandas\EpicFreeGames\EpicFreeGames\EpicGamesService;

// Create an instance
$epicGamesService = new EpicGamesService();

// Get free games
$games = $epicGamesService->getFreeGames();

// Process the retrieved games
foreach ($games as $game) {
    $title = $game->getTitle();
    $id = $game->getId();
    $namespace = $game->getNamespace();
    $description = $game->getDescription();
    $effectiveDate = $game->getEffectiveDate();
    $offerType = $game->getOfferType();
    $expiryDate = $game->getExpiryDate();
    $viewableDate = $game->getViewableDate();
    $isCodeRedemptionOnly = $game->isCodeRedemptionOnly();
    $status = $game->getStatus();
    $keyImages = $game->getKeyImages();
    $seller = $game->getSeller();
    $productSlug = $game->getProductSlug();
    $urlSlug = $game->getUrlSlug();
    $url = $game->getUrl();
    $items = $game->getItems();
    $customAttributes = $game->getCustomAttributes();
    $categories = $game->getCategories();
    $tags = $game->getTags();
    $catalogNs = $game->getCatalogNs();
    $offerMappings = $game->getOfferMappings();
    $price = $game->getPrice();
    $promotions = $game->getPromotions();
    $promotionalOffers = $game->getPromotionalOffers();
    $upcomingPromotionalOffers = $game->getUpcomingPromotionalOffers();
    
    // Do something with the data
    // ...
}