PHPackages                             emoretti/href-count - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. emoretti/href-count

ActiveLibrary[Database &amp; ORM](/categories/database)

emoretti/href-count
===================

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

111PHP

Since Mar 14Pushed 8y agoCompare

[ Source](https://github.com/emoretticom/href-count)[ Packagist](https://packagist.org/packages/emoretti/href-count)[ RSS](/packages/emoretti-href-count/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (1)Used By (0)

hrefCount - href click counter for PHP
======================================

[](#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.

Installation
------------

[](#installation)

Install the latest version with

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

Configuration
-------------

[](#configuration)

Change the attribute in `hrefCountConfig` class as you needed.

1. Change with your site base url

    ```
    	private $BASE_URL = "http:///";
    ```
2. You can change the key for the query string variable

    ```
    	private $QUERY_STRING_VAR_NAME = "qs";
    ```
3. Set your database connection data

    ```
    	private $DATABASE_NAME = "test";
    	private $DATABASE_USR = "root";
    	private $DATABASE_PWD = "";
    	private $TABLE_NAME = "href_count"; ```
    ```

Basic Usage
-----------

[](#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.

```

		Click Counter Example

		Click Counter PHP - Example use
		Click a link to increase the relative counter.

		Same Page link
