Replies: 2 comments 5 replies
-
|
I got it! If anyone would be interested, it's possible by editing NativePHP vendor files, when you change some logic where the local server is turned on, and change the IP from 127.0.0.1 to 0.0.0.0, you can connect to the app via browser from an external device that is connected to the same local network. And you can then connect to the machine that is running the NativePHP app using http://ip:8100 (default port)! 😬 |
Beta Was this translation helpful? Give feedback.
-
|
Hi @patimio66, Sorry for the delay, but I had the same problem making web requests for a desktop application in NativePHP. Exposing the entire application to receive any request is indeed a problem, so the idea here was to expose only what was necessary for web requests. Going with the idea of overwriting files in the vendor folder (not recommended), when generating the build with The idea here is to start an express application within the resources folder, which, upon starting, will run with host 0.0.0.0 on a different port than the one your application is running on. This express application makes a request pointed to When starting the application in the ChildProcess::start(
cmd: ['node', 'resources/api/server.js']
alias: 'tail',
env: [
'NODE_PORT' => 8101
]
);And your server.js: import app from "./index";
app.listen(process.env.NODE_PORT, '0.0.0.0', () => {});const response = await axios.get(`http://127.0.0.1:${PORT_THAT_NATIVEPHP_IS_RUNNING}`, {
params: req.query,
headers: {
'api-key': process.env.API_KEY
}
});Therefore, it is possible to use the proxy to make web requests to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, welcome!
#nativephp #laravel #desktop #server
TL;DR I'm wondering how to implement Laravel as a server/host on a desktop, with the ability to share it over a local network for other devices to access via a browser.
Got a moment? Here's the full story:
I’d like to start working on a desktop version of my app / censored by author for computers/laptops. The idea is that users edit a collection of songs online (lyrics, tags, chords, etc.), then import that into the desktop app.
From the desktop, this song database should be accessible on tablets or phones connected to the same local network (via a browser). There should also be a way to "share" a specific song with other tablets, which is why I need a server to manage this.
I wanted to use NativePHP, but it doesn’t seem to support access from other devices on
localhost, unlike Apache or Laragon (which can be configured for this). Has anyone tried using it, even just for fun?The project is hobby-scale, mainly for myself, but maybe others will find it useful. I don’t have experience with technologies outside of Laravel and Livewire for backend/app development.
Do you have any other ideas on how to achieve this with minimal effort? (I don’t want to learn a completely new technology for this.) It should also be possible to compile this into a program that a non-technical user can install, even with a step-by-step guide.
I’d appreciate any small suggestions. 💛
Beta Was this translation helpful? Give feedback.
All reactions