NativePHP for Mobile With Shane Rosenthal and Simon Hamp

NativePHP for Mobile With Shane Rosenthal and Simon Hamp

Jul 08, 2025

In this episode, we talk with Shane Rosenthal and Simon Hamp about NativePHP for Mobile and how it allows you to deploy Laravel application to mobile devices and use the native features like push notifications in PHP. Links: NativePHP - https://nativephp.com/ HoneyBadger.io - https://HoneyBadger.io Our Discord - https://discord.gg/aMTxunVx Shane's Social Media: Twitter - https://x.com/ShaneDRosenthal Simon's Social Media: Twitter - https://x.com/simonhamp Scott's Social Media: Bluesky - https://bsky.app/profile/scottkeckwarren.bsky.social LinkedIn - https://www.linkedin.com/in/scott-keck-warren-91689810/ Mastodon - https://phpc.social/@scottkeckwarrenIn this video, Scott

Transcript

Scott Keck-Warren Scott Keck-Warren 0:05
Hello developers, and welcome to the PHP Architect Community Corner, where we have conversations with members of the web development community. I'm your host, Scott Keck Warren, and today we're talking with Shane and Simon about native PHP for mobile. Shane Rosenthal is an entrepreneur, full-time Laravel dev since 2013, and is making a difference. He also flies airplanes for fun. Simon Hamp is a longtime PHP and Laravel developer and co-creator of NativePHP and a big lover of pizza. Thank you both for finding some time to talk to us today.
B
Speaker B 0:33
Yeah, my pleasure. Happy to be here. How you doing?
Scott Keck-Warren Scott Keck-Warren 0:37
Absolutely. So you guys have kind of come under my radar because you both are working on NativePHP for mobile. Can you tell our listeners a little bit about what it is that PHP Native for mobile is?
B
Speaker B 0:48
So NativePHP for mobile, well, it's kind of There's an origin story there, but in a nutshell, it allows right now specifically Laravel developers to be able to use the same language framework and skillset they've got to build Laravel apps, but with a different command, they can now build mobile apps on iOS and on Android as well.
Scott Keck-Warren Scott Keck-Warren 1:16
Okay, cool. And so the idea is basically like we, you like package kind of like your Laravel, your PHP code into, into like a normal, like APK or whatever it is that iOS calls it, and then just kind of ship it through the normal delivery mechanisms? Or is there something special that they have to do to get it onto people's phones?
B
Speaker B 1:34
No, I think that was kind of the challenges that we faced. And really the whole mindset of the project moving forward was, let's make this as easy as possible for people. And that's still kind of our mantra. Essentially, no, there's nothing different or special. I would say out of the ordinary except for using the package we created and the PHP binaries that we ship and really just running our commands for the package that we created. Outside of that, it's going to be just as painful as building any mobile app, I guess. For now, for now, we are aiming to simplify that.
Scott Keck-Warren Scott Keck-Warren 2:14
Okay. So I guess that's a good question then. Because I've worked with PhoneGap before and Cordova. And so they have a local version where you can kind of run it locally and see how it works just on your desktop before shipping it off to a mobile device. Is that capability there or is it still you have to build the whole thing and ship it off to the device?
C
Speaker C 2:35
Because we are using PHP still on the device and we built it in such a way that it should work without even being on the device. You can run your PHP application exactly the same on whatever development environment you've got set up. So I like to use Laravel Herd now. I'm a big fan of that because it was nice and easy to set up and keep lots of different versions of PHP running at the same time. And I've got different projects at different stages of death, and so I've got lots of different versions of PHP running. And I like to dev in the web environment. I like being able to just write some code in my editor, I use PhpStorm, and then just flip over to the browser and hit Command+R and now it's working the way that I've just written that code to work. I haven't had to wait for anything. And you can still build the majority of your application, even a mobile application that way. And then it's only when you really need to touch those native features, so that we've got a handful at the moment and there's more on the way. When you want to tap into those, then it needs to be running on the device. But we've made it so that it's safe for you to run it locally. It's not going to crash out or fall over when you're trying to do something just in local development that does try and tap into those native features. It's all kind of nice and wrapped up in a little bow to make it easy for the typical development workflow that you're used to.
Scott Keck-Warren Scott Keck-Warren 4:16
Yeah, that's really good to hear. Because I've worked in native native, where just writing C, and the lead times on that is just atrocious. It's just so painful to have to manage rebuilding from source code every time. So that's really good to hear. So you have mentioned that there's some native functionality, like NFCs and the flashlight app, I think, is one of the— or the flashlight is one of the pieces. Like, what is it that— like, how is it that you are all interacting with those pieces? Is that something that we can interact with through our PHP code, or do we have to do something crazy to get to that?
B
Speaker B 4:52
That was actually really exciting to start working on. Basically, in a nutshell, we have compiled PHP individually. So I'm the Android guy. Though I have an iPhone as a daily driver now, but I'm the Android guy and Simon's the iOS guy. We both have compiled PHP for our respective environments, and that was a hurdle in and of itself. Essentially how the native functionalities work for the Android side, and I'm pretty sure it's very similar either way, we have our own native PHP extension. They are different extensions. The code is different just because the way that PHP is working on the different environments. It had to be, they had to be different. But we've created functions inside of our own extension that essentially when you call it from your PHP code, it passes that through into the device. And then we are able to call Swift or Kotlin code natively, we'll use that word, natively on the device. And then we can like listen for events to be fired. So if there's any sort of like camera taking a picture, it can send us back the path of that file and, and we can listen for that in our, in our Laravel code on the, on the front end. I'll call it the front end, but you know, our PHP side. Yeah.
Scott Keck-Warren Scott Keck-Warren 6:12
It's, it's kind of like how that we have like some, some of the PHP functions are like just wrappers for like basic C calls. Right. And so that's kind of like the same thing here, right? There's, there's, you have written like a, like a PHP intro into like a C library or a Kotlin library and that, that's, that's the interaction. So it's basically like, I just call a function and it does it does the native piece. Is that correct?
B
Speaker B 6:35
That's, yeah, in a nutshell.
C
Speaker C 6:39
I think the little bits of complexity that come from this is dealing with the fact that PHP is essentially stateless. The shared-nothing model of PHP's execution, which I think is really great, and I've loved working with it for such a long time, makes building web applications nice and easy. But when you're in this environment with a long-lived application and their expectations are that what you had in memory is still in memory and all of this kind of thing, then it does present some challenges. But we've managed to work out a way that kind of makes it operate like you're still operating in a server-client stateless environment. And it's very akin to webhooks, actually. If you've ever used webhooks, anything like Reverb or Pusher, you're kind of dealing with these events that are happening asynchronously. And so from your PHP application side, you kind of can just do stuff and forget about it, and that request can finish and all that memory can be freed up. And then another request will happen, which is the kind of closing the loop of, let's say it's the camera, like Shane said, the photo has been taken or a video has been taken or whatever. And then it's kind of notifying your application that something has happened, which is a really familiar pattern, I think, for web developers. And so it feels really right at home building applications this way if you're coming from a web background, which is, I think it's quite nice.
Scott Keck-Warren Scott Keck-Warren 8:23
I'm in awe of it, right? Like it's, it seems like it, I don't feel like it's in any way an easy problem to solve. It seems like it's very much a hard problem. And so I guess like I misunderstood like the, so is it the, like, so the PHP process like spins up, it handles like whatever request it is and then it spins back down like for every, like every button press and things like that? Oh, that's really cool. I just assumed that it was like running there in the background, just like chewing up memory. And, but that's really cool if it spins up and spins down.
B
Speaker B 8:50
I would say we could have done that, but that proposes a lot of inherent issues. Um, you're going to burn battery, you're going to overload CPU, you're going to overheat the phone, you're going to notice it. And app stores probably wouldn't like that very much also. So we deliberately avoided that. And it was a, it was, um, it was a longer road. It was a longer path to get to where we were at. Um, but we knew, and that's kind of how we are approaching most things now anyway, let's take the extra time to do it properly. That way, um, you know, if there's some underlying— if iOS changes the way that, you know, a flashlight is handled altogether, then maybe we have to refactor some stuff. But outside of that, let's try to, you know, make this, uh, let's try to cover as many edge cases as possible, I would say.
Scott Keck-Warren Scott Keck-Warren 9:37
Yeah, that's really fascinating. So, so is it, is it essentially like Because a WebView is one of the basic components that exist in native development. So is it like a WebView that then is calling back into something else? Is that kind of how it functions as a piece?
C
Speaker C 9:55
Yeah, basically right. So just to give a little bit of color to that, when you think about building an application with PHP, I mean, you expect there to be a WebView somewhere, right? Generally speaking, you're going to be building some HTML interface to this application, and you're sending HTML over the wire so that you can— that's your actual user interface, right? And we're just taking that same paradigm and just condensing it. There's no network involved, basically. That's it. Just remove the network from the equation, and you've got the frontend and the backend in the same place. And so then it's nice and fast and all of the interactions are really snappy. There's some improvements I think we could do to make PHP even faster, but PHP is really fast now anyway. And then, yeah, one of the things that we've really benefited from because we've got the web view is you can now use all of the stuff that you already know about building web applications and translate that to a mobile application. And so you get all of this functionality for free, all of this JavaScript performance and rendering and use of this element and that element, that library, JavaScript library, Tailwind. Exactly. Whatever it is that you want to use. I haven't heard of any yet, but I'm pretty sure it's possible for somebody to do just like a jQuery application using PHP and jQuery. You're like, what? Yeah. And I think that's kind of unheard of even within the kind of modern space of building mobile applications, even with anything adjacent to web technologies, because they always favor these JavaScript frameworks that you compile. There's some compilation step and there's a bunch of components that get injected in from the library or tool that you're using to enable the mobile features. Um, and this isn't, this is just web and then a sprinkling of PHP and you get like native functionality. And it's like, for me, it feels super accessible, which I really like.
Scott Keck-Warren Scott Keck-Warren 12:10
Switching tech, like topics for a little bit. So like, let's say like, I'm, so I'm, I'm interested in like trying this out and like, what would, and what would somebody else need to do to like get from zero to having something in the App Store essentially? Like how much, how much effort is involved in that?
B
Speaker B 12:25
Loads. No. Yeah, it's actually quite simple. You can go to nativephp.com/mobile or just go to the homepage. It'll get you there. You need a license. This is not a free application. It's taken us a long time to get it together. And currently I'm like full stop on it. So it really does take a steady hand to watch everything or several steady hands to watch everything to make sure we're building this out properly and really supporting the people that have already invested in us. You get, you get a license, you follow the docs to just get things installed. I will say that getting your environment set up for iOS or Android is no small feat, regardless of, you know, with or without NativePHP. Our docs do an okay job at supporting that, however, as much as we can, just because, you know, it's kind of out of our hands, like Android. Studio is, you know, that's— they've got docs on how to do everything on their side anyway. Nonetheless, to go from A to B, or from knowing nothing to an app in the App Store, you do the Composer install or the Composer install the package, you run a couple commands that are all in our docs. And you can have a Laravel 12 app, I think, I mean, you know, you could do it in a couple hours, I would say, or even less than that with— if there's no functionality on the app itself, it's just a Laravel 12 login page or something, then I'd say yeah. If your environment's set up, you can have it on the App Store barring the approval of the App Store, which is— and honestly, no one's been rejected that I've seen. We've seen several apps go out to the app stores. None of them are rejected for the way that we're putting things together because at the end of the day, it is just a C library that we're using just like any other app can do for the App Store. So there's no anything stopping approval from what we've done. You might have some issues just because your app looks like somebody else's or behaves too similarly or just has some issues in the app itself. But no, I mean, we're, we're, we've got the kitchen sink app. I think once, once our account was approved, I had it up and going within just a couple hours.
Scott Keck-Warren Scott Keck-Warren 14:46
Okay, so it's fairly simple if you're, you already kind of have like the basics in line essentially. That's really cool. And I've used— so at work we have Cordova, we're using Cordova for our app. And it's the same kind of thing, right? It's like a WebView that has a backend worker. So it seems like you guys aren't going to have any trouble with that at all. So what is the timeline for this? Is this something that I could use in production and get support for it? Or is that still a little bit ways down the line?
C
Speaker C 15:16
We targeted getting this out as quickly as possible. I mean, I launched the iOS version back in February, and that was really like, this is ready. I've put an app on the store, Apple have approved it, let's go. But it was only iOS. And then in the background, Shane has been working on this thing secretly. Actually, that's a good story, but maybe we don't have time for that today. He'd been working secretly on Android, and he came to me and said, hey, look, I've made Android work. And I was like, Oh my God, this is amazing. And so what I thought was going to take much longer, we managed to launch at the beginning of May with both iOS and Android at the same time, and we kind of called that V1. So yeah, I mean, it's like feature parity between the two, and we're really happy with where it's at. And we've obviously got loads of stuff we want to do, but it's ready right now, and people are releasing apps with it today.
Scott Keck-Warren Scott Keck-Warren 16:21
So. Yeah. And I was looking through like all the supported, like native functionality and like I could build an app with it without trouble. Right. Cause like the big one I think is like push notifications and like, cause that's what everybody wants to have in their app. And like, really that's the limiting factor for us as a team is we have to have push notifications. So I'm really curious to kind of go out and try it. And we'll be right back with this word from our sponsors. Now I don't need to tell you that production monitoring can be complicated. There are tons of tools and techniques, but you just want to know that your app is up and your users are happy. When your customers encounter a problem, you need clear, actionable intelligence, not walls of charts and reams of logs. That's why they built Honey Badger, the monitoring tool you've always wanted. A tool that's there when you need it and gets out of your way when you don't. With Honey Badger, you'll know when critical errors occur and which customers are affected. Respond instantly when your systems go down, improve the health of your systems over time, and fix problems before your customers can even find them. Honey Badger is the application health monitoring tool built for you, the developer who cares about a quality product and happy customers. Start monitoring today at honeybadger.io. It's free to get started and the setup takes less than 5 minutes. Once again, that's honeybadger.io. And we're back with Shane and Simon about Native PHP for mobile. Um, so what, what would happen, like, so like right now there's, there's like a yearly license fee and like what happens, like if I put the app out there and I stopped paying, um, does like the app stop working like, or, or like in the app store or does it just prevent me from rebuilding it at
B
Speaker B 17:44
Yep, your app completely stops, all of your users, their phones actually just dissolve in their pocket now. No, so if you put an app out and say everything that your app is going to ever do is satisfied with the package as it currently is, stop paying. I mean, there's not even a reason to. If you are continuing to pay, what you're getting is the— you're getting all of the updates for any of the libraries that we add in the future. So like right now we don't have location. That's something we're working on right now. Uh, if your app right now doesn't need location and a year from now it doesn't need location, you're fine. But if you want to add support for that later and you stop paying and now we've released it, then you'd have to, you know, upgrade. Yeah.
Scott Keck-Warren Scott Keck-Warren 18:31
Yeah. Because, and I wouldn't— I'm not a not-pay person. It would just be basically like, you know, if one of my clients didn't want to pay for it or something like that, like if, you know, I could— I can understand where somebody's like, we don't need to pay for this every year. Um, so I just want to make sure that wasn't going to be like a deal breaker for anybody.
C
Speaker C 18:47
The way we're looking at it is like you buy the license and the license is for life, and that also covers the first year of updates. And then every year after that, you're just paying for the updates, basically. And we did an early access program which kind of was heavily discounted. So quite a few people got in on that, which was good. And Yeah, I mean, we'll have other things as well. We've got some big plans in the future to make it even more accessible for folks. But yeah, this isn't about getting money out of the community or anything. We want to just build a sustainable business around the tool so that the tool can thrive. And this is the way that we're doing that at the moment.
Scott Keck-Warren Scott Keck-Warren 19:33
Yeah, and I think that it's important to have Like just, just because it's like, you need to have that, right? Everybody has to pay, everybody has to feed their kids or whatever. So it totally makes sense to me. So, um, is there anything else that you want to direct our listeners to before we let you go for today?
B
Speaker B 19:48
Yeah, I would say like, I guess nativephp.com. Um, we do, uh, also subsequently we also have a whole other side of our business that, uh, is open source for doing desktop apps as well. So Windows, Linux, and Mac, you can build native desktop apps using the same Laravel that you already know. And all that's open source. There's a lot of contribution there, and that's been growing for a couple years. And then if you want to dabble in the world of mobile, I would say head to the same place and just click on all the mobile links and check out the docs and follow us on Twitter or something like that.
C
Speaker C 20:24
The only thing from my side is Shane and I and another developer, Steven, we have a podcast called The Bucket, which you should definitely check out if you like hearing people talk about native PHP. But also, if you don't mind us talking about other crazy things like conspiracy theories and the flatness of the earth.
B
Speaker B 20:46
Why was the Pope from Chicago? I mean, think about it. What just happened in Chicago? PHP Tech, remember? Coincidence? Tune in to find out. We've actually never talked about that.
Scott Keck-Warren Scott Keck-Warren 21:01
So just creating a new conspiracy theory here online, right? Yeah. Yeah. Yeah. Yeah. Well, thank you both for, for your time today.
C
Speaker C 21:09
Yeah. Thanks for having us, Scott. Yeah.
B
Speaker B 21:13
Thanks for having us.
C
Speaker C 21:13
It's been great to be here.
Scott Keck-Warren Scott Keck-Warren 21:13
Yeah, absolutely. I just have another heartfelt thank you to Shane and to Simon today, and also to you for all of your time. Thank you for listening to our podcast. And if you're not already a subscriber, make sure you subscribe with whatever your preferred method is, uh, so you can get our latest episodes when they're released and maybe share this post with a coworker or your boss so that they can also learn about native PHP for mobile. So, um, our podcast is available both as an audio version on the PHP Architect website, as well as a video version on our YouTube channel. This is Scott Keck Warren for the PHP Architect Community Corner signing off and reminding you to keep listening, keep coding, and keep reading.