定制 varandas/epic-free-games 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

varandas/epic-free-games

Composer 安装命令:

composer require varandas/epic-free-games

包简介

A small PHP package designed to facilitate interactions with the Epic Games Store API, enabling developers to retrieve details about the currently available free games.

README 文档

README

Overview

This is a simple package that grabs the current free games from the Epic Games Store and returns them.

Installation

composer require varandas/epic-free-games

Usage

<?php

use Varandas\EpicFreeGames\EpicFreeGames\EpicGamesService;

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

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

// Process the retrieved games
// ...

Setting Country and Locale

<?php

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
// ...

Game Object

The Game object Varandas\EpicFreeGames\Models\EpicGame has the following getters:

Getter Description
getTitle() The title of the game
getId() The id of the game
getNamespace() The namespace of the game
getDescription() The description of the game
getEffectiveDate() The date the game became free
getOfferType() The type of the offer
getExpiryDate() The date the game will stop being free
getViewableDate() The date the game will be visible
getStatus() The status of the game
isCodeRedemptionOnly() Whether the game is only redeemable with a code
getKeyImages() The key images of the game
getSeller() The seller of the game
getProductSlug() The product slug of the game
getUrlSlug() The url slug of the game
getUrl() The url of the game
getItems() The items of the game
getCustomAttributes() The custom attributes of the game
getCategories() The categories of the game
getTags() The tags of the game
getCatalogNs() The catalog namespace of the game
getOfferMappings() The offer mappings of the game
getPrice() The price of the game
getPromotions() The promotions of the game
getPromotionalOffers() The promotional offers of the game
getUpcomingPromotionalOffers() The upcoming promotional offers of the game

This is how you can use the getters

<?php

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
    // ...
}

Sample response

This is an example of the response from the Epic Games Store API - so that you can see what data is available.

{
    "title":"Tandem: A Tale of Shadows",
    "id":"9142916d80f54720b01f8f62b21014be",
    "namespace":"d1a3ff292b2f4ee289a83d7a91ae3458",
    "description":"Tandem : A Tale of Shadows redefines the puzzle platformer genre with a unique gameplay and exceptional aesthetics. Help Emma and the teddy bear Fenton solve the mystery of the disappearance of the famous magician Thomas Kane.",
    "effectiveDate":"2021-10-21T16:00:00.000Z",
    "offerType":"BASE_GAME",
    "expiryDate":null,
    "viewableDate":"2021-07-16T16:00:00.000Z",
    "status":"ACTIVE",
    "isCodeRedemptionOnly":false,
    "keyImages":[
        {
            "type":"OfferImageWide",
            "url":"https://cdn1.epicgames.com/spt/c087c527-0c2b-4269-926b-f0d15102de8a/tandem-a-tale-of-shadows-offer-633449e1.jpg"
        },
        {
            "type":"OfferImageTall",
            "url":"https://cdn1.epicgames.com/spt/2c1d81ab-12e7-40a6-9edd-a449cc619ad5/download-tandem-a-tale-of-shadows-offer-5c6a45df.jpg"
        },
        {
            "type":"Thumbnail",
            "url":"https://cdn1.epicgames.com/spt/2c1d81ab-12e7-40a6-9edd-a449cc619ad5/download-tandem-a-tale-of-shadows-offer-5c6a45df.jpg"
        }
    ],
    "seller":{
        "id":"o-722pvnj3qsvbzvskhx4r8x7gcxhhbn",
        "name":"Hatinh Interactive"
    },
    "productSlug":null,
    "urlSlug":"24ed2fb76b334158b9e580c01f7282a6",
    "url":null,
    "items":[
        {
            "id":"7c02053bfee24d028aa1bec03edd6a82",
            "namespace":"d1a3ff292b2f4ee289a83d7a91ae3458"
        }
    ],
    "customAttributes":[
        {
            "key":"autoGeneratedPrice",
            "value":"false"
        },
        {
            "key":"isBlockchainUsed",
            "value":"false"
        }
    ],
    "categories":[
        {
            "path":"freegames"
        },
        {
            "path":"games"
        },
        {
            "path":"games/edition"
        },
        {
            "path":"games/edition/base"
        }
    ],
    "tags":[
        {
            "id":"1298"
        },
        {
            "id":"18051"
        }
    ],
    "catalogNs":{
        "mappings":[
            {
                "pageSlug":"tandem-a-tale-of-shadows-c3f55e",
                "pageType":"productHome"
            }
        ]
    },
    "offerMappings":[
        {
            "pageSlug":"tandem-a-tale-of-shadows-c3f55e",
            "pageType":"productHome"
        }
    ],
    "price":{
        "totalPrice":{

        },
        "lineOffers":[

        ]
    },
    "promotions":{
        "promotionalOffers":[
            {
                "promotionalOffers":[
                    {
                        "startDate":"2023-10-18T15:00:00.000Z",
                        "endDate":"2023-11-01T15:00:00.000Z",
                        "discountSetting":{
                            "discountType":"PERCENTAGE",
                            "discountPercentage":50
                        }
                    },
                    {
                        "startDate":"2023-10-26T15:00:00.000Z",
                        "endDate":"2023-11-02T15:00:00.000Z",
                        "discountSetting":{
                            "discountType":"PERCENTAGE",
                            "discountPercentage":0
                        }
                    }
                ]
            }
        ],
        "upcomingPromotionalOffers":[
            {
                "promotionalOffers":[
                    {
                        "startDate":"2023-12-16T23:00:00.000Z",
                        "endDate":"2023-12-31T11:00:00.000Z",
                        "discountSetting":{
                            "discountType":"PERCENTAGE",
                            "discountPercentage":40
                        }
                    }
                ]
            }
        ]
    }
}

Disclaimer

Portions of the materials used are trademarks and/or copyrighted works of Epic Games, Inc. All rights reserved by Epic. This material is not official and is not endorsed by Epic.

License

This package is licensed under the MIT License - see the LICENSE file for details.

varandas/epic-free-games 适用场景与选型建议

varandas/epic-free-games 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 varandas/epic-free-games 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 varandas/epic-free-games 我们能提供哪些服务?
定制开发 / 二次开发

基于 varandas/epic-free-games 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-30