r/laravel • • 1d ago

Laravel Best Practices: Clean Code and Architecture

Thumbnail
codyssey.dev
36 Upvotes

Hey all,

I wrote a course about the bad habits that make Laravel codebases hard to change, work with as well as slower as the complexity grows over time in long-term applications.

The examples are specific to Laravel but they can also be applied to any other PHP application as well with the framework-equivalent approach.

I’ve made some of these mistakes myself as well as I’ve seen them in different projects of different sizes I worked on over the years so the list does come from experience.

The story and the examples are fictional but the habits are based on a true story.

Let me know what you think and if you find anything out of the ordinary in the text, readability or examples.

Thanks!


r/laravel • • 3h ago

Laravel Rust Packages: A Curated Preview

Thumbnail laraplugins.io
0 Upvotes

for Laraplugins I put up a directory of laravel rust crates that declares laravel rust support and would work nice with your projects


r/laravel • • 23h ago

I built a shared pixel canvas with Laravel Rust

Post image
8 Upvotes

A fun experiment with Laravel Rust, already saw some cool things come by 👀

Try it: dots.spatie.be
Blogpost: https://freek.dev/3255-i-built-a-shared-pixel-canvas-with-laravel-rust
Repo: https://github.com/spatie/dots.spatie.be


r/laravel • • 1d ago

Laravel Go and Rust are not ready

143 Upvotes

I've been testing both Laravel Go and Rust, especially Go and the amount of plumbing you have to do for a statically typed language is unbearable at some point.

Relationships, you have to use struct tags, which are strings, easy to make mistakes.

The fact that you have to implement models manually, you could miss a field or field type that's in your migration, Laravel PHP handled this so well, one source of truth even if it's not statically typed, IDEs showed suggestions of your migration schema.

Validation workflow can be improved, especially in rust, no auto complete or suggestions, you have to keep the docs open for that.

Error handling could also improve especially for Go.

It's either these frameworks are meant for AI agents, or they'll improve over time, I mean it's version 0.1 so ...

Anyway as a long time Go and PHP dev, these frameworks are far from production when you dive a bit deeper not just benchmarks.


r/laravel • • 3h ago

Laravel Rust Debugbar

Post image
0 Upvotes

Hi, Laravel Rust is here, it only makes sense to have a Debugbar for it too.

Laravel Rust Debugbar, bring the familiar debugging experience to Laravel for Rust.

It helps you inspect requests, database queries, logs, exceptions, timelines, and more.

Still a work in progress, but feel free to check it out!

GitHub: https://github.com/eznix86/laravel-rust-debugbar


r/laravel • • 18h ago

PagibleAI CMS 0.14: one page tree for all languages, 5 CMS importers and 17 new themes

Post image
0 Upvotes

I maintain PagibleAI CMS, an MIT-licensed CMS package for Laravel 11–13 and PHP 8.2+. 0.14 is out, and most of it is about multilingual sites.

composer require aimeos/pagible
php artisan cms:install
php artisan cms:user -e you@example.com

It uses your User model, guards and queue. Pages are stored in your database and rendered with Blade, or served headless through JSON:API and GraphQL. Editors get a Vue admin with a page tree, drafts, version history and scheduled publishing. AI features (writing, translation, images, an MCP server for agents) are optional and stay off until you add API keys - or can be skipped entirely in custom distributions.

Languages

In 0.13 and earlier, a translation was a separate page linked to the original. Now a page is a single tree node with one variant per language. Each variant has its own URL, drafts and publish date, and moving a page moves all its languages.

Reading a page with fallback looks like this:

use Aimeos\Cms\Models\PageView;

$page = PageView::live($request->user(), 'de-CH')
    ->whereKey($id)
    ->firstOrFail();

$page->lang; // "de" if there's no Swiss German variant, else the source language

de-CH falls back to de by default, and you can set your own chains in config/cms.php, e.g. 'lb' => ['de', 'fr']. The fallback is resolved in a single SQL query, not by loading all variants and filtering in PHP. Pages send hreflang links and a Content-Language header.

When someone publishes changes to the source page, its translations are marked as outdated. Translate sends only the changed elements to DeepL or an LLM and saves the result as a draft for review. If an agency does your French translations, php artisan cms:user --langs=fr translator@example.com lets their account edit the French variants and nothing else.

Change events carry the language, so your app can react when a single translation goes live:

use Aimeos\Cms\ContentType;
use Aimeos\Cms\Events\Change;

Change::listen('published', function (Change $change) {
    if ($change->type() === ContentType::Page && $change->lang === 'fr') {
        // notify the French team, warm a cache, ...
    }
});

Importers

aimeos/pagible-import now covers Drupal 7/8+, Joomla 3–5 and Statamic, and the WordPress and TYPO3 importers were mostly rewritten. You add the old database as a second connection in config/database.php, and the importer reads it with the query builder. It brings over the page tree, redirects, SEO metadata and translations, and the translations end up as variants of the original page.

php artisan cms:joomla-import --connection=joomla --dry-run

All importers accept --since=2026-11-01 to import only content changed since then. That lets you keep the old site live while you build the new one, then sync once more before switching DNS. They're still beta, and every old CMS database has its own quirks. If one fails on your data, an issue with the error message helps most.

Themes

There are 17 new themes, 28 in total, mostly for small businesses: plumbers, electricians, builders, doctors, law firms, cafés, bars, salons, plus SaaS, documentation and portfolio sites. Each comes with demo content and is its own Composer package.

Layouts are built from Blade components like <x-cms::head>, <x-cms::menu>, <x-cms::languages> and <x-cms::image>, so a custom theme is mostly your own markup and CSS. php artisan cms:schema:check validates your own content element definitions.

All themes: https://pagible.com/themes

Upgrade

This is a breaking upgrade. The migration turns every existing page into the source variant of itself, but translations that were linked as separate pages in 0.13 stay separate, and you have to merge them yourself. The PHP API, GraphQL, MCP and JSON:API changed too. Everything is listed in the upgrade guide: https://pagible.com/upgrade-pagibleai-cms

  • GitHub: https://github.com/aimeos/pagible
  • Docs: https://pagible.com/documentation
  • Multilingual sites: https://pagible.com/multilingual-websites

If you like PagibleAI, give it a star on Github :-)


r/laravel • • 2d ago

Laravel Cobol 0.x Release!

Post image
639 Upvotes

https://github.com/pihedy/laravel-cobol

First Rust, then Go. Why stop there?

Introducing Laravel for COBOL, an AI-first framework powered by enterprise technology from 1959.

With modern AI agents, you no longer need to understand COBOL. Or your application.

Benchmarks against PHP running on a €7 VPS are coming soon.

Ship confidently. Understand optionally.

/s


r/laravel • • 1d ago

FLEX Theme — a visual theme editor, enhanced search and keyboard workflows for Filament 5

Post image
8 Upvotes

Give your Laravel admin panel its own identity—and make everyday tasks easier to reach.
FLEX Theme combines a visual redesign with configurable workflow tools:

  • Visual theme editor: customize colors, fonts, branding, corners and layouts without writing CSS for each component.
  • Global Search with actions: find records, open edit forms and run authorized actions directly from the search window. Add custom commands, sources and nested contexts.
  • Keyboard controls: navigate table rows, select records, change pages and open filters with configurable shortcuts.
  • Interface details: stacked notifications, scheduled announcement bars, floating side panels and expandable bottom sheets.

Keep native Filament resources, forms, actions and permissions. Configure each panel independently, with selected settings controlled in PHP. Styling also works consistently with FLEX Fields.
Paid package. One-time payment, with one year of updates included.
Video, documentation and details:
https://filamentphp.com/plugins/bjanczak-flex-theme


r/laravel • • 2d ago

What’s Laravel’s strategy with Rust and Go?

Thumbnail
laravel.com
143 Upvotes

I just saw that they also released Laravel Go, a day after releasing Laravel Rust. I really struggle to understand the overall strategy from Laravel.

Looking at the commit histories and contributor graphs it looks like both are vibe coded by Taylor himself pretty much alone with his agents. That is really not what I’m looking for in a framework.

https://github.com/laravel/go/graphs/contributors

https://github.com/laravel/rust/graphs/contributors

With all the resources Laravel have I would have expected them to hire one of the best developers in their respective language and ecosystems to lead the development of such projects. Taylor could guide the API design and developer experience to make it feel like Laravel. His taste is a big part of the appeal with Laravel, but it also needs to be technical excellence under the hood of a good framework. You need to be able to trust that the implementation is sound and how can a PHP developer with AI do that? Focusing on the developer experience as main selling point also doesn't make sense if they are going all in on AI.

Unfortunately, this just looks very much like a slop fest where they are just launching things without much thought behind. Is it just an experiment to what the community things and see if it sticks?

I think making one of them would have been a reasonable bet, but one guy building two new frameworks from scratch in parallell just seems strange.

What are your takes? Can you see the strategy here?


r/laravel • • 2d ago

Comparing Laravel Go and Arkoren

Thumbnail
arkoren.dev
19 Upvotes

r/laravel • • 2d ago

Introducing Laravel for Holy-C (0.2.2-omega)

88 Upvotes

https://github.com/parablesoft/laravel-holyc

After the Go and Rust ports, it was clear the community wanted a Laravel without a garbage collector, a borrow checker, or user mode. So we ported it to HolyC and it runs in Ring 0 on TempleOS from the moment the machine boots.

Everything you know is here, with better names. Artisan is now Oracle, and every command replies with a random passage. Eloquent is Revelation ORM: models are revealed, not queried. Blade is Psalms and renders in the full 16-colour VGA palette. Composer is Covenant, and Covenant require is binding. Sanctum keeps its name, since it was already perfect.

One honest note on networking: TempleOS has no TCP/IP stack, so routing is resolved by divine intervention. Requests arrive when they are meant to, and response time is eternal. In our benchmarks this made HolyC the clear winner on spiritual throughput, with zero requests served.

Installation is two steps. Step 1: install TempleOS. Step 2: there is no step 2.

Repo, roadmap, and the "From Zero to Divine" series are in the link. Networking support is coming when it is revealed.

Unofficial parody by ParableSoft. Not affiliated with Laravel LLC.

/s


r/laravel • • 2d ago

Laravel Go is Here

Thumbnail
github.com
111 Upvotes

r/laravel • • 2d ago

I repeated Laravel's official Rust vs PHP benchmark on Hetzner, including PHP-FPM and a €7 VPS

66 Upvotes

Since Laravel put their benchmark apps and k6 script on GitHub, I spent today rerunning it on a few Hetzner boxes I rented for a couple euros.

Same k6 script, MySQL 8.4, and I also added nginx + PHP-FPM and a €7 VPS with everything on one box since that's closer to what most of us actually run. (Their PHP number was Octane + FrankenPHP, so I ran both.)

Best clean 10 second window (req/s):

ServerLaravel RustOctane + FrankenPHPnginx + PHP-FPMRust vs Octane
1 dedicated vCPU, 4 GiB1,991 (hit 2k cap)16793at least 11.9x
€7 VPS, 2 shared vCPU, 4 GB1,013906211.2x
Same VPS, 1 vCPU, 1 GB562453112.6x

So 11 to 13x instead of 18x, mostly because Octane did better on my dedicated vCPU than on Cloud (167 vs 97) and Rust hit the 2,000 cap in the script.

Two things that surprised me on the cheap boxes:

  • Once PHP goes past its limit it just falls over instead of slowing down (at 50 req/s on 1 GB, Octane failed 66.7% and PHP-FPM failed 97.6%).
  • MySQL got OOM-killed 3 times on the 1 GB box during the PHP runs, never during Rust.

