acrolink

acrolink

Phoenix vs. Laravel

Any experiences on the topic? Anyone ditched Laravel in favor of Phoenix/Elixir?

Most Liked

carterbryden

carterbryden

I was primarily building stuff with laravel before moving to Phoenix several years ago. I’m not very hands-on up to date with laravel since about v5 but I still keep an eye on things. I

originally looked elsewhere because I was doing a fair bit of real-time/websocket stuff and I always had to reach outside of PHP and laravel to do that anyways. And I was interested in the mental model of functional programming - or at least the very basics of it - as compared to OOP. Functional just felt so much more direct and easier for me to reason about, personally.

My general thoughts on Phoenix vs Laravel, in no particular order:

  • Laravel has an incredible suite of features and products to go along with the base, all of which are remarkably cohesive with unusually high attention paid to detail and devx. That’s very hard for any language or framework that I’ve come across to beat.
  • PHP has made a lot of improvements over time and is quite a pleasant language to deal with these days, despite age old memes.
  • Fundamentally, at the lower and middle levels of abstraction, I think Elixir is a better language in most ways. Not because PHP is bad, but because Elixir/Erlang are just an incredible confluence of CS ideas that work very well together, have been steadily refined for decades, and make some really hard things very easy. Things that are increasingly becoming more important over time, like concurrency, distributed computing, reliability guarantees (maybe not literally, but practically) etc.
  • Elixir and Phoenix’s feature set for real-time is much, much better in my opinion.
  • The building blocks for things like caching, background processing, and many more are much better in Elixir and Phoenix. Laravel’s packaged solutions for these are still better out of the box because of the care and effort put into them, but I think we are close on many of those and it’s just generally a lot easier for us to build them.
  • The biggest difference I notice between laravel and Phoenix on a daily basis is that it’s sometimes easier to get the common app stuff up and running more quickly on Laravel (CRUD, auth, integrations) but not way easier. And when I need to dig deep on stuff, I personally find Elixir and Phoenix to be more powerful and flexible, in a way that’s very easy for a solo dev to build them.
  • It’s a pretty close comparison in my head, which says a lot about the high quality of Laravel, because I feel pretty strongly about how amazing Elixir and Phoenix are.
14
Post #4
w0rd-driven

w0rd-driven

I haven’t ditched Laravel but I have heavy investments in both camps. Phoenix isn’t really 1:1, it’s closer to a Sinatra where something like Rails has more overlap with Laravel. You get different primitives with the BEAM where you don’t need to reach for something like Redis since ETS is right there. Oban is arguably a better queue processor than what Laravel gives you but Laravel also gives you Horizon. You can work out some intricate workflows in either system. It may be user error but I don’t have a clear look at what jobs are actively running in Horizon where I have more tools to monitor Oban. I haven’t tried recreating my most difficult workflows from Laravel to know how those pain points measure up.

You can piece together a few dependencies to get you close experiences I’d imagine. There is also a difference in underlying behavior.

Dependencies are a liability in any system but in Laravel I’m more of a conductor, gluing fairly robust packages together to rapidly focus on the business need. I’ve maybe “chosen poorly” for a problematic package very few times since starting with it in 2017. With Elixir it’s generally easy to spin up an API client on top of Req as opposed to finding a poorly maintained SDK, with the exception of Stripe and Spotify so far. There is no Spatie equivalent dropping a ton of high quality in one place but there is some very high quality in the ecosystem.

Laravel is also a layer higher or tends to stay there. I believe it started by pulling a lot from Symfony to slowly get replaced by Illuminate APIs. Phoenix acts as a thin layer on Plug on purpose. There are parts of something like Ash that is also appealing from a reduction of boilerplate perspective.

This is all over the place like my experience so far. I haven’t rebuilt major systems to have the biggest sample size but given enough time and energy there isn’t anything I’ve missed in a major way. I am looking to see if something like Jetstream can be ported because scaffolding an application shell takes a lot of boilerplate that I get really tired of doing as often as it requires. 1.7 and core components are a great start but I need a bit less friction.

RudManusachi

RudManusachi

I don’t disagree, but to be fair, I’d compare bare bone Plug more to Sinatra.. whereas when people refer to Phoenix most of the time they mean Phoenix + PhoenixHTML + Phoenix.LiveView + Phoenix.PubSub + Swoosh + Ecto + … on Elixir

Which, I think includes enough batteries to be on par with a regular PHP Laravel / Ruby on Rails project.

Where Next?

Popular in Discussions Top

scouten
I’m looking for a host for the server part of a small (personal) side project that I’m working on. It’s currently written in Node.js and ...
New
sashaafm
I’m trying to evaluate the best combo/stack for a BEAM Web app. Right now I’m exploring Yaws a bit, after having dealt with Phoenix for a...
New
andre1sk
A big advantage to Elixir is all the distributed goodness but for many applications running on multiple nodes having integrated Etcd, Zoo...
New
vans163
So useless benchmarks aside, Its possible to write a webserver that can serve 300k requests per second (perhaps more with optimizations)....
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
lucaong
Hello Elixir and Nerves community, I have been working for a while on an open-source embedded key-value database for Elixir, that I call...
230 13924 124
New
tomekowal
Hey guys! I want to create a toy project that shows a chart of temperature over time and updates every 5 seconds. I feel LiveView is per...
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New

Other popular topics Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53690 245
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 47930 226
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

We're in Beta

About us Mission Statement