Posts

Showing posts from 2025

Multi-stage Docker to speed up code deploy

Of course. Using a multi-stage Docker build is a fantastic way to optimize your Laravel application's build time in a CI/CD pipeline. The strategy is to separate the installation of dependencies (which don't change often) from your application code (which changes frequently). Here is a complete, production-ready example using a multi-stage Dockerfile for your Laravel application. This setup assumes you are using Vite for your frontend assets, which is the default in recent Laravel versions. ### The Multi-Stage Dockerfile Create a file named Dockerfile in the root of your Laravel project with the following content: # --- Stage 1: PHP Dependencies (Composer) --- # This stage installs composer dependencies. It's only rebuilt when # composer.json or composer.lock changes. FROM composer:2.5 as vendor WORKDIR /app COPY database/ database/ COPY composer.json composer.lock ./ # Install dependencies for production RUN composer install --no-interaction --no-dev --no-scripts --prefer-...

How to integrate Google Recaptcha with HTMX - Full Example

 If you are having trouble integrating HTMX and Google ReCAPTCHA, please find the below Gist for your reference. It is actually very surprise to know that HTMX did not have such common integration example. (Direct link) https://gist.github.com/alucard001/b013a26d72af9b17dadd5e0d575488ef

[GA4] Generate Exploration report using event parameters

Presumption: You are using GA4 + GTM (optional) You submit to GA a custom event (e.g. mycustomevent) with some event parameters e.g. {"key1": "value1", "key2": "value2"} Now you want to generate a report based on `key1` to see how many events happened Here is how: You first define a "Custom Definition" As of this writing, it is in: Admin - Property Settings - Data display - Custom definitions Click "Create Custom Dimension" Set whatever dimension name you want.   For example in my case the name is: "Key 1" Scope set to "event" (default) Enter any description, or not if you don't want to Event parameter: enter value that is "Exactly" as you defined in event parameters. For example in my case, it is "key1" Click save. Now go to "Explorer" in your GA dashboard on the left Create or select a report you want to edit In "dimension" on the left, click the "+" b...