PHP code example of gulaandrij / views-counter-bundle
1. Go to this page and download the library: Download gulaandrij/views-counter-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gulaandrij / views-counter-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ...
new Lavulator\ViewsCounterBundle\CengizhanViewsCounterBundle(),
];
// ...
}
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;
}
}