定制 dwr/lottoclient-bundle 二次开发

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

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

dwr/lottoclient-bundle

最新稳定版本:1.0

Composer 安装命令:

composer require dwr/lottoclient-bundle

包简介

Symfony2 bundle which helps connect to polish lotto server (Totalizator sportowy).

README 文档

README

Build Status Scrutinizer Code Quality

DwrLottoClient

This bundle helps to take results from polish national lottery

Installation

Installation is a quick 3 steps process:

  1. Download DwrLottoClientBundle using composer.
  2. Enable the Bundle.
  3. Use bundle in your controller.

Step 1: Download DwrAvatarBundle using composer

Add DwrGlobalWeatherBundle in your composer.json:

{
    "require": {
        "dwr/lottoclient-bundle": "1.0"
    }
}

Download the bundle by running the command:

$ php composer.phar require dwr/lottoclient-bundle

Composer will install the bundle into your project's vendor/dwr/lottoclient-bundle directory.

Step 2: Enable the bundle

Enable the bundle in the kernel:

//app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Dwr\LottoClientBundle\DwrLottoClientBundle(),
    );
}

Step 3: Use bundle in your controller

    
    use Dwr\LottoClientBundle\Service\LottoClient; //don't forget add this line above class declaration
   

    /**
     * @Route("/", name="homepage")
     */
    public function indexAction()
    {

        $lotto = $this->get('dwr_lotto_client');
        $resultsDL = $lotto->getRecentlyResults(LottoClient::DUZY_LOTEK, 1); //takes last result from Duży lotek
        $resultsK  = $lotto->getRecentlyResults(LottoClient::KASKADA, 5); //takes 5 recently results from Kaskada
        
        var_dump($resultsDL);
        var_dump($resultsK);

        $date = new \DateTime('2014-10-10');
        $resultMINI = $lotto->getResultsByDate($date, LottoClient::MINI_LOTEK, 2); //takes 2 recently results from giving date for Mini Lotek
        $resultMULTI = $lotto->getResultsByDate($date, LottoClient::MULTI_LOTEK, 3); //takes 3 recently results from giving date for Multi Lotek

        var_dump($resultMINI);
        var_dump($resultMULTI);

        return $this->render('default/index.html.twig');
    }

Congratulations! You're ready to embed lotto results in your symfony2 application.

Usage

Add this in your controller:

    use Dwr\LottoClientBundle\Service\LottoClient; //don't forget add this line above class declaration

    /**
     * @Route("/", name="homepage")
     */
    public function indexAction()
    {

        $lotto = $this->get('dwr_lotto_client');
        
        /**
         * In order to take last result from Duży lotek pass 1 as a second argument for getRecentlyResults method.
         * Maximum you can take 10 recently results.
         */
        $resultsDL = $lotto->getRecentlyResults(LottoClient::DUZY_LOTEK, 1);
        var_dump($resultsDL); 
        
        /**
         * In order to take archive results use getResultsByDate method.
         * Specify date (e.g. new \DateTime('2014-10-10')) and pass it as first argument.
         */
        $date = new \DateTime('2014-10-10');
        $resultMINI = $lotto->getResultsByDate($date, LottoClient::MINI_LOTEK, 2);
        var_dump($resultMINI);
    }

Available lottery types:

LottoClient::DUZY_LOTEK
LottoClient::MINI_LOTEK
LottoClient::MULTI_LOTEK
LottoClient::JOKER
LottoClient::KASKADA

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-30