gulaandrij/views-counter-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

gulaandrij/views-counter-bundle

Composer 安装命令:

composer require gulaandrij/views-counter-bundle

包简介

Symfony document/entity views counter

README 文档

README

ViewsCounter increments views counts for document/entity.

Setup the bundle

Step 1: Install ViewsCounterBundle

ViewsCounter bundle is installed using Composer.

composer require gulaandrij/views-counter-bundle

Enable ViewsCounterBundle in your AppKernel:

// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Lavulator\ViewsCounterBundle\CengizhanViewsCounterBundle(),
    ];

    // ...
}

Step 2: Configure your entity

<?php

namespace YourBundle\YourEntity;

use Lavulator\ViewsCounterBundle\Model\VisitableInterface;
use Lavulator\ViewsCounterBundle\Traits\VisitableEntityTrait;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity()
 */
class Article implements VisitableInterface
{
    use VisitableEntityTrait;

    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    protected $id;

    /**
     * @ORM\Column(name="title", type="string")
     */
    protected $title;

    public function getId()
    {
        return $this->id;
    }

    public function setTitle($title)
    {
        $this->title = $title;
    }

    public function getTitle()
    {
        return $this->title;
    }

}

Usage:

<?php

....
$this->get('views_counter.views_counter')->count($article);
....

How to configure

If you can query builder ( recommendation for cached entity )

# config.yml
....
lavulator_views_counter:
    use_query_builder: true

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固