virmyt/symfony-user-referer-bundle

Symfony 2 User referer bundle

Installs: 88

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.0.0 2014-12-20 18:12 UTC

This package is not auto-updated.

Last update: 2024-04-09 05:59:37 UTC


README

This package contains a bundle to easily save information about referal users that came to your web-site All users that registrate on web-site, and come to it with containing GET argument "ref" (http://site.com/downloads?ref=hfkjgv), will be saved with additional information: ref, ip, referer, date

Installation

Add SymfonyUserReferer in your composer.json:

{
    "require": {
        "virmyt/symfony-user-referer-bundle": "dev-master"
    }
}

Add in AppKernel.php:

       $bundles = array(
            ...
            new \Virmyt\UserRefererBundle\VirmytUserRefererBundle(),
        );

Configure entity mapping to your User Entity:

doctrine:
    ...
    orm:
        ...
        resolve_target_entities:
            Virmyt\UserRefererBundle\Model\ReferrerInterface: App\MainBundle\Entity\User

where App\MainBundle\Entity\User - should be your User Entity.

And it MUST implement Virmyt\UserRefererBundle\Model\ReferrerInterface

<?php
use Virmyt\UserRefererBundle\Model\ReferrerInterface;
class User implements ReferrerInterface {
    public function getRef()
    {
        return $this->ref; // For examle
    }
...

Update DB schema:

php app/console doctrine:schema:update --dump-sql -v --force

Usage:

All Referal data about user will be saved in single table users_referral that have relation to your UserEntity.