<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jasmine Dueñas</title>
    <description>The latest articles on Forem by Jasmine Dueñas (@jas_duenas).</description>
    <link>https://forem.com/jas_duenas</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3911654%2F5aed0c3a-5526-49b4-ad13-04dca6d0e7cc.jpg</url>
      <title>Forem: Jasmine Dueñas</title>
      <link>https://forem.com/jas_duenas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jas_duenas"/>
    <language>en</language>
    <item>
      <title>6 Things We Learned the Hard Way About Laravel Performance in Real Projects</title>
      <dc:creator>Jasmine Dueñas</dc:creator>
      <pubDate>Tue, 05 May 2026 05:36:24 +0000</pubDate>
      <link>https://forem.com/jas_duenas/6-things-we-learned-the-hard-way-about-laravel-performance-in-real-projects-43b8</link>
      <guid>https://forem.com/jas_duenas/6-things-we-learned-the-hard-way-about-laravel-performance-in-real-projects-43b8</guid>
      <description>&lt;p&gt;In this article, I'll share six Laravel performance lessons we learned from building real client systems, including how Eloquent queries, caching, code structure, deadlines, and communication affected the way we build and maintain applications.&lt;/p&gt;

&lt;p&gt;We didn't notice anything wrong at first.&lt;/p&gt;

&lt;p&gt;The app worked, responses were fine, and everything looked clean during development.&lt;/p&gt;

&lt;p&gt;Then real users started using it every day.&lt;/p&gt;

&lt;p&gt;APIs slowed down, dashboards took longer to load, and small inefficiencies started to add up.&lt;/p&gt;

&lt;p&gt;That's when we realized most of the issues were not infrastructure related. They were coming from how we were building things in Laravel.&lt;/p&gt;

&lt;p&gt;I've been working on Laravel projects with a small team at &lt;a href="https://spice-factory.ph/" rel="noopener noreferrer"&gt;Spice Factory Philippines&lt;/a&gt;, mostly working with companies that rely on these systems for daily operations, and these are some of the things we learned the hard way.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Eloquent is easy to use, but also easy to abuse
&lt;/h2&gt;

&lt;p&gt;Eloquent makes it very easy to move fast, especially early on.&lt;/p&gt;

&lt;p&gt;The problem is, it also makes it easy to ignore what's happening underneath.&lt;/p&gt;

&lt;p&gt;We ran into cases where endpoints were slower than expected because of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;relationships being loaded inside loops&lt;/li&gt;
&lt;li&gt;too many queries being executed&lt;/li&gt;
&lt;li&gt;returning more data than needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fixing it wasn't complicated. Just being more intentional with queries already helped.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'roles'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Once we started checking queries more carefully, performance improved right away.&lt;/p&gt;


&lt;h2&gt;
  
  
  2. Most slow APIs are not infrastructure problems
&lt;/h2&gt;

&lt;p&gt;At one point, we thought we needed to upgrade servers.&lt;/p&gt;

&lt;p&gt;It turned out the issue was in our own code.&lt;/p&gt;

&lt;p&gt;Some of the common problems we saw:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;missing database indexes&lt;/li&gt;
&lt;li&gt;repeated queries for the same data&lt;/li&gt;
&lt;li&gt;unnecessary data being fetched&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After cleaning those up, response times improved without changing infrastructure.&lt;/p&gt;

&lt;p&gt;That was a good reminder that optimization usually starts at the application level.&lt;/p&gt;


&lt;h2&gt;
  
  
  3. Caching felt optional until it wasn't
&lt;/h2&gt;

&lt;p&gt;During development, everything worked fine without caching.&lt;/p&gt;

&lt;p&gt;Once real usage kicked in, especially on dashboards and reports, the difference became obvious.&lt;/p&gt;

&lt;p&gt;We started adding caching in places where data didn't need to be recalculated every time.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Cache&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;remember&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'dashboard_stats'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getStats&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Even simple caching made a noticeable impact on performance and reduced database load.&lt;/p&gt;


&lt;h2&gt;
  
  
  4. Structure matters when the project grows
&lt;/h2&gt;

&lt;p&gt;For smaller features, putting logic in controllers worked fine.&lt;/p&gt;

&lt;p&gt;As the system grew, it became harder to manage and reason about.&lt;/p&gt;

&lt;p&gt;We didn't do a full rewrite. It was more gradual.&lt;/p&gt;

&lt;p&gt;Whenever something started to feel messy, we moved logic into services or broke things into smaller pieces.&lt;/p&gt;

&lt;p&gt;That made the codebase easier to maintain, especially when multiple developers were working on it.&lt;/p&gt;


&lt;h2&gt;
  
  
  5. Deadlines change how you think about "clean code"
&lt;/h2&gt;

&lt;p&gt;In personal projects, you can spend time getting everything just right.&lt;/p&gt;

&lt;p&gt;In client work, timelines are part of the equation.&lt;/p&gt;

&lt;p&gt;Sometimes the focus is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;getting something working&lt;/li&gt;
&lt;li&gt;making sure it's stable&lt;/li&gt;
&lt;li&gt;improving it later when there's time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You start thinking in terms of trade-offs instead of trying to make everything perfect from the start.&lt;/p&gt;


&lt;h2&gt;
  
  
  6. Communication saves more time than clever code
&lt;/h2&gt;

&lt;p&gt;One thing that made a bigger difference than expected was communication.&lt;/p&gt;

&lt;p&gt;A lot of issues we dealt with were not technical. They came from unclear requirements or assumptions.&lt;/p&gt;

&lt;p&gt;Taking time to clarify things early helped avoid rework later.&lt;/p&gt;

&lt;p&gt;In many cases, being clear saved more time than trying to come up with a more complex solution.&lt;/p&gt;


&lt;h2&gt;
  
  
  What we learned from all this
&lt;/h2&gt;

&lt;p&gt;Working on real client systems changed how we approach Laravel projects.&lt;/p&gt;

&lt;p&gt;You start paying attention to things that don't always show up in tutorials like performance, structure, and communication.&lt;/p&gt;

&lt;p&gt;We're still figuring things out as we go, but these are the ones that made the biggest difference so far.&lt;/p&gt;

&lt;p&gt;If you're working on similar projects, curious what things stood out for you once you moved from tutorials to real systems.&lt;/p&gt;

&lt;p&gt;If you're curious how we approach building and maintaining systems for real-world use, you can check what we do here:&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://spice-factory.ph/service" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fproduction-os-assets%2Fassets%2F44936b4a-dc14-43ec-b7e4-803d26f72725" height="400" class="m-0" width="400"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://spice-factory.ph/service" rel="noopener noreferrer" class="c-link"&gt;
            Web, System &amp;amp; Mobile Development | Spice Factory PH
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Web development, mobile apps, and custom systems from strategy to launch. Agile delivery with modern stacks and engineer-led collaboration.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Fproduction-os-assets%2Fassets%2Feb710e7f-2ee8-45d6-8d12-7d599c22f0dd" width="192" height="192"&gt;
          spice-factory.ph
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>laravel</category>
      <category>php</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
