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

404 commits in the last year

longest streak 21 dayscurrent 4

7,317 XPMaximum rank (UID 0)

Today

Running Model::where('status', 'pending')->chunk(200, ...) and updating status to 'processed' inside the callback silently skips half your rows because OFFSET shifts as rows leave the filter. Switching to chunkById(200) paginates by id > $lastId so every row gets…
Oh… this ones bites like a b… thanks so much for this tips! Shouldn’t we have a whole app dedicated to those precious tips? Laravel is full of surprises sometimes 😅
Running next/image on a small 2-vCPU VPS without tuning minimumCacheTTL or offloading transforms to a CDN can quietly peg CPU when bots crawl product galleries. Caching /_next/image aggressively at the Nginx layer keeps origin load flat.
For any dynamic image generation (product cards, OG previews), you might also like Takumi (takumi-js). It's a Rust-based JSX-to-image renderer that skips headless browsers and SVG steps—super light on a 2-vCPU VPS when crawlers hit hard.
If you write standalone PHP CLI workers outside Horizon, enabling pcntl_async_signals(true) and trapping SIGTERM to flip a $shouldStop flag lets the current loop iteration finish cleanly before exiting. Without it, a routine container restart kills a job mid-write.
Running WHERE name ILIKE '%term%' on a 2M-row customers table forces a sequential scan every time because leading wildcards defeat regular B-tree indexes. Enabling pg_trgm and adding a GIN (name gin_trgm_ops) index dropped our admin search bar latency from 1.2 seconds down…
Configuring Laravel's RateLimiter::for() to key off $request->user()?->tenant_id ?: $request->ip() instead of just the user ID stops one noisy integration script from eating up rate limits for other tenants, while still capping a single workspace's runaway sync loop.

Yesterday

Turning on proxy_cache_lock on; in Nginx stops a thundering herd of concurrent requests from hitting your PHP-FPM upstream when a popular cached page expires. Only the first request passes through to rebuild the cache while the rest wait briefly for that single response.
Still see legacy PHP codebases using SQL_CALC_FOUND_ROWS with FOUND_ROWS() for pagination thinking it saves a database round-trip. In modern MySQL it forces the engine to materialize or scan the full unpaginated result set, whereas a separate COUNT(*) query can use a tiny…
Instead of wrapping microtime(true) around two competing Eloquent queries to see which one is faster, passing an array of closures to Illuminate\Support\Benchmark::dd(['subquery' => fn () => ..., 'join' => fn () => ...], iterations: 50) prints the average millisecond timings…

Wed, Nov 18

Creating a full GIN (payload) index on a heavy JSONB column bloats write amplification when you only ever filter by payload->>'event_type'. A targeted B-tree expression index on ((payload->>'event_type')) is a fraction of the disk size and much faster to update on…
Running WHERE LOWER(email) = LOWER(?) on a login endpoint bypasses a standard B-tree index on email and scans the whole users table. Either add a functional index on LOWER(email) or normalize emails to lowercase before saving so lookups stay under a millisecond.
Wrapping non-critical third-party analytics pings or cache warmers in Laravel's rescue(fn () => ..., report: true) keeps the main HTTP response from throwing a 500 if an external telemetry service blips, while still sending the exception to Sentry or Nightwatch.
Replacing defineProps(['modelValue']) and defineEmits(['update:modelValue']) pairs with const model = defineModel<string>() across our reusable form inputs deleted hundreds of lines of boilerplate in our Inertia views without changing how parent components bind v-model.
Writing custom openssl_encrypt() wrappers with manual IV concatenation and HMAC checks is way too easy to get subtly wrong. PHP's built-in sodium_crypto_secretbox() handles authenticated encryption in a single call and has been baked into core since PHP 7.2.

Tue, Nov 17

Wrapping expensive permission or feature-flag lookups inside Laravel's once(fn () => ...) helper caches the return value in memory for the current request instance and automatically flushes between Octane requests or queue jobs.

Sun, Nov 15

Storing money as BIGINT in minor units (cents/poisha) works fine until you hit multi-currency FX conversions or fractional unit pricing where you need four decimal places. Using NUMERIC(19, 4) in Postgres paired with brick/money in PHP avoids floating-point rounding bugs…
Just as you don't have multiple time zones in a system, you don't add multiple currencies. That is inviting problems. You use foreign currencies for input and display. Everything else is on your preferred currency alone. Bringing modules and architecture to juggle multiple moving…
Routing 50MB video or ZIP uploads through PHP-FPM workers ties up memory and socket connections when a user is on a slow mobile connection. Generating a signed Storage::temporaryUploadUrl() and letting the browser PUT straight to S3 or R2 keeps backend workers free for actual…
I am thirsty of low-memory tips like this one, keep up the good work... 💾
Using { ...formState } when resetting or snapshots-comparing nested form objects in React still shares references on inner arrays, so mutating a nested line-item quietly corrupts your dirty-check baseline. Native structuredClone(formState) handles deep copies cleanly without…
Switching PgBouncer from session pooling to transaction pooling let our 2-vCPU Postgres instance handle 600 concurrent PHP-FPM workers using only 25 actual backend database connections. Just remember to disable prepared statement caching on the PDO side if you're on an older…

Sat, Nov 14

Wrapping a 100k-row CSV or API sync inside a single DB::transaction() is a trap—one malformed row at 95% either rolls back the entire run or leaves your database half-imported with no clean way to resume. I built laravel-data-pipeline to handle streaming ETL in Laravel without…
GitHubGitHub - robelsust/laravel-data-pipeline: Streaming ETL pipelines for Laravel with batch validation, transactional checkpoints, deduplication, and quarantine recovery.Streaming ETL pipelines for Laravel with batch validation, transactional checkpoints, deduplication, and quarantine recovery. - robelsust/laravel-data-pipeline
A query with WHERE tenant_id = ? AND status = 'active' ORDER BY created_at DESC LIMIT 20 will still trigger an expensive Using filesort in MySQL if your index only covers (tenant_id, status). Appending created_at to the end of that composite index lets InnoDB read the top…