Obviously the benchmark API is tiny (10 authors, 200 chirps), so with real DB queries the gap will be smaller. Wouldn't rewrite a working app for this, just wanted to see real numbers outside Laravel Cloud.

Full write-up: https://hafiz.dev/blog/laravel-rust-vs-php-benchmark-hetzner

Scripts and raw results: https://github.com/hzeeshan/laravel-rust-bench


r/laravel • • 2d ago

Laravel Rust: From a critical POV.

45 Upvotes

I stumbled upon this post on X, usually X is full of bots and "full of positivity". But this one raises some real questions and criticism. I think being able to communicate this and discussing it is a healthy behavior. Would love to hear fellow ex-artisans thoughts.

My POV: I love the idea of RUST, but I don't like to diss PHP to boost rust in an unfair manner for marketing purposes.

original post: https://x.com/ihxnnxs/status/2127921376707166231


r/laravel • • 1d ago

Simple Data Objects 3.0: stricter request input, and what landed since 1.x

0 Upvotes

Seeing Laravel get rewritten in every other language this week, maybe I should have written this package in Rust, Go, Zig or even COBOL :)

Anyway.

I maintain Simple Data Objects, a DTO library for Laravel 12–13 and any PHP application. I posted it here back on 1.x, with the benchmark: https://github.com/std-out/simple-data-objects

3.0 is out. It has some breaking changes, and all of them are about input: the library now rejects values that 2.x let through or quietly changed. No public API was removed.

The one that bothered me most: a DTO built from $request->all() with public bool $gift got true for "gift": "false". $request->boolean('gift') handles that string, but my generated hydrators ran in PHP's weak mode, where "false" is just a non-empty string. Same for int: "1.9" became 1 with only a deprecation notice.

final class Order
{
    public function __construct(public int $qty, public bool $gift) {}
}

new Order('1.9', 'false'); // qty: 1, gift: true

In 3.0 scalars only take values that convert without loss. "3" is still fine for an int, "false" becomes false, anything else throws with the field name.

Other changes:

  • Validation now checks the value after pipes like trim, not the raw input. In 2.x ' ab ' passed min:3 because the spaces counted, then got trimmed and saved as 'ab', which is too short. Now it fails validation.
  • #[Rules] on a nested DTO always apply. Before, they were skipped unless the parent had #[InferRules].
  • An unknown value for a nullable enum is an error, not null.
  • An exception from a cast or a pipe is rethrown as DataHydrationException with the field name, and built-in casts throw instead of PHP warnings.
  • FloatCast rejects INF and NAN by default. JSON 1e400 decodes to INF.
  • A legacy EncryptedCast key that isn't 32 random bytes now throws, unless you also pass a keyring. 2.9 already warned about it.

Most apps need no code changes. UPGRADE-3.0.md in the repo says which classes to check.

Since 1.x, which is what I posted here last time, 2.x added:

  • Optional for PATCH endpoints: an absent key is different from an explicit null, and #[InferRules] makes such fields sometimes instead of required.
  • #[Hidden(except: ['admin'])] with toArray(context: 'admin'), so one class can render different API outputs.
  • JSON Schema and TypeScript types from the same classes (php artisan sdo:typescript).
  • lazyXml() to stream a large XML file into DTOs one element at a time.
  • #[Sensitive] fields, card numbers masked in exception messages, and EncryptedCast with key rotation.
  • make:data --from-json and --from-model to generate a class from a sample payload or a model.

Hydration is still compiled per class with no reflection at runtime. The benchmark numbers are in the README if you want them.

I'd be glad if you gave it a try and shared your feedback.

I think I'll start writing in Rust after all. xD


r/laravel • • 3d ago

If AI can write Rust, why do we need Laravel Rust?

Thumbnail
amitmerchant.com
61 Upvotes

I've been thinking about Laravel's recent announcement of Laravel Rust.

With AI agents increasingly capable of writing applications in languages we barely know, I wonder if frameworks are actually becoming more important rather than less.

