https://www.mux.com/blog/php-is-the-new-javascript Skip to content Mux Logo Toggle Mux Brand Popover BlogBlog [ ] CopiedShareCopiedShare Back to Blog Home [ ] Sign upSign up Get a demoGet a demoLog inLog in Published on September 6, 2024 Look out, kids: PHP is the new JavaScript Dave Kiss By Dave Kiss * 9 min read * Engineering --------------------------------------------------------------------- I haven't taken a serious look at PHP in over a decade--and that's on me. Feels bad, given the current hype and traction. Especially because that's where my journey with coding all started. I'm the ambitious, starry-eyed dreamer that left my hometown.php in the dust for the big city lights and never looked back. But there's been a palpable shift in the air. You can sense it. People seem... excited about PHP. What happened? Well. Laravel happened (and has been happening). I've literally never touched Laravel. That changes today, here, now, in this blog post, raw, unwrapped before your very eyes. Will I become a fan? Will you? Unknown. Let's see what we uncover. But first... we have to address the obvious. How PHP soured thousands of developers I've met so, so many developers who earned their wings by writing a procedural, top-to-bottom home.php and hucking it up to DreamHost via FTP. It was PHP's learning curve--or better yet, lack of a learning curve--that made it so dang easy to get started feeling like a magical internet hax0r: home.php CopiedCopyCopiedCopy However, it was this same swiss army knife approach that ultimately handed it a bad rap. This sort of no-guardrails code drilled the idea that PHP was never going to be a viable choice for scaling apps of the future into the heads of thousands of devs who, just like me, have never checked back in.^1 Poor design decisions, regrettable function names, global variables... oh my. It's not that there weren't any conventions or frameworks. It's just... to me, even those weren't so hot (CodeIgniter? Symfony? Kohana? W...Wo...WordPress? shudders). The truth is, I only learned PHP (and honestly, to write code at all) because I had no other option. I never even wanted to be a programmer . I yearned for a personal website with more functionality and pizazz than your run-of-the-mill index.html but, back in 2007, the only collateral you'd find in my college pockets were suspiciously-dirt-cheap Lionshead bottle caps with rebus puzzles printed on the underside. I had no cash to pay a "real" developer, so... down the rabbit hole I went. And in that hole I stayed. In that deep, dark hole. Where I also befriended jQuery, Subversion, and Bootstrap. And lots of lost laundry socks. NodeJS and the decade of JavaScript I'm fast-forwarding a bit for brevity, but it wasn't too much later that a chap named Ryan Dahl introduced a way to execute JavaScript code outside a web browser. What a moment that was. You mean to tell me that I can write JavaScript everywhere? That my whole stack would forever be at peace, hugging, shaking hands, laughing over a fine dinner, seamlessly handing off front-end interactivity to backend logic in a blissful state of being? The minds of developers everywhere activated all at once, racing with possibility. We braced for impact and endured a furious flurry. Ember. Express. Backbone. Koa. Meteor. Knockout. Knockback. Rivets. AngularJS. The... other Angular. Oh, gosh. The wars had begun. And I'd cried more tears and curled up in bed longer than ever. Was this the actual bottom of the dark hole? Would I ever want to code again? How do we recover from this?^2 Almost on cue, I heard about React from a guy named Wes. Fatigued, with cold sweats, I bought his course, begrudgingly subscribing to learn yet another JS tool. Unexpectedly, the clouds parted. I could tell: at least for me, the storm was over. It's okay, Dave. Open your eyes. You can climb out of that hole. It's all gonna be okay. I wasn't the only one who felt that way. There were frameworks to be built. We were entering the next era. Guillermo Rauch Guillermo Rauch @rauchg *Follow React is such a good idea that we will spend the rest of the decade continuing to explore its implications and applications. 10:14 AM * Nov 22, 2016 963 Reply Copy link Read 21 replies A little project named Laravel All the while, some kid named Taylor Otwell had been happily chipping away at a more advanced alternative to CodeIgniter. He published the first Laravel beta release all the way back in June of 2011. How'd I miss that? Where was I? Even more, where was he? I don't know Taylor, but how he managed to escape unscathed from the Great Unrest(tm) of the JavaScript ecosystem completely blows my mind.^3 My understanding of Laravel is even more cursory. But still, even as an uninformed outsider, I am vaguely aware that one of Laravel's top selling points is the first-class support for what feels like everything that you'd ever possibly want to implement in a web application. Need to manage Stripe subscriptions? Cashier can help with that. Want feature flags? Sure, there's Pennant. There's even a supported package for social authentication called Socialite. A list of the apps within the Laravel ecosystem These aren't community contributions, mind you. These are supported by the same folks that built the core Laravel framework. Okay, that's pretty sweet. There's what sticking to the same tech for 13+ years will do for ya. +1 internet point to Laravel. +1 internet point to... PHP? What year is it? Here's what makes Laravel so great Just kidding, I don't actually know the answer to that yet. We're going in cold. Let's build something live. Now. A screenshot of the hero image from laravel.com I visit the Laravel website, click the creamy orange Get Started button as fast as humanly possible, and jump straight towards the Installation docs. Instructions for creating a Laravel project I see me! I'm on macOS. Gimme Laravel Herd, whatever that is. Immediate download, install, open. Didn't check for package validity or anything. Don't tell our security team. A screenshot of Laravel Herd Oh nice. No CLI here. I'm great at clicking buttons. Choose a template for your new site Using no starter kit Setting the project name and configuration The world's newest bootstrapped Laravel site Bam! A Laravel project initiated without typing a single keystroke. I haven't really had to use my brain at all yet. I don't know about you, but that's a good day. I open up the scaffolded code and give it a look-see. A scaffolded Laravel project opened in the Cursor IDE Some minimal clicking around gives me the lay of the land. Routes are defined in... well, /routes. The default route loads up a view called welcome. I'll be honest, I wasn't expecting to look in the /resources directory for a view, but I suppose it's not too unusual. A look at welcome.blade.php There we go, some HTML. I'm ready to take this app by the horns. cracks knuckles Wait a sec. I write blog posts these days, not production code (we'll leave that up to the rest of the experts here at Mux). Not to worry. That's what AI IDEs like Cursor are for. Let's fake it til we make it. Coding with Cursor AI I know nothing about Laravel. Zero. Can you please remove all content and edit this page to show a demo video using Mux Player? You can find out how to do that with some example code on the Mux Documentation. @https://docs.mux.com/guides/play-your-videos Me, to Cursor I copy-pasta Cursor's AI-generated response into the welcome.blade.php The Cursor HTML output, rendered within the browser Holy moly, it actually worked. There's my video. Right there in Mux Player. It plays back flawlessly. It looks good. It's correctly centered within a div. How? How? resources/views/welcome.blade.php CopiedCopyCopiedCopy