Download the PHP package kakaprodo/system-analytic without Composer
On this page you can find all versions of the php package kakaprodo/system-analytic. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kakaprodo/system-analytic
More information about kakaprodo/system-analytic
Files in kakaprodo/system-analytic
Package system-analytic
Short Description A laravel package that simplifies the collection and visualization of your system analytics.
License MIT
Informations about the package system-analytic
system-analytic
A laravel package that simplifies the implementation of the analytics of your system based on the data in your DB
1. Prerequisites
- php >= 7
- kakaprodo/custom-data package
2. Installation
3. Publishing Skeleton
-
Config file
The above command will create the configuration file with name
system-analytic.php
in the config folder. -
Skeleton files
At this point you can open the
system-analytic.php
file in the config folder. From there you can review all the settings, and customize them according to your desire. Then run the bellow command to create the analyticHub
:
After running the above command, a new folder will be created in your app/Http folder(by default) and in the app/Http/Requests folder. in the next section you are going to discover the magic that will be happening in these files. Put your shoes on π€ͺ
4. Your First Analytic class(handler)
1. Create a handler
To generate the analytic class, you will need to run the bellow command:
A bellow handler will be created, now let's explain this:
As you can see,we have three magic methods and very important to understand:
boot
: the method that you can use as the construct of your handlerquery
: the core of your class, this method will return the value that the package will use to filter data based on the request scope.result
: Will return data on which all filters have been applied, and it is formatted based on the handler type(BarChart).
2. Define Basic query In the Handler
Now we have our handler, let's give it a sens, so that it can return the block chart data of new users of the system
Now we have our handler that returns number of the new users at each date. Note that you can make any logic of your choice to your query and that will work.
3. Register the handler class
Now you have your handler ready to be used. To register your handler you need to
open the AnalyticHandlerRegister
class and register it under the handlers
method. you will see this class in the analytic skeleton folder that we have created early in this doc.
You can see, we have used NewUserBarChart::type()
, the type
method will automatically return the kebak case of the name of your handler class. so if you think you will have multiple handlers with the same names, then you can specify your own names at the place of NewUserBarChart::type()
.
3. Using the handler class
Now to call the handler , we will be using the class AnalyticGate
and the registered name of your handler. Note that, the AnalyticGate
is the gate to all registered handlers.
VERY SIMPLE RIGHT ???π€ͺπ€ͺπ€ͺπ€ͺπ€ͺπ€ͺπ€ͺ!!!
Now from the above code, we have used only two options among the list of options supported by the AnalyticGate
class. here other options you can use
Now i know, you are asking yourself why this dude didn't finish the documentation. πMan, i can not put everything here but trust me, i'm working on the full documentation and you will be the first to know about it once i finish. now high five πβπΎ.
All versions of system-analytic with dependencies
laravel/framework Version >=8.0
kakaprodo/custom-data Version >=2.3.3 || dev-develop