Project structure clarification #274
-
QuestionSo basically, this project has two components according to my understanding, and PHP is used in combination with Electron.js (or later Tauri), and the actual OS APIs are consumed by Electron in this alpha stage. PHP doesn't use FFI or some other technologies to communicate with the shell. This gives me two questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
That's correct. As of right now, the electron-plugin package simply provides a HTTP API that any technology can consume.
I don't think that the overhead of a local HTTP API call is very noticeable. |
Beta Was this translation helpful? Give feedback.
-
Unless i misunderstand your question, you can activate COM support in php.ini for Windows in: However the PHP MANUAL : COM and .Net (Windows) Then you can use as: Regardless if i misunderstood the question or not, loading required extensions perhaps should/could be done in the Perhaps with an Array
PS: i have no experience in how or what can do and what cannot do with the COM class. I came across this by accident, believing i could control VLC-player on my machine .... but it not works like that. (*crawling back humble to my cave) |
Beta Was this translation helpful? Give feedback.
-
Thanks for the in-depth explanation. I was curious how specific shell commands were executed by NativePHP in Windows, for example moving a file to the Recycle Bin. It seems that the actual trashing of the files are done by Electron rather than PHP itself, so you are making a POST request using the Laravel "backend" to Electron which runs a local server, thus achieving what I called "inter-process" communication, i.e. between Electron and PHP. After Electron receives such requests, it actually performs system/shell commands. What I meant by using FFI and/or COM/.NET extension was meant to be a replacement to this scenario that is used in NativePHP. So, instead of relying on Electron to achieve system commands, you'd do it natively in PHP by calling the appropriate system API calls through the DLLs provided in Windows. In other systems (i.e. Linux/macOS) something similar can also be implemented. Now, in your answer, it's possible to still call system APIs through FFI and COM/.NET, yes, but the APIs provided by NativePHP still will be directed to Electron for processing, as I understand it. @mpociot Great effort by the way, I'm following NativePHP's development with excitement 👍🏻 |
Beta Was this translation helpful? Give feedback.
-
@osc2nuke Does it have to be VLC? I achieved something similar using MPC-HC's APIs. I believe VLC could do something similar. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I have no idea but the GUYS over at VLC provided us with: The social aspect of these kind of services are: Here i call them to HELP ME out:
|
Beta Was this translation helpful? Give feedback.
-
You don't even need to do this. For many standard system calls that PHP is already capable of handling across platforms, you can simply write the necessary PHP code (e.g. The interaction with the 'backend' (in this case Electron) is there to enable the other cross-platform parts that aren't well-built across the PHP ecosystem, such as Window, Taskbar and Menu management. Tools like Tauri and Electron are abstracting away much of the complexity of this across all the major platforms and we simply need an interface to be able to communicate with those features from PHP for some things, not all. In Electron this is currently via a HTTP API which relies on a web server, as it's convenient and accessible. However, we are exploring other ways to do this that do not require web servers. In any case, the idea will be to have the solutions work as similarly as possible across platforms to minimise the support overhead of having multiple implementations (e.g. COM on Windows vs FFI on Mac, for example). |
Beta Was this translation helpful? Give feedback.
You don't even need to do this. For many standard system calls that PHP is already capable of handling across platforms, you can simply write the necessary PHP code (e.g.
unlink('a-file-i-hate.mov')
) and let the interpreter handle it.The interaction with the 'backend' (in this case Electron) is there to enable the other cross-platform parts that aren't well-built across the PHP ecosystem, such as Window, Taskbar and Menu management.
Tools like Tauri and Electron are abstracting away much of the complexity of this across…