🔥 Here are some of the most basic monitoring techniques you can start using immediately:
- Spatie laravel-health
- Error tracking
- Syntethic checks
It takes ~30 minutes to set up these.
🧵 Keep Reading
Health checks with laravel-health
The package can check:
- CPU load
- Disk space utilization
- Database connectivity
- Redis
- And even query speed
The example contains pre-built checks. For instance, it notifies you if the average CPU load is higher than 2.5 in the last 5 minutes or 2 in the previous 15 minutes.
It also notifies you if the used disk space is more than 70%
🔥 Most applications need to export and import large amounts of data.
It is very easy to:
- Waste lots of memory
- Perform hundreds or thousands of unnecessary DB queries
You can avoid them by learning some pretty simple techniques.
🧵 Keep Reading
1/
When it comes to working with larger datasets one of the best you can apply to any problem is chunking. Divide the dataset into smaller chunks and process them. It comes in many different forms.
2/ Let's start with a simple CSV or XLS export since it's a common feature in many applications. laravel-excel is a pretty good package that you can use.
There are lots of low-quality projects when it comes to dealing with money, numbers, percentages, transactions, and all that financial stuff.
Here are some tips that you can use:
- Value objects
- moneyphp/money
- Model casts
🧵Keep Reading
1/9 Cent values
In order to handle money values in a reliable way we need to store them as cent values. Instead of storing $19.99 as 19.99 in the database, we store it as 1999. This way we'll have no problem with decimal points, rounding, multiplying, or dividing numbers.
2/9 Value objects
The other thing we can do is to use value objects instead of treating them as float numbers in PHP. So instead of this: