Can we use Laravel as a Next.js alternative?

  Рет қаралды 16,195

Andrew Schmelyun

Andrew Schmelyun

Күн бұрын

The Laravel ecosystem continues to grow and add a breadth of new features recently with packages like Folio and Volt.
That combined with the resurgence of modern PHP means that Laravel could very well be a solid alternative to Next.js if you're looking for a framework to build rich interactive websites and reliable applications.
In this video, I build a super basic blog to show off some of the big features that Next.js presents with, like page-based routing, markdown content, static-site generation, and single file components.
Interested in learning how to build real-world practical apps with Laravel and PHP? Preorder my latest course at selfmadesaas.com for 25% off until launch!
- 0:00 Intro
- 0:41 Page-based routing
- 3:57 Markdown content
- 9:24 Route-model binding
- 13:45 Static-site generation
- 15:23 Single file components
- 19:55 Wrapping up
Send me new video ideas and vote on what's coming next: suggest.gg/aschmelyun
Follow me on Twitter! / aschmelyun
Join my newsletter, where I send out new information about twice a month in the PHP, JavaScript, and Docker realms: aschmelyun.substack.com

Пікірлер: 67
@TheOne11111
@TheOne11111 7 ай бұрын
I'm so boring to write PHP code after using PHP and laravel for over 5 years. PHP and Laravel is super easy. I had the hard time to switch other languages for the better job opportunities because I was so addicted the comfortable zone of using PHP. Man, that was hard to leave PHP.
@Icodestuff
@Icodestuff 10 ай бұрын
I watched the video in full and as an experienced laravel developer I am not sure that Laravel is a suitable solution for something as simple as a blog as this video somewhat shows how overwhelming it can be to build something as basic as a blog for beginners. Sure, someone experienced like me can easily watch this but I feel where Laravel truly shines is when you have a complex application where you need things like a mailing system, queuing system and cron jobs. I feel Laravel is a much better sell than NextJS when an application is forced to incorporate more complexity as the NextJS ecosystem is really fragmented.
@cryptoboy1461
@cryptoboy1461 10 ай бұрын
Totally agree 👍
@baware80
@baware80 10 ай бұрын
I agree, Laravel shines when it comes to build real life applications that need a robust mailing, queuing, cron job system and with the use of filament that brings it to the next level.
@aschmelyun
@aschmelyun 10 ай бұрын
100% agree, and a blog probably wasn't the best demo for a direct comparison between the two. Agree though about the fragmentation, I feel like for beginners even Next.js is a harder ecosystem to fully grasp vs Laravel.
@Imam.Mehdi_
@Imam.Mehdi_ 9 ай бұрын
​@@aschmelyunplz make. A full professional course on php and backend
@JuriBinturong
@JuriBinturong 3 ай бұрын
Im came from the React/Next world and then moved to Vue/Laravel + WordPress. The ease of use is just much better with my current tech stack. I can still make mobile apps using Quasar + Ionic Capacitor, all while using Vue and Laravel.
@lzl0_699
@lzl0_699 10 ай бұрын
These are two very different technologies. With NextJS you are giving up a complex backend for the sake of UX, with Laravel it's the opposite effect. Astro/Nuxt for Next and perhaps Nest for Laravel would be a better comparison. Props to you for doing these great tutorials tho. 🎉
@aschmelyun
@aschmelyun 10 ай бұрын
A Nest (or even Adonis) and Laravel comparison would be interesting. Thanks for the feedback and appreciate the props!
@Rasetz
@Rasetz 10 ай бұрын
Laravel is so powerful, and gains power everyday ❤️
@stefanzweifel
@stefanzweifel 10 ай бұрын
Great stuff! This is exactly how I built my personal website. Laravel + Orbit + Export package. Haven't migrated to Folio yet, but it looks super easy to set up.
@aschmelyun
@aschmelyun 10 ай бұрын
It's definitely how I'm going to structure my personal site the next time I do a refactor. Everything just clicks together so well out of the box. Folio is a nice little QoL improvement and removes a ton of Route::view() calls, but not super necessary!
@amazekhashaa7309
@amazekhashaa7309 9 ай бұрын
Nextjs became cult man, I've tried to build an web then I felt deepest pain. Its changing continuously, not giving a hell of a break. I am on the way of searching new proper tool.
@Stoney_Eagle
@Stoney_Eagle 10 ай бұрын
This video is on par with a Jeffrey Way Laracasts course, see you there soon 😊
@aschmelyun
@aschmelyun 10 ай бұрын
Already there ;) laracasts.com/series/modern-javascript-basics
@HuyNguyen-ix4bl
@HuyNguyen-ix4bl 10 ай бұрын
Is Nuxtjs consider fullstack farmework like Nextjs i see Nuxt have the same sever side for API too ?
@aschmelyun
@aschmelyun 10 ай бұрын
Correct, Nuxtjs is a fullstack framework as well, but built on top of Vue.js like how Next is built on React. Both use Node under the hood though for stuff like SSR.
@RazvanTSibiu
@RazvanTSibiu 8 ай бұрын
Does someone used Laravel + InertiaJS + React? I watched some tutorials and they are like NextJS and seems to work much better. InertiaJS used for routing with params and all the stuff that makes the header part server side rendered. I migrated my react application to NextJS but it works pretty slow in development mode.
@aschmelyun
@aschmelyun 7 ай бұрын
I recently built an app with Laravel, Inertia.js, and React (pizza tracker), and I think it went pretty well! I'm not sure what you mean "slow in development mode", but with the stack above it uses Vite for compilation which is a super fast compiler and their hot reload is almost instant. The codebase I think is a bit more spread out than Next.js, but I think that the separations between Frontend and Backend code give a better development experience. Try it out with a small app and see what you think! You can use Laravel's Breeze starter kit which will give you a Laravel + Inertia + React app up in seconds, and you can see if it's fast enough for you. laravel.com/docs/10.x/starter-kits#laravel-breeze
@andresgutgon
@andresgutgon 10 ай бұрын
Hi, interesting video. One question. What happens with the volt component when the site is generated statically. How it works in production?
@holylandvideos9859
@holylandvideos9859 9 ай бұрын
its probably translates into javascript in client side
@TheKennyWorld
@TheKennyWorld 8 ай бұрын
Volt is Livewire. They use http requests to swap html portions.
@shubhamsahuSD
@shubhamsahuSD 9 ай бұрын
Livewire and Laravel anytime best choice 😊
@JavierRocha
@JavierRocha Ай бұрын
what code editor are you using?
@shubhamsahuSD
@shubhamsahuSD 9 ай бұрын
Laravel and livewire protect me for writing complex js and handle everything individually, but laravel and livewire made it easy
@pierbover
@pierbover 9 ай бұрын
can't orbit give you the filename for the key?
@aschmelyun
@aschmelyun 9 ай бұрын
That's what I thought, but for some reason it wasn't connecting the filename to the model ID... I'll have to revisit it more thoroughly again
@kwasiezor1630
@kwasiezor1630 5 ай бұрын
Nice video. It can very interesting if you can put all this together in a project. 😊
@marcinmaj3609
@marcinmaj3609 10 ай бұрын
I think that Laravel is a better solution, although it has ready-made tools such as Laravel Nova or Laravel Spark. Nextjs is faster etc but aren't the pros of Laravel better and stronger?
@mouchy123
@mouchy123 10 ай бұрын
Why would you want page based routing rather than explicit routing?
@teofannispapadopoulos4349
@teofannispapadopoulos4349 10 ай бұрын
Exactly my thoughts. It feels like a limitation rather than a feature .
@mouchy123
@mouchy123 10 ай бұрын
@@teofannispapadopoulos4349 cakephp and fuelphp used to have implicit routing and it was a nightmare to work with. And sticking database logic in blade files reminds me frameworkless PHP apps 15 years ago.
@aschmelyun
@aschmelyun 10 ай бұрын
I feel like for things like marketing pages (about, team, contact, etc) if you have a SaaS app, it kind of makes sense. The alternative is a lot of Route::view() calls on your routes/web.php file, which cuts out some of the fluff.
@QueeeeenZ
@QueeeeenZ Ай бұрын
I much prefer using a proper frontend framework like Next or Nuxt which are specifically made for the frontend and let Laravel take care of the backend which it is specifically made for.
@HaifengZhu-pn3uq
@HaifengZhu-pn3uq 9 ай бұрын
Which is more powerful, laravel or node.js?
@AmitErandole
@AmitErandole 9 ай бұрын
Laravel is a framework written in PHP. Node js is a server runtime written in JavaScript. So you can't compare them that way unless you are comparing Laravel with express or redwoodjs etc
@HaifengZhu-pn3uq
@HaifengZhu-pn3uq 9 ай бұрын
@@AmitErandole Thanks, which is more widely used in developing web app, PHP or Javascript
@victortimi
@victortimi 8 ай бұрын
JavaScript
@aristokles17
@aristokles17 3 ай бұрын
@@AmitErandolenode.js is a runtime written in c++
@AmitErandole
@AmitErandole 3 ай бұрын
@@aristokles17 yes. What is the relevance of internals in a question about use cases?
@Daaboo
@Daaboo 7 ай бұрын
Saw a different video from the channel codeForMe. He did a benchmark test Next vs Laravel and Laravel was much faster and better.
@stefangadjev1310
@stefangadjev1310 9 ай бұрын
The real question is can we use Next.js as an alternative to Laravel ;)
@shuvokhan3148
@shuvokhan3148 10 ай бұрын
Laravel is better solution
@lassestube
@lassestube 4 ай бұрын
Adonis is a nice node based contrast to Laravel. Next is like a new planet entirely, it lacks most things laravel has out of the box, and is janky to work with compared to Adonis.
@codedbyshoe
@codedbyshoe 10 ай бұрын
I might be the only one but I hate this. Why not just use Nuxt or Next which already have massive ecosystems.. Did Laravel just give up on trying to compete in the backend space? It seems like everything they have done the past few years is just to compete with JavaScript frameworks. But, in hindsight I guess competing with JS is easier than competing with something like GO..
@aschmelyun
@aschmelyun 10 ай бұрын
Laravel's been heavily aimed in the full-stack space for a while, but definitely over the last few years there's been more of a push to keep the frontend portion in the PHP space (with the transition from Vue to Livewire for instance).
@SXsoft99
@SXsoft99 9 ай бұрын
Laravel didn't give up, it just has all the features used already as an industry standard and more like InertiaJS, over this you need to optimize and inprove your normal PHP skils and add the new features from the latest releases JS frameworks in the past years have just been doing catching up in terms of already preset packages
@winstonmhango3437
@winstonmhango3437 9 ай бұрын
The problem is you need to be a php developer, then do laravel besides all these other things!...try to understand that Next.js is for developers with Javascript, React background. And it is simply a React framework, only that it now allows one to do both front-end and back-end without learning a back-end language, like php plus a framework like laravel!!
@SXsoft99
@SXsoft99 9 ай бұрын
yes and are they unable to learn new things? I started with PHP 7 years ago, by default you needed to also learn JS, HTML, CSS, MySQL, etc, now i am looking at GO and other languages the main difference is PHP, because of the frameworks and the community, comes with a lot of configs preset out of the box, meanwhile in JS you need to build a lot of things grown up
@victortimi
@victortimi 8 ай бұрын
@@SXsoft99that’s the problem Nextjs is trying to solve with the adoption of RSC
@agelosnm
@agelosnm 10 ай бұрын
No
@aschmelyun
@aschmelyun 10 ай бұрын
Fair enough!
@agelosnm
@agelosnm 10 ай бұрын
@@aschmelyunHahahahaha, I know!
@neverfever3725
@neverfever3725 Ай бұрын
Wtf do u know how easy Next set up is once u know React, and I thought that Lavarel doesn't use third parties libraries. I don't genuinely understand why anyone would substitute laravel instead of Next especially when u could just Express which shares the Node environment with Next. And I would rather learn the backend concepts instead of using a framework and its way easier to learn that in the Js ecosystem
@andrews4379
@andrews4379 10 ай бұрын
Waste of time
@aschmelyun
@aschmelyun 10 ай бұрын
True, I probably should be building the next AI app that's a wrapper for ChatGPT 🤷
@crhayes
@crhayes 6 ай бұрын
@@aschmelyun LOL. I'm sure someone would be willing to throw $$$ at you for it!
@cseale61
@cseale61 10 ай бұрын
Speaking as a PHP Programmer with 23 years of experience, I can tell you that Laravel is nothing but a bloated sh!t show. I have done work for several Fortune 500 Companies, the last three being Delta, Comcast, and currently AT&T. Delta and Comcast strongly discourage using Laravel, and AT&T downright forbids it simply because plain PHP is much cleaner and resource friendly way to go. I've seen Vue and Laravel being promoted for use together. I've never understood this. I love working with Vue and the logical server-side language for it is Node. PHP without a frameworks like Laravel is a much cleaner way to go if PHP is what you wish to use. I just don't understand how something as bloated and complex as Laravel ever gained popularity to begin with. Learn to code properly and you won't have to depend on backend frameworks.
@Icodestuff
@Icodestuff 10 ай бұрын
I can somewhat agree that Laravel has become bloated but you have to remember when you say "Learn to code properly" that developers are essentially going to be creating their own custom frameworks when using vanilla PHP. And if I am being honest, I feel it's much better to just use a standard framework like Laravel or Symfony instead of trying to learn someone's half baked custom framework.
@blessdarah1256
@blessdarah1256 10 ай бұрын
Please could you do a tutorial that shows people how to code 'properly' in a way that's scalable in PHP?
@gabrielranea
@gabrielranea 10 ай бұрын
Good luck maintaining a 'plain PHP' project with many developers working on it unless you adhere to strict patterns, like those Laravel provides out of the box. This doesn't even touch on features like migrations, middleware, queues, Eloquent, and many others. Without a robust framework, you'll likely find yourself constantly reinventing the wheel.
@teofannispapadopoulos4349
@teofannispapadopoulos4349 10 ай бұрын
The complete refusal to see & acknowledge the benefits of a framework such as laravel hints that you are either stubborn & narrow minded or that in your 23 years of experience, you had the privilege to avoid working on legacy php projects. Also there are “slimmer” versions of laravel if you are concerned about it being bloated Or you could always fork it,slim it down and fit to your needs (its open source ;)
@meetsomaiya5
@meetsomaiya5 10 ай бұрын
Amen to that. Couldn't agree much!
You don't need a frontend framework
15:45
Andrew Schmelyun
Рет қаралды 112 М.
Would I still use PHP in 2023?
9:51
Stefan Mischook
Рет қаралды 31 М.
HAPPY BIRTHDAY @mozabrick 🎉 #cat #funny
00:36
SOFIADELMONSTRO
Рет қаралды 16 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 33 МЛН
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 40 МЛН
The Story of Next.js
12:13
uidotdev
Рет қаралды 555 М.
Laravel First Impressions From A JavaScript Dev
21:08
adamdotdev
Рет қаралды 123 М.
A Response to  You don't need a frontend framework
30:59
wat the doodle!
Рет қаралды 3,2 М.
I DONT USE NEXT JS
54:01
ThePrimeTime
Рет қаралды 335 М.
When to use Traits, Interfaces, and Abstract Classes in PHP
15:08
Andrew Schmelyun
Рет қаралды 17 М.
Serverless PHP is pretty good
12:33
Andrew Schmelyun
Рет қаралды 6 М.
The Evolution of Web Apps 1992-2024
14:01
Dylan Beattie
Рет қаралды 22 М.
NextJS and Laravel Can Be Friends
23:54
Laravel
Рет қаралды 18 М.
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 1,6 МЛН
iPhone socket cleaning #Fixit
0:30
Tamar DB (mt)
Рет қаралды 14 МЛН
Самые крутые школьные гаджеты
0:49
Battery  low 🔋 🪫
0:10
dednahype
Рет қаралды 10 МЛН