Laravel DOES NOT Reuse Code

Video thumbnail

First of all, I want to clarify that this is an opinion piece. I love Laravel—and I think that's more than clear considering I've written three books about Laravel, one of more than 700 pages and two of 330 pages each.

However, as much as I care for the framework, I think it's always important to be critical. It's not about blind fanaticism, but about observing and commenting on aspects that affect productivity and the development experience.

Laravel and the evolution of its packages

With version changes, especially starting from Laravel 12 and 13, it's noticeable that code from previous versions isn't always reused. This creates certain problems:

  • When you update projects, some functionalities may break.
  • Breeze, for example, stopped being part of the official package, which can cause confusion.
  • By fragmenting so much, consistency is lost, and uncertainty can be generated about what works and what doesn't.

Change in Inertia project structure

If you compare an old project with a new one in Inertia, you'll notice significant differences:

  • Component structure: now all route and component names are lowercase and organized differently.
    • Before: resources/js/Pages/Profile.vue
    • Now: resources/js/pages/settings/Appearance.vue
  • Use of TypeScript: it has been incorporated into many new projects.
  • Change in internal components:
    • Before: <Label label='Type' />
    • Now: <Label>Type</Label>
  • Fewer integrated functionalities:
    • Jetstream previously offered API Tokens and role management with Spatie.
    • Now they invented the concept of Teams, replacing already known roles and permissions, which makes it difficult to reuse existing documentation and community.

Comparison of views and components

Laravel 12/13 (Inertia + TypeScript)

<SettingsLayout>
 <div class="flex flex-col space-y-6">
   <HeadingSmall title="Profile information" description="Update your name and email address" />
   <form @submit.prevent="submit" class="space-y-6">
     <div class="grid gap-2">
       <Label for="name">Name</Label>
       <Input id="name" v-model="form.name" required />
       <InputError :message="form.errors.name" />
     </div>
     <div class="grid gap-2">
       <Label for="email">Email address</Label>
       <Input id="email" type="email" v-model="form.email" required />
       <InputError :message="form.errors.email" />
     </div>
   </form>
 </div>
</SettingsLayout>

Laravel 11 (Jetstream + Livewire)

<FormSection @submitted="updateProfileInformation">
 <template #title>Profile Information</template>
 <template #description>Update your account's profile information and email address.</template>
 <template #form>
   <div v-if="$page.props.jetstream.managesProfilePhotos">
     <input id="photo" ref="photoInput" type="file" class="hidden" @change="updatePhotoPreview">
     <InputLabel for="photo" value="Photo" />
     <div v-show="!photoPreview">
       <img :src="user.profile_photo_url" :alt="user.name" class="rounded-full h-20 w-20 object-cover">
     </div>
   </div>
 </template>
</FormSection>

Conclusion: the structure and components have completely changed, as if two different developers had worked on projects of the same type. This complicates code reuse and generates additional learning.

Duality of technologies: Breeze and Fortify

  • Breeze and Fortify perform similar functions.
  • Fortify allows separating the authentication logic from the interface, which makes sense.
  • But in many cases, components that already existed are reinvented, instead of reusing the official packages and adding style to them.

Summary

Laravel is still an excellent framework, but:

  • It doesn't always reuse its own package ecosystem.
  • Changes between versions can break existing projects.
  • Fragmentation generates a higher learning curve and confusion in the component structure.

In short, one can love Laravel and still criticize design and evolution decisions of the framework.

We analyze the projects generated using the starter kit for Laravel Inertia.

I agree to receive announcements of interest about this Blog.

Andrés Cruz

ES En español