After all, having AI write the code is one thing. Giving it a well-established foundation to build upon is another.

I explored this idea a little further in my latest article. Although it's just my opinion.

Curious to hear what other Laravel developers think about this. Where do you see frameworks fitting into the AI-assisted development era?


r/laravel • • 3d ago

Lets talk about the future of Laravel

25 Upvotes

TL;DR

Laravel remains my framework of choice, and I intend to experiment with the Rust version. However, recent developments in AI and software security are changing how at look at frameworks in general.

This is my perspective, based on years of software development and DevOps experience. I'd just like to hear what other think. What benefit is a framework even giving you in this day in age?

________________

So to start of, I've worked with Laravel for about 8 years now and over the course of that period went from Laravel 4 to the latest "non-Rust" version. Built a lot of projects with it and a few custom packages that we used inside the company for different projects. After a few years, at one point asked myself "why am I even using Laravel".

Then started to make my own framework. Just wanted to see if I can and for that reason also decided not to use any Composer package. Models, Controllers, a router, even a custom templating system and with it build exactly ONE project that went into production. My conclusion and the answer what Laravel gave me was simple...

Time!

Building the framework isn't hard and I believe every developer in here knows it, but we don't want to think about every single edge case what an end user can do on your app, then write tests for those cases, then error handling etc.

So we just slap a

laravel new app

in our terminal and we're good to go. It saves so much time and effort. If you haven't tried building your own framework, all I can say is, it feels like 90% of your work is done by running that single command.

Then AI came and for a while I refused to use it because more often than not I had to fix what the agent made. And once again, I asked myself "am I saving time by useing this new tool".

For a long while the answer was a clear "no". This isn't the case anymore. I've made my own LLM skills that are included in my projects, tuned them to do logic as I would do them myself, not how the agent felt "the best practice" is in that particular prompt. It allways has the full context of the project as a whole.

For example if I use something like a custom Auth macro that defines the logged in Company model:

Auth::macro('company', fn () : Company => ... );

it knows to use Auth::company(); instead of adding the whole logic of checking the session and querying the model. To do it, adding new methods in controllers that do the exact same thing as it already done in another controller. Also splitting that logic in 5 different methods that all have a single line of code. Well, it's "best practice" and that's how the LLM was trained.

Also, I'm no longer ending up with different features coded in different styles. Everything is structured the same and really easy for me to review.

The best part is I can add all this inside AGENTS.md as well as give the rest of my team the same SKILL.md so that everyone's LLM works the same. So I don't have to pull out my hair on every new feature merge request.

I know I'm not saying anything groundbreaking here, I'm just trying to express my point of view on the whole situation and to finally address the elephant in the room. This thing:

https://laravel.com/blog/introducing-laravel-for-rust

I started reading the article and one line, one single statement gave me a flashback to that original question.

Laravel Rust is built with the forward-looking perspective that humans will increasingly neither write nor manually read application code at scale.

So here we are, the same question, "why am I using Laravel in the first place". Because there is another side to this that I feel isn't really addressed a lot. I also do a lot of DevOps and with the recent exploits found on everything imaginable, my focus is much more on our servers than our app code.

Even last night I spent a few hours fixing one of our clients sites that got hacked. And sure, it's wrapped in it's own container so it can't spread, we mostly provide the hosting service to them, not web maintenece, but still, have to clean it up. The client's web site is done in Wordpress (the bane of my existance) and uses a plugin called WP-Rocket and wouldn't you know it...bam:

https://wp-rocket.me/docs/wp-rocket-security-advisory-and-mitigation-steps-for-cve-2026-125812/

reading the site's logs it was the exact exploit used.

The reason am I even mentioning this here is because these exploits got me thinking for the past few weeks. It's no longer just the Wordpress pages that are vulnerable, it's...everything with any ounce of publicly available code. Even the Linux Kernel got compromised. So why even use public frameworks any more? Just use LLMs to make your own framework and go the "security through obscurity" route, right?

