connectholland/timechimp-bundle

Symfony 4项目的Timechimp组件包

安装: 948

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 4

分支: 2

类型:symfony-bundle

1.1.1 2020-11-05 08:59 UTC

This package is auto-updated.

Last update: 2023-10-05 16:48:29 UTC


README

Scrutinizer Code Quality Code Coverage Build Status

Symfony 4项目的Timechimp组件包

安装

composer require connectholland/timechimp-bundle

环境

设置环境变量以便连接到Timchimp API。

TIMECHIMP_ACCESS_TOKEN=the-api-key

使用方法

自动注入客户端,例如。

<?php

declare(strict_types=1);

namespace App;

use ConnectHolland\TimechimpBundle\Api\Client\Client;

class SomeService
{
    private Client $client;

    public function __construct(Client $client)
    {
        $this->client = $client;
    }
    
    public function someMethod()
    {
        $this->client->getTimeByDateRange((new \DateTime('yesterday'))->format('Y-m-d'), (new \DateTime('now'))->format('Y-m-d'));
    }
}