As an independent developer, my main concern is to ensure that all the projects I manage are functioning correctly, for both my clients and my personal projects.
I find myself asking questions like: Has a client's shop made a coherent turnover for a Tuesday? Have new users signed up on some of my side projects? Is the average amount of bookings made on another service satisfactory?
I could log in to each application's dashboard to check, but let's be honest, I don't do it every day (and certainly not several times a day), and I might miss something important.
Therefore, I needed a solution that was easy and quick to implement for each of the projects I manage. The initial idea of this project is to take advantage of the fact that every Laravel project (among others) shares certain common features, such as timestamps on tables.
The second idea is as follows: Can we assume that the number of entities (Eloquent model) generated by an application is sufficient to know if an application is functioning correctly?
Let's assume that it is (which is obviously a simplification, but let's abstract from that): if my client X's online shop generates between 10 and 20 orders per day, it means I have indeed between 10 and 20 Bill models created in my database. Therefore, I can just count the number of Bills generated hour by hour and pour this information into my dashboard. If this value suddenly varies significantly, I will be able to notice it instantly and react accordingly. This works with all entities of a project, such as User, ActivityLog, etc.
From there, I created a unique dashboard into which these counting data by project are poured. To identify a project (which I call a source), it is based on the URL, env('APP_URL'), and its environment env('APP_ENV').
Thus, the project source of my client is https://urlsiteclient.com in the "production" environment.
Quite quickly, I realized that in some cases, the number of entities created was not sufficient. For example, I might want to sum or average the "total amount" property. And of course, models often have types or statuses, and it was necessary to be able to filter models, so I added scope support.
To make all this easy to configure, I created a PHP library named eloquentize/laravel-eloquentize-client (a version for Symfony will be released shortly).
To use Eloquentize and control key data across multiple Laravel applications (whatever their version, starting from 5.6), you need to:
Create an account on eloquentize.com.
Generate an API key.
Copy the API key into your application's .env file: ELOQUENTIZE_API_TOKEN=your_api_key_here.
Install with: composer require eloquentize/laravel-eloquentize-client.
Run: php artisan eloquentize:models-count.
Use eloquentize:property-aggregate for your specific data.
Optionally, launch eloquentize:models-count-legacy and property-aggregate-legacy to retrieve data since the launch of your application.
Lastly, for those interested in this solution but wishing to try it before making a commitment, Eloquentize offers a 5-day trial period without the need to provide credit card information. This opportunity allows you to fully test the features and effectiveness of Eloquentize on your Laravel projects, risk-free. It's the perfect chance to discover how this library can simplify the monitoring and analysis of your application data.