Sure, on average, it's much MUCH harder to exploit a Laravel project than a Wordpress page (in my 8 years of working with Laravel, it never happened), but for how long? People are doing PC ports of GTA 6 for crying out loud and before you tell me how these ports are no where near functional, I need to remind you that the amount of progress done in a matter of 2 weeks...TWO WEEKS since the game came out on consoles is INSANE. Something like this took years to do by hand.

Think about the PHP2Shell exploit. Again, I'm not trying to debate how and if any websites even got hacked using that exploit but you have to understand how it even works. A lot of guessing what is currently written in the memory and injecting another block of code in a really precice and really tiny window of time, to do the elevated privilege execution. A human would NEVER do it. But given enough time, if it wasn't patched, there would definitely be a script that could execute it with little to no effort.

Am I crazy?

Anyway, sorry for the rant, had to get this off my chest.


r/laravel • • 1d ago

How we ported our packages to Go after the surprise Laravel Go release

Thumbnail
spatie.be
0 Upvotes

r/laravel • • 3d ago

New laravel homepage: There are 14 occurrences of the word "Cloud" and ZERO occurrences of the word "Artisan". I feel totally betrayed.

Post image
254 Upvotes

I am a laravel developer since Laravel 5. I am an Artisan. Yes, I use AI, but I also spent years and years coding by hand. They finally removed the word "artisan" from their homepage 🤡


r/laravel • • 3d ago

Laravel Rust is here

Thumbnail
laravel.com
275 Upvotes

Laravel Rust is a new open-source framework from Taylor Otwell. It has everything you love about Laravel: Models, queues, mail, auth, and more.

And it’s really, really fast. Sam Rose ran the benchmarks: 18× the throughput of Laravel PHP.

Read more → https://laravel.com/blog/laravel-rust-benchmark


r/laravel • • 2d ago

Messing around with running Laravel PHP and Laravel Rust side by side

5 Upvotes

Been playing with Laravel Rust since launch and wanted to see if I could get it running alongside an existing PHP app. I put together a little package for it called Oxidize.

I’m testing it on one of my shops now. Rust handles /search and PHP does the rest. Both apps use the same domain and database, and I’m still logged in when I go to search. Looks promising so far :D

It’s early days, so if you feel like messing around with it too, I’d love to hear how it goes :)

https://github.com/jakub-lipinski/oxidize-for-laravel
Website with early docs: https://oxidize.lipinskijakub.pl/


r/laravel • • 2d ago

Will Laravel Forge support Laravel Rust?

3 Upvotes

Haven't seen anything around this yet, are they expecting everyone to also move to Laravel Cloud for Rust?


r/laravel • • 2d ago

Herd - Windows 11 Smart App Control regularly blocks DLLs on start

Post image
5 Upvotes

I'm curious if anybody else is inundated with popups from Windows 11 Smart App Control blocking various DDLs and modules upon starting Herd?

I've only had the popups since the last few versions (definitely since the Herd V2 update).

Smart App Control does not have a feature like with Defender, etc that lets you add specific apps or directories to an allowlist. It is either ON or OFF and I don't want to disable it for the entire operating system for Herd.

The blocks aren't consistent - it doesn't do it every time I start Herd and it isn't always for the same set of DLLs. Which is a good thing since it at least works but it makes it very tough to try resolve permanently.

Nothing else on my system triggers Smart App Control other than Herd since V2. I have tried to install different versions of PHP, remove older versions, everything is up to date...none of that worked so far.

I was keen to hear other's experience to figure out if it "doesn't work on my machine" or if it's a general issue.


r/laravel • • 3d ago

We ported a selection of our Spatie packages to Rust for Laravel Rust

75 Upvotes

At Spatie, we've ported a selection of our packages to Rust, including Media Library, Permission and framework-agnostic tools like Browsershot.

We've also added Rust and Laravel Rust support to Flare, currently in beta. Flare also has an MCP server, so your agent can access exception messages and performance data.

My blog, freek.dev, already runs on Laravel Rust. The code is open source.