Show HN: NativePHP Now Supports Windows
Following on from #271, I'm thrilled to be able to announce that...
- NativePHP now supports Windows! πͺ
- And, Windows builds are working π·π½ββοΈ
- Plus everyone gets new versions of PHP! π₯
Gimme gimme!
The easiest path to upgrade is to run composer require nativephp/electron
in your app. This will grab the latest version of all the key dependencies.
If you bump into any problems, please raise an issue - but please: check to see if the same issue has already been reported!
Windows support
With nativephp/electron
v0.6.0 (and a minor fix in nativephp/electron
v0.6.1), plus the changes in nativephp/php-bin
v0.4.0, Windows support has finally arrived.
I know many of you have been patiently waiting for this. Over the months, we've racked up quite a few issues as folks have attempted to find some way to get Windows builds working.
I totally get this enthusiasm, Windows support was always on the cards, but we stated early on that Windows support was going to take a while longer for one main reason: a lack of static builds of PHP for Windows with enough extensions baked in to support booting a Laravel application.
Believe me, this wasn't by choice. If we could have launched NativePHP with Windows support, we would have.
Why did it take so long? This is just something that no one has tackled before, until now. And it's not a particularly easy problem to solve.
I don't know if I'm more excited that we have Windows builds or that I was able to go through over half the open tickets and give people some good news.
It's largely thanks to @crazywhalecc and a flock of contributors who have all been working hard on the awesome static-php-cli
project. Their efforts have really paid off. Please go and show them some support!
With that project making the 'building PHP' part easy, I was able to shift attention to making builds of your Electron apps work on Windows. This required some patching and fixing up and a lot of testing, but builds are working reliably enough for the alpha for me to be happy to try and move onto the next thing.
It did also push me to work through many of the tickets and PRs and I finally feel like I'm getting on top of that now.
Thanks for your patience everyone π
PHP versions aplenty
The other important piece here is wider support for multiple versions of PHP. This has become increasingly important as more and more of you are moving up from PHP 8.1.
Importantly, this enables full Laravel 11 support as you can now use PHP 8.2 or 8.3 to develop your applications.
I want NativePHP to make building distributable, desktop-calibre software using PHP a breeze, but there will always be some complexity here.
You see, the version of PHP you use to develop your application is the version that you should ship with your application. If they're not the same, you will get warnings from Composer and potential bugs in your application.
The good news is that you now have complete choice between PHP 8.1, 8.2 and 8.3 and you don't need to configure anything to make it work; whatever minor version of PHP you develop with, NativePHP will bundle that same minor version when building your apps.
So if you're building an app on your computer with PHP 8.3.3, NativePHP will select the PHP 8.3 binaries (currently on 8.3.6) to ship when building your app.
Updates to the NativePHP binaries will also happen more regularly.
A note on php-bin
The php-bin
package houses the "official" builds of PHP that NativePHP supports. If you choose to build your own statically-compiled versions of PHP to ship with your apps and need a hand, you will need to pay for support.
The php-bin
repo will not be accepting PRs containing PHP binaries. This is out of precaution for the safety of our ecosystem, as we don't have the time and resources to verify the safety and authenticity of such third-party builds.
As we start to move throught the final stages of the alpha towards the beta and general availability stages of NativePHP, we'll also be doing more work to help you verify the safety of the builds we provide. This will be for your benefit and that of your users.
Long term, I don't think we'll be shipping the PHP binaries via this Composer package, as with at least 12 different binaries now bundled in, this one package is becoming a bit of a beast: even zipped, it'll consume over 80MBs of disk space on each app in development.
Of course, when you build your app for distribution only a single one of these binaries is ever embedded inside. Unzipped, they're approx. 25MBs each.
During these early phases of NativePHP's life, this package will suffice, but I expect we'll need to move on from it at some point.
Super sponsors
While you're here, I want to take this opportunity to say another massive thanks to our sponsors. You've enabled me to spend this time bringing these advancements to everyone. π
But there's still a long long way to go. As I said back in January, I'm determined that we get NativePHP into a production-ready state in 2024. While I'm a little bit behind on my rather ambitious "next few weeks" for some of the things mentioned there, I believe we still have plenty of time.
Can you help bring NativePHP to life a little sooner? Please consider sponsoring - it doesn't need to be monthly!
And if you need consultancy or just want some faster support, my sponsorship tiers are a great way for you to get some hands-on help from one of the maintainers of NativePHP!
Thanks for coming along for the ride. Please give the latest version of NativePHP a go and report any issues you find.
Once the dust has settled on this release, I will be firing up Tauri again and should start to have some updates for sponsors to try out very soon.
Β‘Vamos!