YouTubevideo· Sep 27, 2024· 16:18· 29K views on YouTube

Is PHP the new JavaScript?

Watch on YouTube ↗
0:00

React at a moment you like. The best moments light up here.

transcript

38 moments
  1. Speaker: I consider myself pretty lucky because I didn't start programming in PHP until about two years ago when PHP is actually pretty popular. Pretty good. I started programming PHP when I started programming in Laravel. So I don't have those yucky feelings that you have when you hear the words PHP and think, yeah, 15 years ago I used this programming language called PHP and it was not good. In fact, I've always said that I know JavaScript better than I know PHP.

  2. I know Laravel better than I know PHP, but is PHP the new JavaScript. Today we're reading a relatively new article from the Mucks team. Dave Kiss, lookout Kids. PHP is the new JavaScript. We're just 20 days ago, September 6th, 2024. You can find Dave at Dave Kiss on Twitter slash. x@davekiss.com.

  3. Dave KISS is on the mucks team developer community person who wrote this Senior community engineering lead at mucks. This is Lookout Kids. PHP is the new JavaScript. 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.

  4. But then 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.

  5. I've met so, so many developers who earned their wings by writing a procedural top to bottom home. php and hooking 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 hacksaw. However, it was the same Swiss Army Knife approach that ultimately handed it a bad rap.

  6. 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. 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, Wordpress, Shutters.

  7. 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 pizzazz 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 lion's head 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.

  8. And in that hole I stayed, in that deep, dark hole, where I also befriended Bootstrap. And lots of lost laundry socks. No JS in 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?

  9. My whole stack would forever be at peace, hugging, shaking hands, laughing over a fine dinner, seamlessly handing off front end interactivity to back end 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 cried more tears and curled up in bed longer than ever.

  10. Was this the actual bottom of the dark hole? Would I ever want to code again? How do we recover from this? 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.

  11. A little project named Laravel. All the while, some kid named Taylor Otwell had been happily chipping away at a more advanced alternative to Coding Nighter. He published the first Laravel beta, released 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 of the JavaScript ecosystem completely blows my mind. My understanding of Laravel is even more cursory.

  12. 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. 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.

  13. That's what sticking to the same tech for 13 plus years will do for you. Plus one interpr Plus one internet point to Laravel, plus one internet point to PHP? What year is it? Here's what Laravel makes for you. 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. I visit the Laravel website, click the creamy orange get started button as fast as humanly possible and jump straight towards the installation docs.

  14. Creating a Laravel project. I see me. I'm on macOS. Give me Laravel herd, whatever that is. Immediate download, install, open. Didn't check for package validity or anything. Don't tell our security team. Oh, nice. No CLI here. I'm great at clicking buttons. 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. Some minimal clicking around gives me the lay of the land.

  15. Routes are defined in well slash 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. There we go. Some HTML. I'm ready to take this app by the horns, cracks, and knuckles. Wait a second. 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 till we make it. Me to Cursor. I know nothing about Laravel. Zero.

  16. Can you please remove all content and edit this page to show a demo video using MuxPlayer? You can find out how to do that with some example code on the Mux documentation. So I copypasta Cursor's AI generated response into the welcome. blade. php. Holy moly, it actually worked. There's my video. Right there in MuxPlayer. It plays back flawlessly. It looks good. It's correctly centered within a div. How? That's not going to cut it though. I need some dynamic routing. This new Laravel app is that start of something huge.

  17. You'll need to load up thousands of UGC videos, each having their own playback ID. It's the future. The next big thing. I rewrite my next prompt. I love your can do attitude, cursor. Make me look good. Here's what it's suggesting we do. First, we should create a new view file called video. blade. php in the resources views directory. Okay. It looks basically the same, except we have a mustache like handlebar dollar sign variable in place of where the playback ID once was. Dollar sign. I've missed you.

  18. Next, we create a simple controller at app. htp controllers, video controller. php. This part took me back to my aimless Chicago afternoon spent noodling in rails. I reminisce, dancing fondly through my historic abuse of var dump and binding. py. It's all coming back to me now. That was then, Laravel is now. Finally we're to create a new route in routes slash web dot php. Two lines of code. What do we think? Is it going to work?

  19. I move the playback ID up into the URL, visit, no idea what I'm doing, dot test slash video slash ID, cross my fingers and toes and hit refresh. Boom. LFG Laravel, a dynamic video page built in just a few minutes. So it's looking like the route definition allocated the playback ID variable to whatever URL path at that location and handed it off to the controller. Then the controller took the baton and propagated it down to the view. MVC never felt so right.

  20. I probably should double check another playback ID just to be safe. I changed the URL. Sure enough, my dynamic video playback app powered by mux has ready for the masses. What is this feeling? I have to say that was easy. Too easy. Nice separation of concerns, valid code generated by the AI underlords, big, bright, beautiful orange buttons. I'm starting to feel a bit funny inside. What have I been doing all this time? I click around the directory structure a bit more. Does this come with the database too? An auth?

  21. Mail? Queue management? Sessions? Testing? How is this possible? How does it come with everything? Is fast as heck video transcoding, battle tested delivery at scale, and quality of playback experience monitoring up next? Are we as a company doomed? Who are you really, Taylor Atwell, sir? And how did you get that Lambo? Okay. One more improvement. Just one more, and we'll call this little experiment finished. I want this video playback page to be the best anyone has ever seen. Beautifully designed, expertly crafted.

  22. We don't need new tooling or extra JavaScript or excessive mentions of used client. Nope. Not here. This is Laravel, baby. I'm a believer. Whip it up. Do your thing. Make this page shine with some incredible CSS. And don't forget to use Laravel's signature creamy orange color. You might even want to give Laravel a warm shout out and big bold text at the top of the page. Bye. Now that's a video player. PHP is dead. Long live PHP. Am I a convert? A newly minted PHP web artisan? You bet your bottom dollar I am.

  23. Depending on how critical you are of my AI coding approach, you might argue that I've still literally never touched a Laravel application. But I'll tell you what, Laravel makes PHP fun again. I'm here for it. Maybe you should be too. It's been almost two years since I wrote my first Laravel application.

  24. And yes, while that has not been that long of a time, especially knowing that some people have been programming Laravel and building Laravel applications for close to 10 years now, if not more. There's still a lot that I forget you have to know or learn coming into a full stack framework, batteries included framework, like Laravel.

  25. In fact, especially if you're coming from a front end focused approach, a JavaScript only approach, a lot of the things that excite us folks who came from that JavaScript world are things like Dave kind of talks about in the video. In this article, you'll notice that he doesn't really dive into, uh, in fact, it's, it's, it's still, it's really interesting to me how people come across or learn certain things.

  26. I know one of the things that I myself am passionate about within the Laravel team, as well as there's others in the Laravel team, Taylor himself included is what is that first approach look like when you come into Laravel? I think things like herd make it a lot easier. Easier, especially for folks who are coming from a different community, like JavaScript, who just want to get something up and running as quickly as possible without having to muck around with PHP installs or making sure composer is set up.

  27. And then you have, you know, downloading a MySQL database or anything like that within herd most of the time, especially with the newer versions of Laravel. You just get a SQLite database out of the box. And then Hurd just gives you everything for local development. And then you're just kind of off to the races. Good to go. One of the things that really, uh, interested me that Dave didn't touch on it because it looks like he did not use Laravel Breeze to authenticate his first template.

  28. It was just the Laravel original preset is that there was no authentication scaffolding out of the box. So this is all being excitable for Dave without having some of the things that I personally think is exciting from someone coming from the front end world, having authentication out of the box, having everything kind of in one piece and cohesive.

  29. And they kind of mentioned that throughout the article of, Hey, like this has cues and background jobs and emails and, and authentication, you know, it has all of this in one piece. ecosystem in one package, in one place to be able to install and be off to the races.

  30. But it also is really exciting that it's stuff like this, that you would think wouldn't be that tough in the sense of, I want to take an ID and pass it on to my controller to make sure that I'm playing a particular video. Yes. Something like that might be fairly XJS, for example, but at the same time. There's a lot that you have to take into control in the sense of, uh, you're having to think of, okay, am I doing this on the client or am I doing this on the server?

  31. Am I using the app router or just pages router? There's so much things that while it is still incredibly easy, it changes frequently, even within these JavaScript ecosystems. So I think one of the things that Dave is kind of getting across in this blog is yes, while he's only touching the surface of, okay, we're changing up the page and we're passing identifiers and using those as props within the page, there's still so much that makes it.

  32. Easy in that whole process from, having all of that set up to just things to be ready to be scaled. And I think that's the whole purpose of why I've enjoyed being a part of Laravel and building things in Laravel. It's one of those things that, okay, yes, I can.

  33. be excited and fascinated with little things like off or being able to, have all that connected to a database and show my username without having to write a single line of code on the page. But it's also because it gives me those next steps as well, where he's writing this video player. But if you wanted to do it, where he.

  34. You know, you could have, uh, users create their own videos and have those IDs be accessible and shown in one page, like within the database, all of that can be done without having to add another single package. To your application. But the part that gets me most excited about this blog post, particularly, and then also just people's mindset around PHP and Laravel is this last sentence, but I'll tell you what, Laravel makes PHP fun again. I'm here for it. Maybe you should be too.

  35. I have never had as much fun building things. From start from scratch, things on the front end, things in the back end, things like emails and cues and background jobs. I never really had that much fun learning and building things until I started building in Laravel. I think it's because I don't have to worry about making sure it all works. I know it works. People have done it before me and across many different fields and mediums and verticals.

  36. I just need to figure out how it works for my particular application, my particular use case. If I was in the JavaScript ecosystem still, I know that people have done it. There's a lot of people who have done smart things like that within it. But now I have to be concerned about, okay, is this possible within this particular package, within this particular meta framework, within this particular, uh, you know, front end style of tooling. Yes. It probably could work. That's going to take a little bit more tinkering and it gets takes away the fun a little bit knowing that it can work.

  37. I just have to do a couple of things to make it work within Laravel. Everything works. You just have to learn how it's going to work for you. So thanks so much Dave for letting me read the article. Keep building everyone.

  38. Keep creating.

just you here