Laravel is fast out of the box. Still, as an application grows, pages and APIs can slow down. The good news is that most slowdowns come from a few common causes. Laravel performance optimization means finding those causes and fixing them, one at a time.

I have rebuilt slow Laravel APIs for clients and cut response times dramatically. Here are the twelve fixes I check first.

Measure before you optimize

Never guess. First, install a profiler such as Laravel Telescope or Debugbar in development. They show every query, its time and how often it runs. Then pick the slowest pages and fix them first.

Database fixes to speed up Laravel

1. Fix N+1 queries

By far, the most common problem is the N+1 query. For example, loading 50 orders and then each order's customer runs 51 queries. Eager loading fixes it with two:

$orders = Order::with('customer')->latest()->paginate(50);

You can even make Laravel throw an error on lazy loading in development with Model::preventLazyLoading().

2. Add the right indexes

Columns used in where, orderBy and joins need indexes. Without them, the database scans whole tables. As a result, queries that took seconds can drop to milliseconds.

3. Select only what you need

Similarly, avoid loading large text columns you never show. Use select() for lists, and paginate everything that can grow.

4. Process big jobs in chunks

For reports and imports, use chunk() or lazy() instead of loading thousands of rows at once. This keeps memory low and the server stable.

Caching for Laravel performance

5. Cache expensive results

Data that changes rarely, such as settings, menus or dashboard totals, can be cached for a few minutes or more, which saves repeated database work on every request:

$stats = Cache::remember('dashboard.stats', 600, fn () => $this->buildStats());

Use Redis for the cache in production, because it is much faster than the file driver.

6. Cache config, routes and views

In production, run php artisan optimize during deployment. It caches configuration, routes and views, so Laravel does less work on every request.

7. Enable OPcache

In short, OPcache keeps compiled PHP in memory. Without it, PHP recompiles your code on every request. Most good hosts enable it, but always check.

Queues and schedules for Laravel performance

8. Use queues

Sending emails, generating PDFs or calling third-party APIs should not make the user wait. Instead, push them to a queue and process them in the background with Redis and Horizon.

9. Schedule heavy reports

Likewise, reports that take minutes should run on a schedule, then be stored and shown instantly. Users see fresh data, and nobody waits.

Server and code settings to speed up Laravel

10. Keep PHP and Laravel current

New PHP versions are noticeably faster. In addition, newer Laravel releases include performance improvements. Plan upgrades instead of letting the app fall years behind.

11. Optimize the Composer autoloader

Deploy with composer install --optimize-autoloader --no-dev. This builds a faster class map and leaves out development packages.

12. Consider Laravel Octane

For high-traffic APIs, Octane keeps the application in memory between requests. Therefore, response times drop further. However, it requires care with state, so add it only after the basics are done.

Front-end and API tips for Laravel performance

Laravel performance optimization is not only about the server. Compress responses, keep API payloads small with API resources, and serve assets through a CDN. For mobile apps, see my guide to building a Laravel API for Flutter, which covers pagination and caching for slow networks.

A real-world Laravel performance optimization order

When a client sends me a slow Laravel app, I follow the same order every time. First, I enable a profiler on a copy of the app and record the slowest pages and API calls. Usually, a handful of endpoints cause most of the pain.

Next, I look at the queries on those endpoints. In most cases, N+1 queries and missing indexes explain the bulk of the delay, so I fix those first. After that, I check for slow work inside the request, such as emails or API calls, and move it to a queue.

Then I add caching for data that rarely changes, and I confirm that production uses Redis, OPcache and cached config. Finally, I measure again and compare against the first recording. Because each step is measured, the client can see exactly what improved and why. Moreover, the same profiler setup keeps catching new problems as the app grows.

Laravel performance: common questions

Is Laravel slower than other frameworks?

Not in practice. Most slow Laravel apps are slow because of queries, missing caching or heavy synchronous work. Fix those, and Laravel is very fast.

Do I need a bigger server?

Usually not first. In fact, query and caching fixes often give far bigger gains than extra hardware, and they cost less. Once the code is efficient, however, scaling the server is simple and predictable.

How often should I review performance?

Review the slowest endpoints after every major release, and keep monitoring in production. That way, new N+1 queries never reach users unnoticed.

Your Laravel performance optimization checklist

  • Profile first, then fix the slowest pages.
  • Eager load relations, add indexes, paginate.
  • Cache data, config, routes and views; use Redis and OPcache.
  • Move slow work to queues and schedules.
  • Keep PHP and Laravel current.

Is your Laravel app slower than it should be? Get in touch and I will find the bottlenecks. You can also see my services.