2017 © Pedro Peláez
 

library href-count

HrefCount is a PHP library that register in database how many times a link is clicked by user

image

emoretti/href-count

HrefCount is a PHP library that register in database how many times a link is clicked by user

  • Thursday, March 15, 2018
  • by emoretticom
  • Repository
  • 0 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

hrefCount - href click counter for PHP

HrefCount is a PHP library that register and store in database, how many times a link is clicked by user., (*1)

Installation

Install the latest version with, (*2)

$ composer require emoretti/href-count ^dev-master

Configuration

Change the attribute in hrefCountConfig class as you needed., (*3)

  1. Change with your site base url, (*4)

        private $BASE_URL = "http://<yoursite>/"; 
    
  2. You can change the key for the query string variable, (*5)

        private $QUERY_STRING_VAR_NAME = "qs"; 
    
  3. Set your database connection data php private $DATABASE_HOST = "localhost"; private $DATABASE_NAME = "test"; private $DATABASE_USR = "root"; private $DATABASE_PWD = ""; private $TABLE_NAME = "href_count";, (*6)

Basic Usage

Create an instance of hrefCount() class in the page you will use the HTML a tag. In the href attribute, insert the call to the href() method, passing the "link" and "alias" values., (*7)



<html>
    <head>
        <title>Click Counter Example</title>
    </head>

    <body>

        <h1>Click Counter PHP - Example use</h1>
        <h2>Click a link to increase the relative counter.</h2>

        <h3>Same Page link</h3>
        <a href="<?php $HC->href('index.php','Homepage') ?>">Homepage</a><br/>

        <h3>Same Page link with get parameter</h3>
        <a href="<?php $HC->href('index.php?test=hello','Homepage_Hello') ?>">Homepage with query string</a>

        <h3>Same page with #anchor link</h3>
        <a href="<?php $HC->href('#ancorar','Homepage_anchor') ?>">Homepage with Anchor</a><br/>


        <h3>Another page link</h3>
        <a href="<?php $HC->href('link1.php','Another page') ?>">Link1</a><br/>

    </body>
</html>

In any linked page you want count the click add, (*8)


Author

Ettore Moretti - info@ettoremoretti.com - https://twitter.com/emoretticom - https://www.facebook.com/emoretticom/, (*9)

License

href-count is licensed under the MIT License - see the LICENSE file for details, (*10)

The Versions

15/03 2018

dev-master

9999999-dev

HrefCount is a PHP library that register in database how many times a link is clicked by user

  Sources   Download

MIT

The Requires