Md. Khorshed Alam

@robelsust

Full-stack engineer and entrepreneur building native developer tools and modern web applications for the Laravel and WP ecosystem.

Commit activity

478 commits in the last 6 months

longest streak 21 dayscurrent 10

8,554 XPMaximum rank (UID 0)

Today

Laravel 13.44 adding lockForNoKeyUpdate() for PostgreSQL is a great addition for busy billing tables. It locks the target row against concurrent updates without blocking child inserts that only reference its primary key via foreign keys.
When a Postgres query suddenly jumps from 20ms to 2 seconds under load, check temp_blks_written in pg_stat_statements. That usually means a sort or hash join outgrew work_mem and started spilling temporary files straight to disk.
PHP 8.5's clone($dto, ['status' => 'paid']) syntax makes immutable readonly value objects so much nicer to work with. You no longer need half a dozen withStatus() boilerplate methods on every DTO just to swap one property.
Publishing a container port with ports: - "6379:6379" in Docker Compose writes rules straight into iptables and completely bypasses UFW on Ubuntu. Always bind internal databases and caches to 127.0.0.1:6379:6379 so you don't expose Redis or Postgres to the public internet.
When a background queue job dispatches an invoice or receipt email for a user whose saved language is Spanish or Bengali, Laravel defaults to config('app.locale') unless you chain ->locale($user->locale) on the notification or implement HasLocalePreference on the User…

Yesterday

Post (Laravel / Cache::memo() or Arr::accessible / Eloquent toSql()): Calling $query->toRawSql() in Laravel Tinker when debugging a weird Eloquent scope beats guessing where the bindings go in toSql(). Seeing the exact interpolated SQL string ready to paste straight into psql or…

Tue, Nov 24

Calling $request->mergeIfMissing(['sort' => 'desc', 'per_page' => 25]) inside FormRequest::prepareForValidation() keeps default pagination and sorting in one place so controllers don't end up littered with $request->input('per_page', 25) fallbacks.
Prefixing your session cookie name with __Host- forces browsers to require Secure, Path=/, and no Domain attribute. Even if a forgotten marketing subdomain ever gets hijacked, it can no longer plant or overwrite session cookies on your main application domain.
Calling Notification::assertSentTo($user, InvoicePaid::class) in a Pest test still passes if a duplicate listener fires the email three times in a row. Swapping to Notification::assertSentToTimes($user, InvoicePaid::class, 1) caught a double observer registration for us…
By default, Nginx's gzip on; only compresses text/html and leaves application/json, application/javascript, and image/svg+xml completely uncompressed. Listing those MIME types in gzip_types (or enabling Brotli) shrank our API response payloads by 75% on slow mobile…
Calling json_encode($payload) without JSON_THROW_ON_ERROR silently returns false if a string contains invalid UTF-8 bytes, which can turn an API response into an empty body with zero error logs. Passing JSON_THROW_ON_ERROR makes malformed data fail loudly right at the…

Mon, Nov 23

Calling Str::limit($body, 120) directly on rich-text or Markdown-rendered HTML can slice right through a closing </strong> or </a> tag and break the rest of your page layout. Running strip_tags() first or using Str::words() on plain text keeps preview cards from eating…
Casting query-string flags in PHP with (bool) $request->input('active') evaluates the string 'false' as true, which causes sneaky filter bugs on GET endpoints. Calling $request->boolean('active') handles 'true', 'false', '1', '0', and 'on' properly in one call.
In PostgreSQL, VARCHAR(255) has zero storage or speed advantage over TEXT, and picking an arbitrary length limit often forces painful migrations later. Using TEXT with a CHECK (char_length(slug) <= 255) constraint gives you the exact same validation while letting you…
Using the array index as a React key on any table that supports sorting, filtering, or row deletion causes local input values and checkbox state to stick to the wrong item after a filter update. Always key dynamic rows by a stable database ID or UUID.
Keep in mind that max_execution_time is hardcoded to 0 (unlimited) in PHP's CLI SAPI, even if your web php.ini caps requests at 30 seconds. Always pass an explicit --timeout to queue:work or set HTTP client timeouts so a hung third-party endpoint doesn't freeze a worker…

Sun, Nov 22

If your immutable Docker PHP-FPM container still ships with opcache.validate_timestamps=1, PHP is firing stat() syscalls on thousands of vendor files every second just to check if code changed on disk. Flipping opcache.validate_timestamps=0 in production removes all that…
Big-brain thinking right here. You definitely want this on in your dev env, but in an immutable production image, there's no need for it.
In SQL, WHERE user_id NOT IN (SELECT owner_id FROM blocked_accounts) silently returns zero rows if even one row in blocked_accounts has a NULL owner_id. Writing it with NOT EXISTS avoids that three-valued logic trap completely and gives Postgres a cleaner hash anti-join…
Rotating a session ID on every single request sounds good on paper until two parallel React fetch() calls fire at once and the second one gets a 401 because the first already invalidated the old cookie. Keep session regeneration strictly on login, password reset, and privilege…

Sat, Nov 21

Remember that bcrypt silently truncates passwords at 72 bytes, so two completely different 80-character passphrases with the same prefix evaluate as identical. Using Argon2id via PASSWORD_ARGON2ID in PHP avoids that limit entirely without needing any custom SHA-256…