fiég/statistico-bundle

5.0.1 2020-11-02 16:33 UTC

This package is auto-updated.

Last update: 2024-08-29 03:52:48 UTC


README

Statistico 库提供的包装包。

Build Status Code Coverage Scrutinizer Code Quality

安装

使用 composer

composer require fieg/statistico-bundle:dev-master

添加到 AppKernel.php

$bundles = [
  new Fieg\StatisticoBundle\FiegStatisticoBundle(),
];

配置在 app/config/config.yml

fieg_statistico:
  driver:
    redis:
      client: 'your_redis_service'

用法

将 statistico 注入某个服务

some_service:
    class: Acme\SomeService
    arguments: [@statistico]

用法

namespace Acme;

class SomeService
{
    public function __construct(Statistico $statistico)
    {
        $this->statistico = $statistico;
    }
    
    public function someAction()
    {
        $this->statistico->increment('some.statistic.indentitier');  // increases the statistic with 1
    }
}