<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Idada Osaigbovo James on Medium]]></title>
        <description><![CDATA[Stories by Idada Osaigbovo James on Medium]]></description>
        <link>https://medium.com/@osaswijojames?source=rss-3a198d9c479f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*j5kpMKOL25JG615e</url>
            <title>Stories by Idada Osaigbovo James on Medium</title>
            <link>https://medium.com/@osaswijojames?source=rss-3a198d9c479f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:34:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@osaswijojames/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Ultimate Free Agentic AI Coding Setup (Even When You’re Not on the Official Map)]]></title>
            <link>https://medium.com/@osaswijojames/the-ultimate-free-agentic-ai-coding-setup-even-when-youre-not-on-the-official-map-eb7930477574?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb7930477574</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Thu, 03 Dec 2026 21:44:20 GMT</pubDate>
            <atom:updated>2026-12-03T22:07:40.044Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MwoHTpI1g2pzpbkCxvwJBQ.jpeg" /><figcaption>Nvidia and Opencode</figcaption></figure><p>If you are a developer living in a region that isn’t explicitly listed on a major tech company’s location selector, you know the pain. You find a great free tool, go to sign up, and hit a wall.</p><p>Recently, I decided to see if I could build a complex full-stack application using a “<strong>completely free</strong>” agentic AI coding setup. My goal was to use OpenCode (an open-source AI coding agent) powered by NVIDIA’s free NIM API endpoints.</p><p>It took a few hours of trial and error, wrestling with WSL, JSON configurations, and rapidly deprecating models. But I finally cracked it.</p><p>Here is exactly how to set up a free, fast, and highly capable agentic coding environment on Windows, and the specific models you should use right now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GHhElxjHS3MMQRrWibrJNg.png" /></figure><h3>Step 1: Getting the NVIDIA API Key (The Workaround)</h3><p>NVIDIA’s `<a href="https://build.nvidia.com/">build.nvidia.com</a>` offers free API endpoints for prototyping. However, if your country isn’t on their official location selector (like Nigeria, in my case), the standard sign-up flow will block you at the phone verification step.</p><h4>The Solution: Register as an Organisation</h4><p>Instead of fighting the personal account flow, bypass it by creating an organization:<br>1. Go to a <a href="https://build.nvidia.com/models">model</a> page and click “Generate API Key”.<br>2. Register with your email.<br>3. On the “Create an NVIDIA Cloud Account” page, enter an organisation name (e.g., `MyDevTeam`). <br>4. This step typically skips the phone verification entirely. <br>5. Once inside the dashboard, go to `build.nvidia.com/settings/api-keys` and generate your key.</p><p><strong>Crucial</strong>: Make sure you check the “Public API Endpoints” permission.<br><strong>PS</strong>: You can <a href="https://build.nvidia.com/models?filters=nimType%3Anim_type_preview&amp;q=coding">filter</a> by coding models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iCyD--23qrWzILWGgBbkbA.png" /><figcaption>preview of filterable coding models</figcaption></figure><h3>Step 2: Bridging OpenCode and Windows</h3><p>OpenCode is a fantastic agentic coding tool, but it’s highly optimised for Linux. If you are running the Windows app, you might run into a classic problem: your Windows app cannot see the environment variables you set in your WSL terminal.</p><p>To fix this, we need to explicitly tell OpenCode how to connect to NVIDIA using a configuration file.</p><ol><li>Create a file named opencode.json in the root directory of your project.</li><li>Paste the following configuration (replace YOUR_KEY_HERE with your actual nvapi-... key):</li></ol><pre>{<br>  &quot;$schema&quot;: &quot;https://opencode.ai/config.json&quot;,<br>  &quot;provider&quot;: {<br>    &quot;nvidia&quot;: {<br>      &quot;npm&quot;: &quot;@ai-sdk/openai-compatible&quot;,<br>      &quot;name&quot;: &quot;NVIDIA NIM&quot;,<br>      &quot;options&quot;: {<br>        &quot;baseURL&quot;: &quot;https://integrate.api.nvidia.com/v1&quot;,<br>        &quot;apiKey&quot;: &quot;YOUR_KEY_HERE&quot;<br>      },<br>      &quot;models&quot;: {<br>        &quot;poolside/laguna-xs-2.1&quot;: {<br>          &quot;name&quot;: &quot;Laguna XS 2.1&quot;<br>        },<br>        &quot;nemotron-3-ultra-550b-a55b&quot;: {<br>          &quot;name&quot;: &quot;Nemotron 3 Ultra 550B&quot;<br>        }<br>      }<br>    }<br>  }<br>}</pre><p><em>Note: If you prefer not to hardcode your key, you can set </em>NVIDIA_API_KEY<em> in your Windows system environment variables and restart the app.</em></p><h3>Step 3: Choosing the Right Models (Beware the Graveyard)</h3><p>NVIDIA’s free tier is a revolving door. Models like qwen/qwen2.5-coder-32b-instruct and qwen/qwen3-coder-480b were brilliant, but they have reached their end-of-life and will return 404 errors. Models like Kimi K3.1 Pro are incredibly powerful, but on the free shared endpoints, they can take over 5 minutes to respond, which is completely unacceptable for live, iterative coding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QxIeefa7JGlvCSZ0Sm_8Kw.png" /></figure><p>After testing numerous models, I found a two-model workflow that works perfectly:</p><h4>1. The Workhorse: poolside/laguna-xs-2.1</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NokRtCaGpVP3XoxwXtwJ_A.png" /><figcaption>Laguna</figcaption></figure><ul><li>Why it’s great: <a href="https://build.nvidia.com/poolside/laguna-xs-2.1">This is a 33B parameter</a> model designed for long-horizon agentic coding. Its SWE-bench Verified score is an impressive 70.9%.</li><li>The Speed: Because it’s smaller (with only 3B active parameters), it responds in seconds. This is the model you want to use for scaffolding your app, writing Vue components, and creating database migrations.</li></ul><h4>2. The Heavy Thinker: nemotron-3-ultra-550b-a55b</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oPbaSA0erV1nnzlHKDyvBQ.png" /><figcaption>Nemotron</figcaption></figure><ul><li>Why it’s great: <a href="https://build.nvidia.com/nvidia/nemotron-3-ultra-550b-a55b">A massive 550B parameter hybrid</a> Mamba-Transformer MoE model with a 1M token context window. It excels at complex reasoning and tool calling.</li><li>The Trade-off: It’s slower. You don’t want to use this for simple tasks, but when you need to figure out complex database locking logic, idempotent webhooks, or debug a massive stack trace, switch to Nemotron.</li></ul><h3>Step 4: The Agentic Workflow in Action</h3><p>Once you have your opencode.json set up, restart OpenCode and select Laguna XS 2.1 from the model dropdown.</p><p>Set OpenCode to Build mode, and start prompting. Because Laguna is fast, it feels like pair-programming. You can tell it:</p><blockquote>“Create a Laravel migration for a <em>generations</em> table. It needs columns for <em>user_id</em>, <em>prompt</em>, <em>status</em>, <em>estimated_cost_cents</em>, and <em>actual_cost_cents</em>. All money must be stored as integers to avoid floating-point errors.&quot;</blockquote><p>If it encounters a tricky error, or if you need to implement a complex state machine for webhooks, switch to Nemotron 3 Ultra. Paste the code and the error, and ask it to reason through the flaw.</p><p>PS: If you want to brainstorm a little bit more, set OpenCode to Planmode.</p><h3>Final Thoughts</h3><p>Free AI tools are getting incredibly powerful, but the landscape is messy. Endpoints disappear, regions are blocked, and UI wrappers can struggle with environment variables.</p><p>By manually configuring your JSON, understanding the difference between fast models (Laguna) and smart models (Nemotron), and knowing how to bypass regional account locks, you can build a completely free, highly capable agentic coding setup anywhere in the world.</p><p><em>Have you tried building with OpenCode and NVIDIA NIM? What models are you finding the most success with right now? Let me know in the comments!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb7930477574" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Breaking Free From the Cloud: Running Ollama and OpenCode Locally on an Intel i7]]></title>
            <link>https://medium.com/@osaswijojames/breaking-free-from-the-cloud-running-ollama-and-opencode-locally-on-an-intel-i7-d98cba4119a1?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d98cba4119a1</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Fri, 06 Nov 2026 01:22:46 GMT</pubDate>
            <atom:updated>2026-11-06T01:22:46.006Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aITKJyh3uw8A6SO1uS4rqA.png" /><figcaption>Ollama and OpenCode</figcaption></figure><p>Most developers hit the same wall.</p><p>You are in the zone, deep into refactoring an abstract service layer or hunting down a race condition, when your AI workspace suddenly throws a hard stop: &quot;Free usage exceeded, subscribe to Go&quot;.</p><p>The natural response is frustration. The second response is hopping between free cloud models, only to discover that OpenCode’s Zen free tier tracks account usage globally across all cloud providers. Model-hopping won’t bypass the lockout block until the timer resets at midnight UTC.</p><p>Your options are simple: pay $20/month for a subscription, or set up a local AI engine.</p><p>If you want complete privacy, zero rate limits, and full autonomy, running your models entirely locally is the ultimate escape hatch.</p><p>In my previous article on <a href="https://medium.com/@osaswijojames/copy-paste-ai-is-dead-how-agentic-tools-like-opencode-are-transforming-software-development-c74db366417e">agentic AI tools</a>, I promised a complete blueprint for local agentic workflows. This is that playbook.</p><p>We will cover the complete pipeline: installing <strong>Ollama</strong>, fixing OpenCode’s configuration blockers, optimizing performance for mid-tier CPU/RAM hardware, solving model knowledge gaps, and weighing the real-world trade-offs.</p><h3>The Hardware Reality: What We Are Working With</h3><p>Before touching a terminal, we need to talk about hardware. Local AI guides often assume you are sitting on a liquid-cooled workstation with an NVIDIA RTX 4090 boasting 24GB of VRAM.</p><p>That is not what most engineers carry around on daily client calls.</p><p>Here are the target specs for this setup (modeled on a typical <strong>Dell Latitude 5430</strong> development machine, my machine(😉😏)):</p><ul><li><strong>OS:</strong> Windows 11 Pro / WSL2</li><li><strong>CPU:</strong> 12th Gen Intel Core i7–1265U (10 cores, 12 threads)</li><li><strong>RAM:</strong> 32 GB DDR4 (3200 MT/s)</li><li><strong>GPU:</strong> Intel Iris Xe Integrated Graphics (128 MB dedicated system memory mapping)</li><li><strong>Storage:</strong> ~60 GB available NVMe storage</li></ul><h3>The Architectural Diagnosis</h3><ol><li><strong>The Bottleneck (No Discrete GPU):</strong> Integrated Intel Iris Xe graphics lack dedicated VRAM. This means we cannot rely on CUDA acceleration. All tensor operations and matrix math will be executed <strong>100% by the CPU</strong>.</li><li><strong>The Saving Grace (32GB RAM):</strong> AI models loaded by Ollama reside directly in system RAM when running on CPU. With 32GB available, Windows won’t crash, swap, or freeze your active browser tabs while holding a multi-billion parameter model in memory.</li><li><strong>The Rule:</strong> Because CPU processing is inherently slower at token generation than a dedicated GPU, <strong>model selection is everything</strong>. We must stick strictly to ultra-lightweight, quantized models under <strong>8 Billion parameters (&lt; 8B)</strong>.</li></ol><h3>Step 1: Installing &amp; Configuring the Ollama Engine</h3><p><a href="https://ollama.com/">Ollama</a> acts as the orchestration layer. It handles model weights, memory allocation, and provides an OpenAI/Anthropic-compatible HTTP API endpoint running locally on port 11434.</p><p>Understanding how Ollama operates gives us two distinct execution paths:</p><ol><li><strong>Locally (On your machine):</strong> Zero cost, complete privacy, unlimited tokens, but execution speed is tightly bound to your hardware.</li><li><strong>In Ollama’s Cloud (Remote):</strong> For heavy models that struggle on a mid-range CPU without a discrete GPU, Ollama offers hosted cloud models ending in :cloud (e.g., ollama pull gemma4:cloud). The free tier includes lightweight usage for cloud models, while heavier cloud workloads require signing in via ollama signin or setting an API key from ollama.com/settings/keys.</li></ol><p>For maximum privacy and zero subscriptions, we will stick strictly to <strong>100% local execution</strong>.</p><h3>1. Download and Install</h3><p>You can download the Windows installer directly from <a href="https://ollama.com/download">ollama.com/download</a>.</p><p>Alternatively, install it via CLI in PowerShell:</p><pre>irm https://ollama.com/install.ps1 | iex</pre><p><em>(For macOS/Linux users, run </em>curl -fsSL [https://ollama.com/install.sh](https://ollama.com/install.sh) | sh<em>)</em>.</p><p>Once installed, Ollama runs silently in your background system tray and exposes a local REST API endpoint at:</p><p><a href="http://localhost:11434/">http://localhost:11434</a></p><h3>2. Pulling Optimized Models</h3><p>Open your terminal and pull the <strong>Qwen 2.5 Coder</strong> suite. Qwen 2.5 currently offers the highest reasoning-to-size performance ratio for software development tasks.</p><p>For fast, inline code completion and light chat on CPU:</p><pre>ollama run qwen2.5-coder:1.5b</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4TZIfqoLu30hWo70yYCweA.png" /></figure><p><em>(Optional)</em> If you need deeper architectural reasoning and don’t mind a slightly slower token output (roughly 8–15 tokens/sec on an i7 CPU), pull the 7-billion parameter version:</p><pre>ollama pull qwen2.5-coder:7b</pre><h3>Step 2: Linking Ollama into OpenCode (And Fixing Configuration Blockers)</h3><p>This is where many developers get stuck. OpenCode Desktop does not always auto-discover local instances cleanly without defined structural layouts.</p><p>Furthermore, navigating directly to the config directory (C:\Users\YOUR_USER\.config\opencode\) using the Windows Run box (Win + R) can throw a <strong>&quot;Path Not Found&quot;</strong> error because hidden directories and config files do not exist until forced.</p><h3>Resolution: One-Line PowerShell Setup</h3><p>Rather than manually creating hidden folders in Windows File Explorer, run this one-line PowerShell script to force directory generation, create a blank opencode.json configuration file, and open it immediately in Notepad:</p><pre>New-Item -Path &quot;$env:USERPROFILE\.config\opencode\opencode.json&quot; -ItemType File -Force; notepad &quot;$env:USERPROFILE\.config\opencode\opencode.json&quot;</pre><h3>The opencode.json Configuration</h3><p>Once Notepad opens, paste the following configuration declaring your local Ollama connection provider (http://localhost:11434/v1) using the @ai-sdk/openai-compatible specification:</p><pre>{<br>  &quot;$schema&quot;: &quot;https://opencode.ai/config.json&quot;,<br>  &quot;provider&quot;: {<br>    &quot;ollama&quot;: {<br>      &quot;npm&quot;: &quot;@ai-sdk/openai-compatible&quot;,<br>      &quot;name&quot;: &quot;Ollama Local&quot;,<br>      &quot;options&quot;: {<br>        &quot;baseURL&quot;: &quot;http://localhost:11434/v1&quot;<br>      },<br>      &quot;models&quot;: {<br>        &quot;qwen2.5-coder:1.5b&quot;: {<br>          &quot;name&quot;: &quot;Qwen 2.5 Coder 1.5B (Local)&quot;<br>        },<br>        &quot;qwen2.5-coder:7b&quot;: {<br>          &quot;name&quot;: &quot;Qwen 2.5 Coder 7B (Local)&quot;<br>        }<br>      }<br>    }<br>  }<br>}</pre><p>Save the file and restart <strong>OpenCode</strong>. Under <strong>Settings</strong> -&gt; <strong>Providers</strong>, your local Ollama engine is now permanently linked and available without relying on cloud servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t3ZG-qeMNicp0ELn-0GHjw.png" /></figure><h3>Step 3: Overcoming the “Static Knowledge” Problem</h3><p>A major hurdle with local models is that their weights are static. If a model was trained up to early 2024, it knows <strong>Laravel 7</strong> routing conventions inside out, but remains blind to structural changes in <strong>Laravel 8</strong> or newer.</p><p>Unlike cloud agents that combine search with massive context windows, local models need deliberate context-injection strategies.</p><pre>                  +----------------------------------------------+<br>                  |           Static Local Model                 |<br>                  |        (Knowledge Cutoff Point)              |<br>                  +----------------------------------------------+<br>                                         |<br>         +-------------------------------+-------------------------------+<br>         |                               |                               |<br>         v                               v                               v<br>+------------------+           +------------------+           +------------------+<br>|   Method A:      |           |   Method B:      |           |   Method C:      |<br>| Context Mentions |           | Custom Modelfile |           |   MCP Web Search |<br>|  (@file.md)      |           |   System Prompt  |           |     Live Scrape  |<br>+------------------+           +------------------+           +------------------+</pre><p>Here are three ways to bridge that gap inside OpenCode:</p><h3>Method A: Context Injections (The @ Mention)</h3><p>Pass documentation files explicitly inside your chat prompts.</p><p>If you are upgrading an application, save the release notes or API changes directly inside your repository as a Markdown file (e.g., docs/laravel8-upgrade.md).</p><p>When prompting OpenCode, call the file directly:</p><blockquote>“How do I refactor my routes to match the new class-based syntax in <em>@docs/laravel8-upgrade.md</em>?&quot;</blockquote><p>OpenCode scrapes the text file and injects it straight into the model’s short-term context window.</p><h3>Method B: Custom Ollama Modelfiles (Permanent Rule Enforcement)</h3><p>If you want your local model to enforce specific coding standards across your entire project without attaching files to every prompt, compile a custom local model.</p><p>Create a plain text file named Modelfile (no file extension) in any directory:</p><pre>FROM qwen2.5-coder:1.5b<br><br># Enforce system-level rules and syntax overrides<br>SYSTEM &quot;&quot;&quot;<br>You are an expert full-stack developer specializing in modern Laravel applications.<br>CRITICAL FRAMEWORK RULE (Laravel 8+):<br>Controllers NO LONGER support string-based routing syntax. You MUST use full class-based namespacing.<br>Correct Syntax:   Route::get(&#39;/user&#39;, [UserController::class, &#39;index&#39;]);<br>Incorrect Syntax: Route::get(&#39;/user&#39;, &#39;UserController@index&#39;);<br>Always output code blocks following these modern constraints.<br>&quot;&quot;&quot;</pre><p>Compile the new model via your terminal:</p><pre>ollama create qwen2.5-laravel8 -f ./Modelfile</pre><p>Return to <strong>OpenCode Settings</strong> and switch your active provider model to qwen2.5-laravel8.</p><h3>Method C: Model Context Protocol (MCP) Web Search</h3><p>OpenCode supports the <strong>Model Context Protocol (MCP)</strong>. By enabling a search MCP server (such as Tavily or Brave Search MCP), your local model can trigger live web searches. When asked about an API update it doesn’t recognize, the model calls the search tool, fetches the live documentation, and incorporates it into its response.</p><h3>The Hard Trade-Offs: Local CPU vs. Cloud AI</h3><p>Moving entirely local is liberating, but it is not a silver bullet. You are trading raw computing power for privacy and autonomy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2LFdAV9dXpEfJ6VYAQclBQ.png" /></figure><h3>The Verdict</h3><ul><li><strong>Use Cloud AI / Hosted Models</strong> for heavy system architecture design, massive multi-file migrations, or when working on hardware with low RAM and no GPU.</li><li><strong>Use Local Ollama + OpenCode</strong> for daily coding, unit test generation, boilerplate creation, rapid inline completion, and private codebases that cannot leave your machine.</li></ul><h3>Final Thoughts</h3><p>Local AI is no longer a privilege reserved for setups with wall-powered GPU rigs. With lightweight models like qwen2.5-coder and a clean orchestration interface like OpenCode, a standard 32GB RAM developer laptop becomes a fully self-contained software workshop.</p><p>You don’t need to choose between paying a monthly fee or losing your tools entirely. Keep Ollama running locally as your baseline daily driver, and reserve cloud providers or Ollama Cloud models for the rare tasks that demand massive compute.</p><p><em>Are you running local models on your dev rig, or relying entirely on cloud APIs? What models are giving you the best performance on CPU? Let me know in the comments below!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d98cba4119a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating Laravel Encryption from AES-256-CBC to AES-256-GCM Without Breaking Production]]></title>
            <link>https://medium.com/@osaswijojames/migrating-laravel-encryption-from-aes-256-cbc-to-aes-256-gcm-without-breaking-production-2621ef13530b?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2621ef13530b</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 19:41:11 GMT</pubDate>
            <atom:updated>2026-07-29T19:41:11.229Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxO302jowipd1LdzkcjxZQ.png" /><figcaption>Migrating from AES-256-CBC to AES-256-GCM</figcaption></figure><p>Hello guys. This article has been in my draft for a while now, but I believe it’s time I share how to properly migrate from AES-256-CBC to AES-256-GCM in a Laravel application and why it matters.</p><p>Encryption migrations are terrifying. You have thousands of encrypted records in your database, a mobile app that must remain operational during the transition, and zero tolerance for data loss or production downtime.</p><p>When migrating a Laravel application from the older `AES-256-CBC` cipher to `AES-256-GCM` (authenticated encryption), you will run into subtle, undocumented behaviors in Eloquent’s saving pipeline and third-party packages. Here is the complete playbook for navigating this migration safely.</p><h3>Why This Migration Matters: The Security Imperative</h3><p>Laravel historically defaulted to <strong>AES-256-CBC</strong> for its encryption helpers. While CBC is secure against passive eavesdropping, it lacks integrity verification. It is vulnerable to <strong>Bit-Flipping Attacks; </strong>an attacker with access to the database could modify specific bits in the encrypted ciphertext, predictably altering the decrypted plaintext without ever knowing the encryption key.</p><figure><img alt="Bit-Flipping Attack on Unauthenticated Ciphertext" src="https://cdn-images-1.medium.com/max/890/1*OeWU8_ps7JvrFWagTvLp5g.png" /><figcaption>Bit-Flipping Attack on Unauthenticated Ciphertext</figcaption></figure><p><strong>AES-256-GCM</strong> is an <strong>AEAD (Authenticated Encryption with Associated Data)</strong> cipher. It appends an authentication tag (MAC) to the encrypted payload. If even a single bit of the ciphertext is altered, decryption fails immediately. Upgrading to GCM ensures that your data-at-rest is not just private, but completely tamper-proof.</p><p>Furthermore, this database migration was the final milestone of a unified cryptographic blueprint. We recently deployed a hardened, hybrid <strong>RSA + AES-256-GCM</strong> transport encryption layer for mobile logins. Migrating our database to GCM aligned our <strong>data-at-rest </strong>with our <strong>data-in-transit</strong>, ensuring our entire application is standardized under the same high-security cryptographic standard.</p><h3>The Strategy: Backward-Compatible Casts</h3><p>To roll this out without downtime, you can adopt a <strong>try-GCM-first, fall-back-to-CBC</strong> strategy. We built a custom Eloquent cast to handle this transparently:</p><figure><img alt="Try GCM, Fallback to CBC Cast Flowchart" src="https://cdn-images-1.medium.com/max/523/1*sM70AanYcice9ayit6ab5g.png" /><figcaption>Try GCM, Fallback to CBC Cast Flowchart</figcaption></figure><pre>class Encrypted implements CastsAttributes<br>{<br>    private static ?Encrypter $legacy = null;<br><br>    public function get(Model $model, string $key, mixed $value, array $attributes): mixed<br>    {<br>        if ($value === null) {<br>            return null;<br>        }<br><br>        try {<br>            // 1. Try GCM first (the new default in config/app.php)<br>            return Crypt::decryptString($value);<br>        } catch (DecryptException) {<br>            // 2. Fall back to CBC for existing records<br>            return $this-&gt;legacyDecrypt($value);<br>        }<br>    }<br><br>    public function set(Model $model, string $key, mixed $value, array $attributes): mixed<br>    {<br>        if ($value === null) {<br>            return null;<br>        }<br><br>        // Always write GCM<br>        return Crypt::encryptString($value);<br>    }<br><br>    private function legacyDecrypt(string $value): string<br>    {<br>        if (self::$legacy === null) {<br>            self::$legacy = new Encrypter($this-&gt;rawKey(), &#39;AES-256-CBC&#39;);<br>        }<br><br>        return self::$legacy-&gt;decryptString($value);<br>    }<br><br>    private static function rawKey(): string<br>    {<br>        $key = config(&#39;app.key&#39;);<br>        if (str_starts_with($key, &#39;base64:&#39;)) {<br>            return base64_decode(substr($key, 7));<br>        }<br>        return $key;<br>    }<br>}</pre><p>This cast <strong>lazily migrates</strong> your data. Every read on an old CBC record silently decrypts it, and every write writes GCM.</p><h3>The Gotcha: Third-Party Packages Don’t Know About Your Casts</h3><p>While custom casts work beautifully for your own models, they fail for third-party packages (like Spatie Mailcoach or 2FA packages) that call <strong>Crypt::decryptString()</strong> or use built-in casts (<strong>AsEncryptedArrayObject</strong> or <strong>’encrypted’</strong>) directly.</p><p>As soon as you change the <strong>cipher</strong> to <strong>AES-256-GCM</strong> in <strong>config/app.php</strong>, these packages try to read CBC data with a GCM encrypter and crash immediately.</p><p>To solve this, you need a console command to actively re-encrypt package data. But this is where the deepest traps lie.</p><h3>The Eloquent Dirty-Check Trap (originalIsEquivalent)</h3><p>When writing a migration command, your instinct is to do this:</p><pre>$record-&gt;attribute = $record-&gt;attribute; // Read (decrypts CBC) -&gt; Write (sets GCM)<br>$record-&gt;saveQuietly();</pre><p>However, calling <strong>$record-&gt;saveQuietly()</strong> triggers Eloquent’s <strong>originalIsEquivalent()</strong> method to check if the record is dirty. Under the hood, Eloquent tries to decrypt the original database value (which is CBC) using the <strong>current default encrypter (which is now GCM)</strong>.</p><p>Because GCM expects a 12-byte IV and CBC provides a 16-byte IV, the GCM decrypter throws `<strong>The payload is invalid at the IV length validation check in getJsonPayload()`</strong>. The command crashes before it even attempts a write!</p><h4>The Workaround:</h4><p>To bypass this, you must configure <strong>previousKeys</strong> on the global GCM encrypter:</p><pre>app(Encrypter::class)-&gt;previousKeys([self::rawKey()]);</pre><p>For <strong>AsEncryptedArrayObject</strong> casts, having any previous keys set tells Eloquent’s <strong>originalIsEquivalent()</strong> check to skip the decryption comparison and mark the model as dirty, allowing <strong>saveQuietly()</strong> to proceed without crashing!</p><h3>The Column-less &amp; Timestamp-less Table Trap</h3><p>We ran into a unique issue when migrating Mailcoach UI settings (which live in <strong>mailcoach_settings</strong>).</p><p>Unlike standard Eloquent tables, this table has <strong>no `id` column</strong> and <strong>no timestamps (created_at/updated_at); </strong>it is a simple key-value schema <strong>(key, value)</strong>.</p><p>This breaks two core Laravel behaviors:<br>1. <strong>chunkById()</strong> fails because there is no `id` column.<br>2. <strong>$model-&gt;saveQuietly()</strong> crashes because Eloquent tries to inject `updated_at` into the `SET` statement, throwing a `Column not found: 1054 Unknown column ‘updated_at’` SQL error.</p><h4>The Solution:</h4><p>Swap <strong>chunkById</strong> for standard <strong>chunk()</strong> with <strong>orderBy(‘key’)</strong> (perfectly safe for smaller settings tables). And instead of calling <strong>$model-&gt;save()</strong>, bypass Eloquent’s automated timestamp injection by using query-builder updates wrapped in <strong>withoutTimestamps()</strong>:</p><pre>Setting::query()<br>    -&gt;select([&#39;key&#39;, &#39;value&#39;])<br>    -&gt;orderBy(&#39;key&#39;)<br>    -&gt;chunk(100, function ($settings) {<br>        foreach ($settings as $setting) {<br>            $raw = $setting-&gt;getRawOriginal(&#39;value&#39;);<br>            <br>            // Decrypt with legacy CBC...<br>            $plaintext = self::legacyCbcDecrypt($raw);<br><br>            // Re-encrypt with GCM &amp; save without letting Eloquent touch timestamps<br>            Setting::withoutTimestamps(fn () =&gt; Setting::query()<br>                -&gt;where(&#39;key&#39;, $setting-&gt;key)<br>                -&gt;update([&#39;value&#39; =&gt; Crypt::encryptString($plaintext)]));<br>        }<br>    });</pre><h3>Staging/Prod Trap: Key Rotation &amp; `The MAC is invalid.`</h3><p>If your staging or production environments have had their <strong>APP_KEY</strong> rotated in the past, or if you imported a DB dump from a different environment, your migration command will throw `The MAC is invalid.` on some rows.</p><p>Because the old encryption key is gone, <strong>this data is permanently lost</strong>.</p><p>In Mailcoach settings (which store UI preferences like Monaco vs Markdown editor), an undecryptable row will crash the Admin UI whenever a user visits the configuration page.</p><h4>The Self-Healing Fix:</h4><p>Since these settings are purely UI configurations and contain no critical user/subscriber data, make your migration command robust by catching `DecryptException` and logging a warning instead of crashing.</p><p>To resolve the crash in the UI, you can safely <strong>delete</strong> the corrupted configuration row:</p><pre>DELETE FROM mailcoach_settings WHERE `key` = &#39;EditorConfiguration&#39;;</pre><p>When deleted, Mailcoach gracefully falls back to default settings, instantly resolving the UI crash. The next time a user opens the settings page and clicks <strong>Save</strong>, Mailcoach automatically recreates the row, fully encrypted with your current GCM key!</p><h3>Architectural Alignment: Database Encryption Meets Mobile Login Security (Hybrid RSA + AES-256-GCM)</h3><p>While securing data-at-rest is crucial, a database encryption migration like this often fits into a larger, unified cryptographic blueprint. In a typical high-security architecture, data-in-transit is often hardened using a custom, hybrid RSA + AES-256-GCM encryption layer for mobile logins (such as those built with Flutter/Dart).</p><p>By upgrading the database to GCM, developers can successfully standardize an entire application ecosystem, both transit and rest, under a single, high-security GCM standard.</p><p>The mobile hybrid GCM flow works as follows:<br>1. <strong>The Server</strong> exposes an RSA-2048 public key.<br>2. <strong>Flutter</strong> generates a random 32-byte AES key and 12-byte nonce, then encrypts the sensitive login credentials using `AES-256-GCM`.<br>3. <strong>Flutter</strong> encrypts the AES key itself using the server’s RSA public key (OAEP padding).<br>4. <strong>The Server</strong> receives the encrypted payload and the encrypted AES key, decrypts the AES key using its RSA private key, and finally decrypts the credentials.</p><p>Having GCM on both sides means we are utilizing identical cryptographic mechanisms. The mobile app encrypts with GCM, the server decrypts with GCM, and the database stores it in GCM.</p><figure><img alt="Flutter Hybrid Encryption Sequence" src="https://cdn-images-1.medium.com/max/1024/1*QmelEyxamSme_juCMe1-iQ.png" /><figcaption>Flutter Hybrid Encryption Sequence</figcaption></figure><h4>Payload Format &amp; Binary Slicing</h4><p>The encrypted data sent from Flutter follows a compact, zero-overhead binary layout:</p><pre>[nonce: 12 bytes][ciphertext: N bytes][tag: 16 bytes]</pre><p>All base64-encoded, with no JSON wrappers or PHP serialization. On the server side, we slice the raw bytes back apart using `substr` and feed them to OpenSSL:</p><pre>$raw = base64_decode($encryptedData);<br>$nonce = substr($raw, 0, 12);<br>$tag = substr($raw, -16);<br>$ciphertext = substr($raw, 12, -16);<br><br>$plaintext = openssl_decrypt(<br>    $ciphertext, <br>    &#39;aes-256-gcm&#39;, <br>    $aesKey,<br>    OPENSSL_RAW_DATA, <br>    $nonce, <br>    $tag<br>);</pre><h4>Critical Mobile Gotchas</h4><p>- <strong>Nginx Header Drops</strong>: Avoid using underscores in custom headers. Nginx silently drops headers like `encryption_key`. Use hyphens instead (e.g., `encryption-key`).<br>- <strong>OAEP Padding Mismatch</strong>: Ensure your PHP and Dart libraries agree on the hash algorithm for OAEP padding. PHP’s `OPENSSL_PKCS1_OAEP_PADDING` defaults to SHA-1. If Dart uses SHA-256, decryption will silently fail. Pointycastle defaults to SHA-1, which works out of the box, but it is always worth verifying to avoid a silent 500 error.</p><h3>Results</h3><p>- <strong>Zero Downtime</strong>: Existing CBC data remained perfectly readable throughout the entire transition.<br>- <strong>Lightning Fast</strong>: Records were successfully migrated to GCM in under a minute across multiple database tables.<br>- <strong>Unified Security</strong>: The Flutter mobile login flow and database storage now share a unified, secure AEAD cryptographic layer.<br>- <strong>Stable Safety Net</strong>: All automated tests pass, verifying that backward-compatible fallback paths work flawlessly.</p><h3>Cleaning Up Later</h3><p>The `legacyDecrypt()` fallback in your custom cast becomes dead code once the migration has been verified and run across all staging and production environments.</p><p>You can safely remove the fallback code and simplify the cast to only use standard GCM decryption. However, keeping the fallback is harmless; it serves as a lightweight safety net that will never fire.</p><h3>Conclusion &amp; Checklist</h3><p>Migrating ciphers on a live app is like swapping the engine on a plane while flying. If you are preparing for this migration:</p><ol><li>Use a <strong>backward-compatible custom cast</strong> for lazy migrations on your models.</li><li>Migrate third-party package data using a chunked console</li><li>Configure `previousKeys()` to bypass the `originalIsEquivalent` dirty check during command updates.</li><li>For tables without `id` or timestamps, use standard `chunk()` with `withoutTimestamps()` query updates.</li><li>If you encounter `The MAC is invalid`, identify if the row is safe to delete/reset (like non-critical UI settings) to allow self-healing.</li></ol><h3>Final Thoughts</h3><p>Ensure that you have proper backup and knowledge of encryption before making this type of migration because, if you are not careful, you would lose all your data on both local and production servers.</p><p>Also, ensure you test a lot. Write tests for everything; this would save you a lot of headaches in the future.</p><p>Leave a clap if you found this helpful.</p><p>I hope you had a good read. Cheers. 🥂</p><p><em>Happy coding!</em> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2621ef13530b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Copy-Paste AI Is Dead: How Agentic Tools Like OpenCode Are Transforming Software Development]]></title>
            <link>https://medium.com/@osaswijojames/copy-paste-ai-is-dead-how-agentic-tools-like-opencode-are-transforming-software-development-c74db366417e?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c74db366417e</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[developer-productivity]]></category>
            <category><![CDATA[ai-workflow]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Sat, 21 Mar 2026 00:25:10 GMT</pubDate>
            <atom:updated>2026-03-21T00:25:10.688Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-9rhRitFX2RqUhjfr_f4g.png" /><figcaption>Copy-pasting dev vs. agentic dev</figcaption></figure><p>Most developers are still using AI as if it were 2023.<br>Copy code. Paste into <a href="https://chatgpt.com/">ChatGPT</a> or <a href="https://claude.ai/">Claude</a>. Add context. Repeat.<br>It works until your codebase gets real. Then it breaks down fast.</p><h3>The Problem with Copy-Paste AI</h3><p>Let’s be honest, copy-pasting code into AI is fundamentally flawed for anything beyond small problems.</p><ol><li><strong>Loss of Context</strong></li></ol><p>Modern applications are systems:</p><ul><li>Controllers</li><li>Services</li><li>Models</li><li>Jobs</li></ul><p>A snippet is never the full story.<br>When you remove context, you remove meaning.</p><p>2. <strong>Manual Overhead</strong></p><p>You become the “context engine”:</p><ul><li>Copy</li><li>Paste</li><li>Explain</li><li>Repeat</li></ul><p>Instead of solving problems, you’re busy reconstructing your architecture for the AI.</p><p>3. <strong>Token Limit Friction</strong></p><p>You:</p><ul><li>Hit limits</li><li>Lose context</li><li>Restart conversations</li></ul><p>At some point, you’re debugging the AI, not your code.</p><h4><strong>Workflow Comparison</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9y_a1MPS36Nrncs4AzmrVQ.png" /><figcaption>Copy-Paste vs Agentic Workflow</figcaption></figure><h3>The Shift: From Tools to Agents</h3><p>This is where agentic AI changes everything.</p><p>Instead of being a stateless assistant, it behaves like:</p><ul><li>A junior engineer</li><li>A codebase explorer</li><li>A debugging partner</li></ul><h3>What Makes Agentic AI Different?</h3><p>Tools like <a href="https://opencode.ai/">OpenCode</a> operate on a completely different model:</p><p>1. <strong>Understand Your Codebase</strong></p><ul><li>Traverse files</li><li>Map relationships</li><li>Infer architecture</li></ul><p>2. <strong>Maintain Context</strong></p><p>No repeated explanations. No rebuilding context.</p><p>3. <strong>Act Autonomously</strong></p><p>You say:</p><blockquote><em>“Fix the bug in the operations dashboard. Located in @filename.extension”</em></blockquote><p>It:</p><ul><li>Finds relevant files</li><li>Traces dependencies</li><li>Solves the issue</li></ul><h4><strong>Codebase Traversal</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CExca9z4wAuWbWVGbBP2Gw.png" /><figcaption>How Agentic AI Understands Your System</figcaption></figure><h3>A Real-World Example</h3><p>I ran into this while working on an operations bug.</p><p>It was:</p><ul><li>Hard to reproduce</li><li>Intermittent</li><li>Not tied to one file</li></ul><p>Clearly a system-level issue.</p><h4><strong>Attempt 1: Copy-Paste AI</strong></h4><p>Using Claude and ChatGPT:</p><ul><li>I shared snippets</li><li>Then classes</li><li>Then interfaces</li></ul><p>But:</p><ul><li>The AI never had full context</li><li>I kept explaining</li><li>I hit token limits</li></ul><p>Eventually, I had to wait for hours before I could continue.</p><h4>Attempt 2: Agentic with OpenCode</h4><p>With OpenCode:</p><p>I simply:</p><ul><li>Pointed to the operations main controller</li><li>Indicated related models</li></ul><p>That was enough.</p><p>The agent:</p><ul><li>Explored the repo</li><li>Found dependencies</li><li>Fixed the bug</li><li>Explained it</li><li>Wrote tests</li></ul><h4>The Most Impressive Part</h4><p>When I ran out of tokens:</p><ul><li>It summarized the task</li><li>Passed it to a new instance</li><li>Continued seamlessly</li></ul><p>No reset. No friction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GJZ5mzK2gVkkFLw86qFrzg.png" /><figcaption>Context Persistence Across Sessions</figcaption></figure><h3>The Trade-Off: Power Comes with Risk</h3><p>Agentic tools are powerful, but not foolproof.</p><h4>A Mistake I Won’t Forget</h4><p>I told the agent:</p><blockquote><em>“Create and delete test data for a little modification using Tinker.”</em></blockquote><p>What I meant:</p><ul><li>Insert small test data</li><li>Clean up only that</li></ul><p>What it did:</p><ul><li>Wiped the entire database</li></ul><h4>What Went Wrong</h4><p>This wasn’t a tool failure.<br>It was a prompting failure.</p><p>Agentic systems:</p><ul><li>Interpret intent</li><li>Fill gaps</li><li>Execute broadly if unclear</li></ul><h4>How to Stay Safe</h4><ul><li>Be explicit with constraints</li><li>Use local/test environments</li><li>Limit scope</li><li>Review actions before execution</li></ul><p>Think of it as managing a junior developer.</p><h4>Why This Matters</h4><p>This shift changes how we build software:</p><ul><li>Less cognitive load</li><li>Faster debugging</li><li>Better system-level fixes</li><li>Real AI collaboration</li></ul><h3>Final Thoughts</h3><p>Copy-paste AI isn’t dead, but it’s no longer enough.</p><p>We’re moving from:</p><ul><li>AI as a tool</li></ul><p>To:</p><ul><li>AI as a collaborator</li></ul><p>And tools like OpenCode are leading that shift.</p><p>The real question is:</p><blockquote><strong><em>Are you still using AI the old way?</em></strong></blockquote><p>I’ll be writing a follow-up guide on how to install and use OpenCode in a real development workflow.</p><p>If you want to move beyond copy-paste AI, this will help you get started quickly.</p><h4>NOTE:</h4><p>All diagrams in this article were generated using AI for illustration purposes.</p><p>Leave a clap if you found this helpful.</p><p>I hope you had a good read, cheers. 🥂</p><p><em>Happy coding!</em> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c74db366417e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Think Different with Laravel Tinker]]></title>
            <link>https://medium.com/@osaswijojames/think-different-with-laravel-tinker-7c553f776766?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c553f776766</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Thu, 22 Jan 2026 21:37:45 GMT</pubDate>
            <atom:updated>2026-01-22T21:37:45.189Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Image of Laravel Tinker from laravel-news.com/laravel-tinker" src="https://cdn-images-1.medium.com/max/1024/1*AsWkTn_c-IqrIZnxlaIDhA.avif" /><figcaption>Laravel Tinker Image from “<a href="https://laravel-news.com/laravel-tinker">laravel-news.com/laravel-tinker</a>”</figcaption></figure><p>Happy New Year, guys. This is my first article for 2026, and I want to talk about a hidden gem that quietly powers a lot of my day-to-day Laravel development workflow: <strong>Laravel Tinker</strong>.</p><p>Tinker is a very handy <strong>REPL (Read–Evaluate–Print Loop)</strong> shell that ships with Laravel out of the box. It allows you to interact with your application in real-time: executing code, querying models, testing logic, and inspecting data without touching a controller route or UI.</p><p>If you have ever found yourself:</p><ul><li>Sprinkling dd() everywhere to inspect data</li><li>Creating throwaway routes for quick checks</li><li>Opening Postman for something that should take 10 seconds</li></ul><p>Then you are already feeling the pain Tinker was designed to solve.</p><h3>Why Laravel Tinker</h3><p>Tinker runs <strong>inside your Laravel application context</strong>. That means it has access to:</p><ul><li>Models</li><li>Services and Actions</li><li>Config values</li><li>Helpers</li><li>Database connections</li><li>Authentication state</li></ul><p>In short, anything your application can do, <strong>Tinker can do too!</strong></p><p>To start:</p><pre>php artisan tinker</pre><p>You can also use Laravel’s aliases:</p><pre>php artisan tin<br>php artisan ti</pre><h3>Moving Beyond One-Liners</h3><p>Most developers use Tinker for quick checks:</p><pre>User::count();</pre><p>Or:</p><pre>User::where(&#39;email&#39;, &#39;test@example.com&#39;)-&gt;first();</pre><p>useful, but limited.</p><p>Where Tinker truly shines is when you treat it as a <strong>lightweight application execution environment</strong>, not just an interactive shell. Imagine being able to skip visiting multiple routes to test a new feature or opening multiple pages in the browser to test a minor update. Tinker saves you from that hassle.</p><p>That is where running full PHP files via Tinker becomes powerful.</p><h3>Running Real Application Flows with tester.php</h3><p>Instead of copy-pasting large chunks of code into Tinker, you can create a file. I usually do something like tester.php and let Tinker execute it end-to-end.</p><pre>php artisan tinker tester.php</pre><p>Below are <strong>real-world scenarios</strong> where this approach excels.</p><h3>Example 1: Testing a Payment or Wallet Flow</h3><p>You want to verify:</p><ul><li>Balance deductions</li><li>Ledger entries</li><li>Side effects</li></ul><p>Without hitting an API.</p><pre>&lt;?php<br><br>use App\Models\User;<br>use App\Services\WalletService;<br><br>$user = User::where(&#39;email&#39;, &#39;finance-test@example.com&#39;)-&gt;firstOrFail();<br><br>$walletService = app(WalletService::class);<br><br>$before = $walletService-&gt;balance($user);<br><br>$walletService-&gt;debit($user, 5000, &#39;Test debit&#39;);<br><br>$after = $walletService-&gt;balance($user);<br><br>dump([<br>    &#39;before&#39; =&gt; $before,<br>    &#39;after&#39; =&gt; $after,<br>]);</pre><p>This is faster and safer than testing through HTTP, especially during early development.</p><h3>Example 2: Testing Jobs Without a Queue Worker</h3><p>You want to validate job logic <strong>now</strong>, not after deploying.</p><pre>&lt;?php<br><br>use App\Jobs\SendWelcomeEmail;<br>use App\Models\User;<br><br>$user = User::latest()-&gt;first();<br><br>SendWelcomeEmail::dispatchSync($user);<br><br>dump(&#39;Job executed successfully&#39;);</pre><p>No queue workers. No Redis setup. Just execution.</p><h3>Example 3: Verifying Model Relationships and Data Integrity</h3><p>Perfect for catching unexpected nulls or N+1 surprises.</p><pre>&lt;?php<br><br>use App\Models\Order;<br><br>$order = Order::with([&#39;user&#39;, &#39;items.product&#39;])-&gt;first();<br><br>dump([<br>    &#39;order_id&#39; =&gt; $order-&gt;id,<br>    &#39;user&#39; =&gt; $order-&gt;user-&gt;email,<br>    &#39;items_count&#39; =&gt; $order-&gt;items-&gt;count(),<br>]);</pre><p>This is especially useful when refactoring relationships.</p><h3>Example 4: Testing a Complex Service or Action Class</h3><p>If your business logic lives where it should, outside controllers, this becomes invaluable.</p><pre>&lt;?php<br><br>use App\Actions\CreateVirtualAccount;<br>use App\Models\User;<br><br>$user = User::where(&#39;email&#39;, &#39;test@example.com&#39;)-&gt;firstOrFail();<br><br>$result = app(CreateVirtualAccount::class)-&gt;execute($user);<br><br>dump($result);</pre><p>This validates your core logic without mocking half the app.</p><h3>Why This Pattern Works So Well</h3><p>Using Tinker + executable PHP files gives you:</p><ul><li>Fast feedback loops</li><li>Fewer debugging artifacts in your codebase</li><li>Better separation between experimentation and production logic</li><li>Cleaner controllers and routes</li></ul><p>For senior developers, this becomes a strategic productivity tool rather than a debugging crutch.</p><h3>A Word of Caution: Tinker Runs Against Your Real Database</h3><p>One important thing to understand about Laravel Tinker is this:</p><p><strong>Tinker runs against your actual application database.</strong></p><p>Unlike unit and feature tests, which often use an in-memory database or refresh the database between runs, Tinker does <strong>not</strong> protect you from destructive operations.</p><p>This means commands like:</p><ul><li>User::truncate()</li><li>Model::query()-&gt;delete()</li><li>Mass updates or deletes</li><li>Running financial or irreversible actions</li></ul><p>…will execute <strong>immediately and permanently</strong> on the connected database.</p><p>Because of this, a few best practices are strongly recommended:</p><ul><li>Always confirm which environment you are in (local, staging, or production)</li><li>Avoid running destructive database operations casually</li><li>Prefer SELECT-style reads over writes when exploring data</li><li>Never experiment on production data unless you are certain of the outcome</li></ul><p>Tinker is powerful, but with that power comes responsibility[Winks twice in Toby Maguire’s Spiderman phrase].<br>Treat it like a <strong>loaded tool</strong>, not a sandbox.</p><h3>What This Is Not</h3><p>This approach is <strong>not</strong>:</p><ul><li>A replacement for unit or feature tests</li><li>A data migration strategy</li><li>Something you should commit to source control</li></ul><p>Think of it as a <strong>scratchpad that runs inside your application</strong></p><h3>Final Thoughts</h3><p>Laravel Tinker is often introduced as a “debugging helper,” but that framing is incomplete.</p><p>Tinker is a <strong>thinking environment</strong>.</p><p>When you start using it to validate assumptions, explore real data, and execute full application flows, your development process becomes calmer, faster, and more intentional.</p><p>Think less.<br>Validate faster.<br><strong>Think different with Laravel Tinker.</strong></p><p>Leave a clap if you found this helpful.</p><p>I hope you had a good read, cheers. 🥂</p><p><em>Happy coding!</em> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c553f776766" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating a Laravel Project from Windows to WSL2 for a Performance Boost: A Comprehensive Guide]]></title>
            <link>https://medium.com/@osaswijojames/migrating-a-laravel-project-from-windows-to-wsl2-for-a-performance-boost-a-comprehensive-guide-d0017e7c22cb?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0017e7c22cb</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[performance-optimization]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Fri, 19 Sep 2025 22:59:30 GMT</pubDate>
            <atom:updated>2025-09-19T22:59:30.097Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="PHP Script" src="https://cdn-images-1.medium.com/max/1024/1*6Omrg2pR4I5HcNtQvvuxbg.jpeg" /><figcaption>PHP Script</figcaption></figure><p>Hello World!</p><p>This article addresses a problem(slow loading of web pages rendered by Filament or PHP on the browser) that I knew how to fix, but generally overlooked until it became a thorn in my flesh.</p><p>Before now, I had worked extensively with <strong>WSL (Windows Subsystem for Linux)</strong>, and I can confidently say how fast it gets things done. I’ve even written two articles on WSL:</p><ul><li>[<a href="https://medium.com/@osaswijojames/resolving-error-0x8007019e-the-windows-subsystem-for-linux-has-not-been-enabled-4cdac4708b17">Resolving Error: </a><a href="https://medium.com/@osaswijojames/resolving-error-0x8007019e-the-windows-subsystem-for-linux-has-not-been-enabled-4cdac4708b17">0x8007019e - The Windows Subsystem for Linux has not been enabled</a>]</li><li>[<a href="https://medium.com/@osaswijojames/how-to-switch-php-versions-on-wsl-windows-subsystem-for-linux-ef7242f47f48">Switching PHP versions in WSL</a>]</li></ul><p>From my experience, moving a development environment from Windows to <strong>WSL2</strong> can dramatically improve performance, especially for projects with heavy file operations like Laravel. But the journey isn’t always smooth.</p><p>In this article, I’ll share my real-world migration process, the challenges I faced, and how I solved them, from database migration to fixing obscure network errors.</p><p><strong>The Problem: Windows Filesystem Bottleneck</strong></p><p>When a Laravel project runs on Windows, the filesystem can be a major performance bottleneck. Operations like composer install and npm run dev can be frustratingly slow.</p><p>By moving the project to a <strong>Linux filesystem within WSL2</strong>, you can eliminate this bottleneck and significantly speed up development.</p><h3>Phase 1: Database Migration from WAMP/PHPMyAdmin to WSL2/MySQL</h3><p>A crucial first step is moving your database. I used the <strong>export/import method</strong>, as it’s the most reliable way to preserve data integrity.</p><p><strong>Step 1: Export from PHPMyAdmin on Windows</strong></p><ul><li>Open PHPMyAdmin in your browser.</li><li>Select your database, go to the <strong>“Export”</strong> tab, and choose the <strong>“Custom”</strong> method.</li><li>Ensure you select <strong>“Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / TRIGGER / EVENT statement”</strong>.</li><li>Download the .sql file.</li></ul><p><strong>Step 2: Transfer and Import into WSL2</strong></p><ul><li>Copy the .sql file to your WSL2 home directory using cp /mnt/c/Users/your_username/Downloads/your_db.sql ~.</li><li>Use <strong>DBeaver</strong> on Windows to connect to your WSL2 MySQL server. <br>This is where I encountered my first major roadblock.</li></ul><p><strong>Error: “Communications link failure: Connection refused”. <br></strong>This happened because MySQL in WSL2 wasn’t listening for connections from the Windows host by default.</p><p><strong>The Fix</strong>:</p><ol><li>Edit the MySQL configuration: <br>sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf.</li><li>Change the bind-address to 0.0.0.0 to allow external connections:</li></ol><pre>[mysqld]<br>bind-address = 0.0.0.0<br>port = 3307</pre><p>3. Restart MySQL: sudo service mysql restart</p><p>After that, I could import my .sql file via DBeaver’s <strong>Execute Script</strong> tool.</p><figure><img alt="How to navigate to the Execute Script in DBeaver" src="https://cdn-images-1.medium.com/max/959/1*ytucrXVttIUP6h5WD9gMXg.png" /><figcaption>How to navigate to the Execute Script in DBeaver</figcaption></figure><h3>Phase 2: Resolving PHP and Laravel-Specific Errors</h3><p>After migrating the database, my Laravel project ran into some environment-specific issues.</p><p><strong>Error: <br>“Call to undefined function Illuminate\Support\mb_strimwidth()”</strong> <br>This error indicates a missing PHP extension.</p><p><strong>The Fix</strong>:</p><ul><li>Install the mbstring extension for your PHP version: sudo apt install php8.4-mbstring.</li><li>Restart your web server: sudo service apache2 restart.</li></ul><p><em>(For more, check out my article on </em><a href="https://medium.com/@osaswijojames/how-to-switch-php-versions-on-wsl-windows-subsystem-for-linux-ef7242f47f48"><em>switching PHP versions.</em></a> <em>I also cover other essential extensions there.)</em></p><h3>Phase 3: Diagnosing and Fixing Storage Disk Issues</h3><p>Next, I ran into file upload and test failures, pointing to <strong>storage permission issues</strong>.</p><p><strong>Error: <br></strong><strong>[2025-09-15 13:10:29] local.ERROR: Unable to retrieve the file_size...</strong> This points to a permissions issue with your temporary upload directory.</p><p><strong>The Fix</strong>: I granted the web server user the necessary permissions:</p><pre>sudo chown -R www-data:www-data /home/user/core/storage/app<br>sudo chmod -R 775 /home/user/core/storage/app</pre><p><strong>Troubleshooting Tool: </strong>To verify storage, I wrote a simple <strong>check_storage.php</strong> script for Laravel:</p><pre>&lt;?php<br><br>use Illuminate\Support\Facades\Storage;<br><br>require __DIR__ . &#39;/vendor/autoload.php&#39;;<br><br>$app = require_once __DIR__ . &#39;/bootstrap/app.php&#39;;<br>$kernel = $app-&gt;make(Illuminate\Contracts\Console\Kernel::class);<br>$kernel-&gt;bootstrap();<br><br>echo &quot;Checking Laravel public disk...\n&quot;;<br><br>$filePath = &#39;test_storage_disk.txt&#39;;<br>Storage::disk(&#39;public&#39;)-&gt;put($filePath, &#39;Hello from Laravel at &#39; . now());<br><br>if (Storage::disk(&#39;public&#39;)-&gt;exists($filePath)) {<br>    $fullPath = Storage::disk(&#39;public&#39;)-&gt;path($filePath);<br>    echo &quot;✅ Success: File written to {$fullPath}\n&quot;;<br><br>    $content = Storage::disk(&#39;public&#39;)-&gt;get($filePath);<br>    echo &quot;📄 File content: {$content}\n&quot;;<br><br>    Storage::disk(&#39;public&#39;)-&gt;delete($filePath);<br>    echo &quot;🗑️ Test file deleted.\n&quot;;<br>} else {<br>    echo &quot;❌ Failed: Could not write to the public disk.\n&quot;;<br>}</pre><ul><li>I ran it in the root of my project in WSL2 with php check_storage.php. A successful run shows a ✅ Success message.</li></ul><p><strong>A Bash One-Liner for Quick Fixes</strong>: Alternatively, I wrote a bash one-liner to fix the error. This command-line script can also quickly diagnose and fix issues with your public/storage symlink.</p><pre>rm -rf public/storage &amp;&amp; php artisan storage:link &amp;&amp; php artisan tinker --execute=&quot;use Illuminate\Support\Facades\Storage; Storage::disk(&#39;public&#39;)-&gt;put(&#39;test_disk.txt&#39;,&#39;hello world&#39;); echo Storage::disk(&#39;public&#39;)-&gt;exists(&#39;test_disk.txt&#39;) ? &#39;✅ Public disk works&#39; : &#39;❌ Public disk failed&#39;; Storage::disk(&#39;public&#39;)-&gt;delete(&#39;test_disk.txt&#39;);&quot;</pre><h3>Phase 4: The Final Boss — Minio Network Connectivity</h3><p>I prefer <strong>Minio</strong> for local buckets because of how lightweight it is. But this became the trickiest issue of all.</p><p>My Laravel project in WSL was trying to access Minio on Windows, but they weren’t sharing the same localhost.</p><ul><li><strong>The Problem</strong>: In WSL, localhost (127.0.0.1) refers to the WSL virtual machine, not the Windows machine. My Minio server, however, is running on Windows.</li><li><strong>The Diagnostic Tool</strong>: I used curl to test the connection.</li></ul><pre>curl http://127.0.0.1:9000/minio/health/live<br># Output: curl: (7) Failed to connect to 127.0.0.1 port 9000...</pre><ul><li><strong>The Solution</strong>: Finding the correct IP address for my Windows host from within WSL. The ip route show command is the key.</li></ul><pre>ip route show | grep -i default | awk &#39;{ print $3}&#39;<br>#Example Output: 172.25.0.1 (This is your Windows IP from WSL)</pre><ul><li>Then, update your .env file with this new IP:</li></ul><pre>MINIO_SPACES_ENDPOINT=http://172.25.0.1:9000</pre><ul><li>Finally, clear the Laravel config cache: php artisan optimize:clear.</li></ul><p>And just like that, file uploads started working again.</p><h3><strong>Conclusion: The WSL2 Advantage</strong></h3><p>By navigating these migration hurdles, I successfully moved my development environment to a faster, more stable, and more powerful platform.</p><p>The performance boost was <strong>noticeable</strong>:</p><ul><li>Filament pages loaded much faster</li><li>Tests executed in less time</li><li>Overall development flow became smoother</li></ul><h3>Final Thoughts</h3><p>Growth, to me, is knowing when I’m wrong, admitting it, and improving.</p><p>In a previous article, I concluded:</p><blockquote>“<a href="https://medium.com/@osaswijojames/how-to-switch-php-versions-on-wsl-windows-subsystem-for-linux-ef7242f47f48#:~:text=To%20conclude%2C%20after%20going%20through%20these%20steps%2C%20Enlighten%20still%20took%20almost%20the%20same%20one%20hour%20to%20run%20on%20my%20WSL.%20I%20had%20to%20move%20back%20to%20Windows%20for%20development.%20%F0%9F%98%85">After going through these steps, Enlighten still took almost the same one hour to run on my WSL. I had to move back to Windows for development. 😅</a>”</blockquote><p>Looking back, I realize I didn’t do enough due diligence before concluding.</p><p>I’m glad I went back to solve this because this is what excites me about engineering: there’s always something new to fix, something to keep you up all night.</p><p>This is why I still use a Windows machine. It keeps challenging me, and those challenges keep making me a better engineer.</p><p>Leave a clap if you found this helpful.</p><p>I hope you had a good read, cheers. 🥂</p><p><em>Happy coding!</em> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0017e7c22cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Database-Driven UI/Forms: Building Dynamic Forms with Laravel & Filament]]></title>
            <link>https://medium.com/@osaswijojames/database-driven-ui-forms-building-dynamic-forms-with-laravel-filament-5eeb0790bb02?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5eeb0790bb02</guid>
            <category><![CDATA[datastrucutre]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[filament]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Fri, 18 Jul 2025 23:11:25 GMT</pubDate>
            <atom:updated>2025-07-18T23:11:25.357Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Filament Homepage" src="https://cdn-images-1.medium.com/max/1024/1*BPQvSzWQkbPWV_G0pzMYyQ.png" /><figcaption>Filament Homepage</figcaption></figure><p>Hello World!</p><p>I recently started working with <a href="https://filamentphp.com/">Filament</a> and I must say, it’s a breath of fresh air. This article requires you to have some knoweldge of Filament in order for you to follow along. You can always read the <a href="https://filamentphp.com/docs">docs</a> to get up to speed.</p><h3>The Problem with Static Forms in Modern Web Applications</h3><p>Forms are the lifeblood of web applications, yet they remain one of the most painful components to maintain. In traditional development, we hardcode form fields and validation rules directly into our applications. This approach creates several challenges:</p><ul><li>Rigid Structures: Every field change requires code modifications and redeployments</li><li>Developer Bottlenecks: Non-technical users can’t make simple form adjustments</li><li>Scalability Issues: Managing regional variations or A/B tests becomes a nightmare</li><li>Validation Fragility: Frontend and backend validation rules easily fall out of sync</li></ul><p>In my work with enterprise applications, I’ve seen how these limitations create unnecessary friction. Ops teams wait days for simple field changes. Developers dread form-related tickets. The solution? Treat forms as data, not code.</p><h3>The Database-Driven UI Revolution</h3><p>The database-driven approach flips traditional form development on its head. Instead of hardcoding forms, we:</p><ol><li>Store form definitions (fields, types, validation rules) in the database</li><li>Build a visual editor for non-technical users to modify forms</li><li>Serve dynamic form schemas via API to frontend clients</li><li>Validate submissions against the database configuration</li></ol><p>This architecture provides unprecedented flexibility while maintaining robust validation. Let me walk you through implementing this with Laravel and FilamentPHP.</p><h3>Architectural Foundations</h3><h3>1. Database Schema Design</h3><p>Our solution centers around two key tables:</p><pre>Schema::create(&#39;job_profile_configuration&#39;, function (Blueprint $table) {<br>    $table-&gt;id();<br>    $table-&gt;string(&#39;name&#39;)-&gt;unique();<br>    $table-&gt;boolean(&#39;enabled&#39;)-&gt;default(true);<br>    $table-&gt;json(&#39;form&#39;); // Stores the complete form structure<br>    $table-&gt;timestamps();<br>});<br><br>Schema::create(&#39;job_profiles&#39;, function (Blueprint $table) {<br>    $table-&gt;id();<br>    $table-&gt;foreignId(&#39;user_id&#39;)-&gt;constrained();<br>    $table-&gt;foreignId(&#39;form_id&#39;)-&gt;nullable()-&gt;constrained(&#39;job_profile_configuration&#39;);<br>    $table-&gt;json(&#39;profile_data&#39;); // Stores user responses<br>    $table-&gt;timestamps();<br>});</pre><p>The form JSON column contains our complete form blueprint, while profile_data stores user submissions in a matching structure.</p><h3>2. Building the Form Editor with Filament</h3><p>Filament’s Builder component provides the perfect interface for constructing dynamic forms. Here’s how we implement it:</p><pre>Forms\Components\Section::make(&#39;Work Authorization&#39;)<br>    -&gt;schema([<br>        Forms\Components\Builder::make(&#39;form&#39;)<br>            -&gt;blocks([<br>                Forms\Components\Builder\Block::make(&#39;authorization_types&#39;)<br>                    -&gt;schema([<br>                        Forms\Components\TextInput::make(&#39;label&#39;)<br>                            -&gt;default(&#39;Work Authorization Types&#39;),<br><br>                        Forms\Components\Select::make(&#39;validation&#39;)<br>                            -&gt;multiple()<br>                            -&gt;options([<br>                                &#39;required&#39; =&gt; &#39;Required&#39;,<br>                            ])<br>                            -&gt;default([&#39;required&#39;]),<br>                    ]),<br>            ]),<br>    ]),</pre><p>This creates a drag-and-drop interface where administrators can:</p><ul><li>Add/remove fields</li><li>Configure validation rules</li></ul><h3>3. Dynamic Validation Engine</h3><p>The magic happens in our custom UpdateJobProfileRequest:</p><pre>protected function getDynamicSectionRules(string $sectionKey): array<br>{<br>    $rules = [];<br>    $formSchema = Arr::get($this-&gt;profileConfig-&gt;form, $sectionKey);<br>    <br>    foreach ($formSchema as $fieldBlock) {<br>        $fieldKey = $fieldBlock[&#39;type&#39;];<br>        $validationRules = $this-&gt;convertRules($fieldBlock[&#39;validation&#39;]);<br>        <br>        if ($fieldKey === &#39;job_roles&#39;) {<br>            $validationRules[] = Rule::in(JobRoles::pluck(&#39;id&#39;));<br>        }<br>        <br>        $rules[&quot;data.{$fieldKey}&quot;] = $validationRules;<br>    }<br>    <br>    return $rules;<br>}</pre><p>This automatically applies the correct validation rules based on the form configuration, including checking valid IDs for relational fields.</p><h3>Frontend Integration Strategy</h3><p>The frontend consumes our API endpoint (GET /api/job-profile) which returns:</p><pre>{<br>    &quot;dynamic_form_schema&quot;: {<br>        &quot;country_of_choice&quot;: {<br>            &quot;section_label&quot;: &quot;Country of Choice&quot;,<br>            &quot;fields&quot;: [<br>                {<br>                    &quot;label&quot;: &quot;Preferred Country&quot;,<br>                    &quot;validation&quot;: &quot;required&quot;<br>                }<br>            ]<br>        }<br>    },<br>    &quot;profile_data&quot;: {<br>        &quot;country_of_choice&quot;: {<br>            &quot;country&quot;: &quot;ca&quot;<br>        }<br>    }<br>}</pre><p>The frontend then renders the appropriate UI components based on the type and validation attributes. On submission, data is posted back to our dynamically validated endpoint.</p><h3>Real-World Benefits</h3><p>After recently learning this architecture and implementing it, I’ve observed:</p><ol><li>Reduction in Form-Related Tickets: Operations teams now update forms themselves</li><li>Instant Feature Rollouts: New form variations can be A/B tested without deployments</li><li>Consistent Validation: Backend rules always match the current form configuration</li><li>Multi-Platform Consistency: Mobile apps, web, and third-party integrators all use the same form definitions</li></ol><h3>Conclusion</h3><p>Database-driven forms represent a paradigm shift in how we build interactive applications. By leveraging Laravel’s robust backend capabilities and Filament’s admin panel flexibility, we can create systems that are both powerful and maintainable.</p><p>This approach has fundamentally changed how my team builds forms. No more scrambling to update hardcoded fields before deadlines. No more frustrated business users waiting for simple changes. Just flexible, data-driven forms that adapt to business needs.</p><p>Kindly note that the code shared is a surface-level implementation, intended to explain the concept without fully committing to building a complete system. Have you implemented database-driven forms before? Share your experiences in the comments!</p><p>Leave a clap if you found this helpful.</p><p>I hope you had a good read, cheers. 🥂</p><p><em>Happy coding!</em> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5eeb0790bb02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Cleaned Up My Git Branch Using Interactive Rebase]]></title>
            <link>https://medium.com/@osaswijojames/how-i-cleaned-up-my-git-branch-using-interactive-rebase-d7c7ab2d6ce9?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7c7ab2d6ce9</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[version-control]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Thu, 08 May 2025 15:15:06 GMT</pubDate>
            <atom:updated>2025-05-08T15:15:06.658Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Mistake I Made (And Why It Matters)</h3><p>As developers, we’ve all made small Git mistakes that spiral into bigger problems. Recently, I created a new feature branchfeature/community-post-soft-delete, intending for it to branch off from master. However, I accidentally branched off from another feature branchfeature/compliance, which still had unmerged changes.</p><p>When I was ready to merge my new branch into masterI noticed some unrelated code changes showing up in the pull request, specifically, changes from feature/compliance. That&#39;s when I realized my new branch was polluted with commits it shouldn&#39;t have had.</p><p>This article is for you if you’ve ever ended up with unwanted commits in your branch history.</p><h3>What I Needed to Do</h3><p>I needed to:</p><ol><li>Remove all the feature/compliance-related commits from my feature/community-post-soft-delete branch.</li><li>Ensure that only the changes I made on this branch (relative to master) remained.</li><li>Push the cleaned-up history back to GitHub.</li></ol><h3>How I Fixed It: Interactive Rebase</h3><p>Here’s a step-by-step guide that helped me get out of the mess:</p><h4>1. Check out the polluted branch</h4><pre>git checkout feature/community-post-soft-delete</pre><h4>2. Start a rebase on master</h4><pre>git rebase --onto master feature/compliance</pre><p>This opens a list of commits that are in your branch but not in master.</p><h4>3. Resolve any conflicts</h4><p>If Git stops with a conflict:</p><pre># Fix the conflicts in your files<br># Then:<br>git add &lt;file&gt;<br>git rebase --continue</pre><p>Repeat until the rebase completes.</p><p>To cancel the process at any point:</p><pre>git rebase --abort</pre><h4>4. Check your changes</h4><p>Ensure that your branch now only contains the intended changes:</p><pre>git diff master..feature/community-post-soft-delete</pre><h4>5. Force-push the cleaned branch to GitHub</h4><p>Since history has changed, you’ll need to force-push:</p><pre>git push origin feature/community-post-soft-delete --force</pre><p>Any open PR will be updated automatically with the cleaned commit history.</p><h3>Lessons Learned</h3><ul><li>Always double-check which branch you’re branching from.</li><li>Interactive rebase is a powerful tool for cleaning history, but use it with care.</li><li>Force-pushing is safe as long as you’re the only person working on that branch.</li></ul><h3>Bonus: My Git Cleanup Gist</h3><p>I created a handy Gist version of the step-by-step guide you can reuse or share:<br> 👉 <a href="https://gist.github.com/ObsidianBlaze/711d847af2aaebdf84c8373c0145e7d0">Git Cleanup Guide on Gist</a></p><h3>Wrapping Up</h3><p>Interactive rebasing might seem intimidating, but it’s an essential Git skill every developer should master. It helped me fix a mistake without starting over, and now my pull request is clean, focused, and ready to merge.</p><p>If this helped you or if you’ve had similar Git woes, I’d love to hear your story in the comments!</p><p>Leave a clap if you found this helpful.</p><p>I hope you had a good read, cheers. 🥂</p><p><em>Happy coding!</em> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7c7ab2d6ce9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Switch PHP Versions on WSL(Windows Subsystem for Linux)]]></title>
            <link>https://medium.com/@osaswijojames/how-to-switch-php-versions-on-wsl-windows-subsystem-for-linux-ef7242f47f48?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef7242f47f48</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[operating-systems]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Wed, 30 Apr 2025 17:49:55 GMT</pubDate>
            <atom:updated>2025-04-30T17:49:55.069Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Viking Tux" src="https://cdn-images-1.medium.com/max/267/1*2Oh-R5mTc96FKsCb_bN53w.png" /><figcaption>Viking Tux</figcaption></figure><p>You often need to switch between PHP versions when working with PHP applications. Whether upgrading an old project or starting a new one with the latest features, here’s a comprehensive guide to safely switch PHP versions on <a href="https://learn.microsoft.com/en-us/windows/wsl/install">WSL</a>.</p><p>For development, I generally bounce around from Windows to WSL. This largely depends on what I am working on at the time. With Windows, switching between versions of PHP has been relatively easy, as WAMPP has an out-of-the-box approach to this. However, it’s a different case for a command-line-only OS(Operating System) like WSL.</p><p>Recently, I was working on generating docs with PHP <a href="https://github.com/StydeNet/enlighten">Enlighten</a> using Windows, and it took me a little over one hour to run through each of the test suites. This wasn’t optimal because I can’t afford to spend 1 hour plus for each documentation I need to generate. I decided to switch my development from Windows to WSL.</p><p>This works for any version; however, for this article, I will walk you through switching from version 7.* to 8.3.</p><h3>Why Switch PHP Versions?</h3><ul><li>Different projects may require specific PHP versions</li><li>To test compatibility with newer PHP releases</li><li>To take advantage of performance improvements in newer versions</li><li>Security updates and support lifecycle</li></ul><h3>Step 1: Remove Existing PHP Versions</h3><p>First, let’s clean up any existing PHP 7.x installations:</p><pre>sudo apt-get purge php7.*<br>sudo apt-get autoclean<br>sudo apt-get autoremove</pre><p><strong>Note about these commands:</strong></p><ul><li>autoclean removes obsolete package files from your cache</li><li>autoremove removes dependencies that are no longer needed</li><li>Using purge removes both packages and their configuration files</li></ul><h3>Step 2: Add the PHP Repository</h3><p>Ondřej Surý maintains up-to-date PHP packages for Ubuntu:</p><pre>sudo add-apt-repository ppa:ondrej/php<br>sudo apt-get update</pre><h3>Step 3: Install PHP 8.3</h3><p>Now install PHP 8.3 and common extensions:</p><pre>sudo apt-get install php8.3</pre><h3>Step 4: Configure Apache (if using Apache)</h3><p>If you’re using Apache as your web server:</p><pre># Disable old PHP module (if any)<br>sudo a2dismod php7.0  # or whatever version you had before<br><br># Enable PHP 8.3<br>sudo a2enmod php8.3<br>sudo systemctl restart apache2</pre><h3>Step 5: Install Common Extensions</h3><p>Most projects require additional PHP extensions. Here’s how to install the most commonly needed ones:</p><pre>sudo apt install php8.3-common php8.3-mysql php8.3-xml php8.3-xmlrpc php8.3-curl php8.3-gd php8.3-imagick php8.3-cli php8.3-dev php8.3-imap php8.3-mbstring php8.3-opcache php8.3-soap php8.3-zip php8.3-intl -y</pre><h3>Step 6: Verify the Installation</h3><p>Check that PHP 8.3 is now your active version:</p><pre>php -v</pre><p>You should see output similar to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*qf8fKNG8yoBnUx1igyWPww.png" /><figcaption>Showing the version of PHP</figcaption></figure><h3>Switching Between Multiple PHP Versions</h3><p>If you need to maintain multiple PHP versions:</p><ol><li>Install additional versions alongside PHP 8.3:</li></ol><pre>sudo apt-get install php7.4  # example for PHP 7.4</pre><p>2. Switch between versions for CLI:</p><pre>sudo update-alternatives --config php</pre><p>Then select your preferred version from the list.</p><p>3. For Apache, use a2dismod and a2enmod as shown above.</p><h3>Troubleshooting Tips</h3><ul><li>If you get errors about missing packages, run sudo apt --fix-broken install</li><li>After changing versions, clear your application cache if applicable</li><li>Check phpinfo() In a web page, to confirm the web server is using the correct version</li><li>Some extensions might have different names in PHP 8.3 — check the exact package names if installation fails</li></ul><h3>Final Thoughts</h3><p>Upgrading to PHP 8.3 brings significant performance improvements and new features. However, always test your applications thoroughly after switching versions, as some deprecated functionality might affect your code.</p><p>Remember that the PHP 8.3 extension names follow the same pattern (php8.3-extension-name), so you can easily install any additional extensions your project requires.</p><p>To conclude, after going through these steps, Enlighten still took almost the same one hour to run on my WSL. I had to move back to Windows for development. 😅</p><p>Leave a clap if you found this helpful.</p><p>I hope you had a good read, cheers. 🥂</p><p><em>Happy coding!</em> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef7242f47f48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel API Mastery: Essential Techniques for Clean, Secure, and Efficient APIs]]></title>
            <link>https://medium.com/@osaswijojames/laravel-api-mastery-essential-techniques-for-clean-secure-and-efficient-apis-e20bfb3f7f97?source=rss-3a198d9c479f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e20bfb3f7f97</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Idada Osaigbovo James]]></dc:creator>
            <pubDate>Sat, 05 Apr 2025 22:04:32 GMT</pubDate>
            <atom:updated>2025-04-05T22:04:32.877Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*avg4ye2NSIBQJ43pqCYqkg.png" /><figcaption>Laravel Image With The Title Of Article</figcaption></figure><p><strong>Hello World! (I honestly need to come up with a catchphrase. 😅)</strong></p><p>Based on the <a href="https://laravel.com/docs/12.x">Laravel Documentation</a>, <a href="https://medium.com/@osaswijojames/5-essential-best-practices-for-laravel-developers-laravel-10-and-beyond-082192dd00d4">Personal Experience</a>, and General reading, I’ll be writing on essential techniques to improve how you write APIs with Laravel.</p><p>APIs are the backbone of modern web applications, facilitating seamless communication between different systems. Laravel, one of the most popular PHP frameworks, provides a robust and elegant way to build and manage APIs. Whether you’re building RESTful APIs or GraphQL endpoints, Laravel’s features can help streamline the development process. In this article, we’ll explore the best ways to improve creating and working with APIs in Laravel.</p><h3>1. Use API Resources for Consistent Responses</h3><p>Laravel provides <a href="https://laravel.com/docs/12.x/eloquent-resources">API resources</a> (via JsonResource) to format your API responses consistently. Instead of returning raw database models, use resources to transform and structure your data.</p><h3>Example:</h3><p>Generate a new Resource</p><pre>php artisan make:resource UserResource</pre><pre>use Illuminate\Http\Resources\Json\JsonResource;<br><br>class UserResource extends JsonResource<br>{<br>    public function toArray($request)<br>    {<br>        return [<br>            &#39;id&#39; =&gt; $this-&gt;id,<br>            &#39;name&#39; =&gt; $this-&gt;name,<br>            &#39;email&#39; =&gt; $this-&gt;email,<br>            &#39;created_at&#39; =&gt; $this-&gt;created_at-&gt;toDateTimeString(),<br>        ];<br>    }<br>}</pre><p>Then, return it in your controller:</p><pre>return new UserResource($user);</pre><p>Using resources ensures that your API responses remain consistent and well-structured.</p><h3>2. Follow RESTful Controller Method Naming</h3><p>For better maintainability and consistency, follow RESTful naming conventions for your controller methods:</p><pre>| Method    | HTTP Verb   | Purpose                          |<br>|-----------|-------------|----------------------------------|<br>|   index   | GET         | Retrieve a list of resources     |<br>|   store   | POST        | Create a new resource            |<br>|   show    | GET         | Retrieve a specific resource     |<br>|   update  | PUT/PATCH   | Update an existing resource      |<br>|   destroy | DELETE      | Remove a resource                |</pre><h3>Example Controller:</h3><pre>use App\Http\Resources\UserResource;<br>use App\Models\User;<br>use Illuminate\Http\Request;<br>use App\Http\Requests\StoreUserRequest;<br>use App\Http\Requests\UpdateUserRequest;<br><br>class UserController extends Controller<br>{<br>    public function index()<br>    {<br>        return UserResource::collection(User::all());<br>    }<br><br>    public function store(StoreUserRequest $request)<br>    {<br>        return new UserResource(User::create($request-&gt;validated()));<br>    }<br><br>    public function show(User $user)<br>    {<br>        return new UserResource($user);<br>    }<br><br>    public function update(UpdateUserRequest $request, User $user)<br>    {<br>        $user-&gt;update($request-&gt;validated());<br>        return new UserResource($user);<br>    }<br><br>    public function destroy(User $user)<br>    {<br>        $user-&gt;delete();<br>        return response()-&gt;json([&#39;message&#39; =&gt; &#39;User deleted successfully&#39;], 204);<br>    }<br>}</pre><p>Adhering to these method names maintains Laravel’s conventions and ensures clarity when working with API routes.</p><h3>3. Group API Endpoints and Use Named Routes</h3><p>Organizing API routes properly improves maintainability and readability. Use <a href="https://laravel.com/docs/12.x/controllers#api-resource-routes">apiResource</a> and named routes for clarity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*TliEXEyiWw4RuLJrKAH-yQ.png" /><figcaption>Screenshot from the Laravel Doc on how to name routes, controller methods, and what the URI points to for the Route Name</figcaption></figure><h3>Example api.php:</h3><pre>use App\Http\Controllers\UserController;<br>use Illuminate\Support\Facades\Route;<br><br>Route::prefix(&#39;v1&#39;)-&gt;group(function () {<br>    Route::apiResource(&#39;users&#39;, UserController::class)-&gt;names([<br>        &#39;index&#39; =&gt; &#39;users.index&#39;,<br>        &#39;store&#39; =&gt; &#39;users.store&#39;,<br>        &#39;show&#39; =&gt; &#39;users.show&#39;,<br>        &#39;update&#39; =&gt; &#39;users.update&#39;,<br>        &#39;destroy&#39; =&gt; &#39;users.destroy&#39;,<br>    ]);<br>});</pre><p>If you only need specific methods[<a href="https://laravel.com/docs/12.x/controllers#restful-partial-resource-routes">partial resource routes</a>], one way you can define them is like this:</p><pre>Route::apiResource(&#39;users&#39;, UserController::class)-&gt;only([&#39;index&#39;, &#39;store&#39;])-&gt;names([<br>    &#39;index&#39; =&gt; &#39;users.index&#39;,<br>    &#39;store&#39; =&gt; &#39;users.store&#39;,<br>]); // To include only index and store endpoints.</pre><p>By grouping API routes and assigning meaningful names, you can reference them easily in controllers and middleware.</p><p><strong>Note</strong>: This is a personal preference. I generally prefer using route names rather than URIs to access endpoints. There are other ways to write your endpoints, but I find this more readable and easier to maintain.</p><h3>4. Implement API Versioning</h3><p>As your API evolves, maintaining backward compatibility is crucial. Laravel allows versioning through route prefixes or subdomains.</p><h3>Example:</h3><pre>Route::prefix(&#39;v1&#39;)-&gt;group(function () {<br>    Route::apiResource(&#39;users&#39;, UserController::class);<br>});</pre><p>By structuring your API with versioning, you ensure that older clients continue to function as you introduce new features.</p><h3>5. Implement Authentication with Sanctum or Passport</h3><p>Securing your API is crucial. Laravel provides <a href="https://laravel.com/docs/12.x/sanctum">Sanctum</a> for lightweight authentication and <a href="https://laravel.com/docs/11.x/passport">Passport</a> for full OAuth2 authentication.</p><h3>Sanctum Example:</h3><pre>use Illuminate\Http\Request;<br>use Illuminate\Support\Facades\Auth;<br><br>Route::middleware(&#39;auth:sanctum&#39;)-&gt;get(&#39;/user&#39;, function (Request $request) {<br>    return new UserResource($request-&gt;user());<br>});</pre><p>Sanctum provides a simple way to authenticate SPAs and mobile applications using API tokens.</p><h3>6. Optimize Performance with Caching</h3><p>Use <a href="https://laravel.com/docs/12.x/cache">Laravel’s caching system</a> to improve API response times by caching frequently requested data.</p><h3>Example:</h3><pre>use Illuminate\Support\Facades\Cache;<br><br>public function index()<br>{<br>    return Cache::remember(&#39;users&#39;, 60, function () {<br>        return UserResource::collection(User::all());<br>    });<br>}</pre><p>This reduces unnecessary database queries and enhances performance.</p><h3>7. Implement Rate Limiting</h3><p>Protect your API from abuse by implementing <a href="https://laravel.com/docs/12.x/rate-limiting">rate limiting</a> using Laravel’s built-in features.</p><h3>Example:</h3><pre>Route::middleware(&#39;throttle:60,1&#39;)-&gt;group(function () {<br>    Route::get(&#39;/users&#39;, [UserController::class, &#39;index&#39;]);<br>});</pre><p>This limits users to 60 requests per minute, helping to prevent DDoS attacks and excessive server load.</p><h3>8. Use API Testing for Reliability</h3><p>Laravel provides PHPUnit and Pest for <a href="https://laravel.com/docs/12.x/testing">testing</a>, ensuring that your endpoints work correctly.</p><h3>Example:</h3><pre>public function test_can_create_user(): void<br>{<br>    $response = $this-&gt;postJson(route(&#39;users.store&#39;), [<br>        &#39;name&#39; =&gt; &#39;John Doe&#39;,<br>        &#39;email&#39; =&gt; &#39;john@example.com&#39;,<br>        &#39;password&#39; =&gt; &#39;password123&#39;,<br>    ]);<br><br>    $response-&gt;assertStatus(201)<br>             -&gt;assertJson([&#39;name&#39; =&gt; &#39;John Doe&#39;]);<br>}</pre><p>Automated testing helps catch issues early in development.</p><p><strong>Pro Tip</strong>: Normalize writing tests! They are very handy and would save you hours of debugging. 🙃</p><h3>Final Thoughts</h3><p>By following these best practices, you can build robust, scalable, and maintainable APIs in Laravel. Whether it’s structuring responses, securing endpoints, optimizing performance, or writing tests, these techniques will help you create high-quality APIs that stand the test of time.</p><p>Leave a clap if you found this helpful.</p><p>I hope you had a good read, cheers. 🥂</p><p><em>Happy coding!</em> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e20bfb3f7f97" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>