2017 © Pedro Peláez
 

library simple-stats

A simple system to log events in your PHP app

image

jlaso/simple-stats

A simple system to log events in your PHP app

  • Sunday, July 17, 2016
  • by jlaso
  • Repository
  • 1 Watchers
  • 3 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

simple-stats

A simple system to log events in your PHP app, (*1)

Installation

You need only to require this package in your project composer require jlaso/simple-stats, (*2)

Configuration (optional)

In order to let know the library where it can put it's database file and other things related with setup you can copy the distribution file config-stats-base.yml.dist in the root of your project with the config-stats-base.yml, (*3)

This file contains:, (*4)

database:
    driver: pdo_sqlite
    path: "%project_dir%/app/cache/simple_stats.sqlite"
    charset: UTF8    

models:
    - clicks
    - ips
    - logins

The database key configures how the sqlite will work, and the models key informs SimpleStats about the events we want to register. Any change on any of these keys requires remove the sqlite database file in order that SimpleStats recreates new one., (*5)

For the moment no migration process is allowed., (*6)

Info

That library uses svg files in order to show the results of the statistics., (*7)

Commands

In order to check the examples I provided a couple of commands that you can start from terminal, (*8)

Create demo data

Create thousand of records in every event table with invented data., (*9)

src/console database:create-and-seed, (*10)

Create a graph svg file with the data

src/console graph:create --graph=scatter --event="clicks,ips,logins" --title="Events by day" 
open temp.svg.html

As you can see you can just pass one event table or several separated by commas. The output default file is temp.svg.html., (*11)

Graphs provided

As I told you the system uses a third party SVG library in order to represent statistical data., (*12)

For the moment there are this graph available:, (*13)

Bar

Use: Data ordered in a bar or piles way, (*14)

, (*15)

Scatter

Use: Data with X reference (2d) with one or several dimensions, (*16)

, (*17)

Running the examples

Go to terminal and start PHP listening in the root folder of the project php -S localhost:8000, (*18)

Now you can go with your favourite browser to http://localhost:8000/samples/index.html, (*19)

For the moment there are two examples. You have to see the same data in both, but using different technology. Just to show you how easy is to use this library., (*20)

The Versions

17/07 2016

dev-master

9999999-dev https://github.com/jlaso/simple-stats

A simple system to log events in your PHP app

  Sources   Download

MIT

The Requires

 

The Development Requires

log events stats