Download the PHP package mmdm/sim-hit-counter without Composer

On this page you can find all versions of the php package mmdm/sim-hit-counter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sim-hit-counter

Simplicity Hit-Counter

A simple library for count users' hits.

Attention

PLEASE NOTE THAT this library is good only for small websites so... DO NOT USE THIS for high traffic websites and use more professional tools to handle huge database and server overheads.

Install

composer

Or you can simply download zip file from github and extract it, then put file to your project library and use it like other libraries.

Just add line below to autoload files:

and you are good to go.

Architecture

This library use database to have its best performance

Collation:

It should be utf8mb4_unicode_ci because it is a very nice collation. For more information about differences between utf8 and utf8mb4 in general and unicode please see this link from stackoverflow

Table:

How to use

First of all you need a PDO connection like below:

Then create hit counter instance and use its methods

HitCounter class

__construct(PDO $pdo_instance, ?array $config = null, bool $test_mode = false)

$config: The config of yours like the one in Architecture.

see config file under src/_Config path.

$test_mode: By default users ip addresses that are unknown or invalid, crawlers and DNT header are not allowed to hit website. To prevent this check, send true as parameter's value.

runConfig()

To make config working and create tables, call this method.

hitDaily(string $url)

Make a daily hit.

hitWeekly(string $url)

Make a weekly hit.

hitMonthly(string $url)

Make a monthly hit.

hitYearly(string $url)

Make a yearly hit.

hit(string $url, int $hit_at_times = IHitCounter::TIME_ALL)

Make a hit for a specific period of time according to second parameter. please see Constants section

Note: You can use multiple constants together with | operator

report(?string $url, int $from_time, int $to_time, int $hit_with_types = self::TYPE_ALL): array

You can get count of views and unique_views from specific/all url(s) from a specific time and for a specific type.

freeReport(?string $url, string $where, array $bind_values = []): array

You can get count of views and unique_views from specific/all url(s) with specific condition.

Note: You should use names parameters and put value of that parameter in $bind_values parameter.

saveDailyHits(string $path_to_store, bool $delete_from_database = false): bool

Save all daily hits information before today in a file.

saveWeeklyHits(string $path_to_store, bool $delete_from_database = false): bool

Save all weekly hits information before this week in a file.

saveMonthlyHits(string $path_to_store, bool $delete_from_database = false): bool

Save all monthly hits information before this month in a file.

saveYearlyHits(string $path_to_store, bool $delete_from_database = false): bool

Save all yearly hits information before this year in a file.

saveHits(string $path_to_store, int $hit_at_times = self::TIME_ALL, bool $delete_from_database = false): bool

Save all hits information before current time in a file.

Note: You can use multiple constants together with | operator

Constants

There are some constants in IHitCounter interface class as below:

Time constants:

Hit types constants:

License

Under MIT license


All versions of sim-hit-counter with dependencies

PHP Build Version
Package Version
Requires ext-pdo Version *
ext-json Version *
jenssegers/agent Version ^2.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mmdm/sim-hit-counter contains the following files

Loading the files please wait ....