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

362 commits in the last year

longest streak 21 dayscurrent 1

6,655 XPMaximum rank (UID 0)

Today

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…
Reading headers() or cookies() inside a shared layout helper in Next.js quietly opts every child route out of static rendering without a single build warning. Moving that header check into middleware or a leaf component brought our cached route TTFB back down to 15ms.
Configuring a dedicated database connection in Laravel with options => [PDO::ATTR_TIMEOUT => 5] and SET statement_timeout = '5s' for user-facing CSV and analytics filters keeps a single unindexed date-range query from pegging CPU across the primary database.
Adding v-memo="[row.id, row.status, isSelected]" to a 1,500-row table in Vue 3 stopped the entire grid from re-rendering every time a user ticked a single checkbox. Virtual scrolling is overkill when skipping unnecessary VNode diffs already drops frame time below 4ms.
By default, a single failed job inside Bus::batch() marks the entire batch as cancelled and skips the then() callback. Chaining ->allowFailures() when dispatching bulk webhook or email batches lets healthy jobs keep processing while you inspect the failed rows inside…

Fri, Nov 13

Always keep retry_after on your Redis queue connection at least 15 to 30 seconds higher than the longest job $timeout. When those two numbers are equal, Redis releases the job back to another worker the exact second the first worker is still trying to finish, and your payment…
Checking whether a user has any audit log rows with if ($user->auditLogs()->count() > 0) forces MySQL to scan and count every matching index entry. Using $user->auditLogs()->exists() compiles down to SELECT EXISTS(... LIMIT 1) and stops scanning on the very first match.
Always pass an explicit minute limit to ->withoutOverlapping(15) on scheduled commands in Laravel instead of relying on the default 24-hour mutex TTL. If a container gets OOM-killed mid-run, waiting a full day for the cache lock to expire on its own will quietly stall your…

Thu, Nov 12

When multiple cron workers pull pending payout rows from the same table, plain SELECT ... FOR UPDATE makes the second worker sit idle waiting on row locks. Adding SKIP LOCKED lets each worker grab the next unlocked batch immediately without stepping on each other.

[deleted]This commit was deleted.

Wrapping a migration that adds an index on a 20M-row Postgres table inside a default transaction block will lock writes across the table until the index finishes building. Disabling the migration transaction and running CREATE INDEX CONCURRENTLY lets production traffic keep…
Calling Http::preventStrayRequests() inside TestCase::setUp() caught two tests in our suite today that were quietly hitting a live sandbox webhook URL on every CI run. Now any unmocked Http:: call fails immediately with a clear exception instead of slowing down the test…
Rate limiting by $remote_addr in Nginx behind Cloudflare will throttle Cloudflare's edge nodes instead of the actual scraper if you haven't configured real_ip_header CF-Connecting-IP with Cloudflare's IP ranges. Learned that the hard way once when a single bot briefly locked…
Found a legacy staging database running without STRICT_TRANS_TABLES where a 300-character webhook payload was silently getting chopped down to VARCHAR(255) without throwing an exception. Turning strict SQL mode on in config/database.php caught three hidden schema mismatches…

Wed, Nov 11

Calling $request->session()->regenerate() right after a successful login or privilege elevation in Laravel is easy to overlook when building custom auth flows, but skipping it leaves the old session ID valid if it was ever leaked on a shared connection.