Hello there.
I have absolutely no real clue where to post this but rather into some sort of development mailing list.
Recently, I started to work on some tool that will compile a lot of PHP scripts into a single file, and may even go further and bundle a PHP binary within to create a sort-of standalone PHP executable. The concept is quite simple, but the including stuff isn't really. But, as I was thinking about this idea, I came across the various ideas of trying to use a GUI with PHP scripts. On windows, that has already been possible. But not on Mac - at least I found no working solution. wxWidgets (as extension, wxPHP) won't compile because it relies on the Carbon framework - which has been discontinued since about at least three major releases. And the extension can't be made to work with Cocoa, as this is Objective-C - and not C/C++.
And here is the keyword, Objective-C.
I have learned, that Objective-C is, like C++, a layer ontop of C. Furthermore, I saw that there was am "embed" SAPI, yet I couldn't find any way to fully integrate PHP into a binary that had non-Zend code inside; there is only a book. And due to my visual impairment, I am unable to read said book.
So I came up with a few questions:
- How could one integrate PHP into a C/C++ programm?
The reason I ask is because, I want to see how far I could integrate PHP into an Objective-C program.
- When integrating, how could I expose Objective-C functions to PHP's "C-Scope"?
The Zend 2 API is very poorly documented; basic things like reading/writing to and from objects is documented so poorly, that I had to read a ~100 page long slide share. But yet, I thought that the only way to expose stuff like Objective-C functions, or even Classes, to PHP would be to add a PHP-Extension-like structure, so that once the Objective-C programm was initialized, it would use the Zend API to expose things to PHP.
My goal is to enable access to at least the GUI functions of Cocoa, which can be reached thru Objective-C. Using this method, I wanted to create a new kind of framework, and combine it with my previous project of pulling PHP files into one. I think it already made a clue in your head if you are able to understand my - sadly - weird english.
Once I can expose Objective-C scope into PHP, I would be able to enable GUI's with PHP. Since PHP is very easily understood, it could be a good start for switchers - like me - to understand the other language and API. Now, we can use my code-compiler idea and build all the PHP script into one single, giant file - maybe even use Phar as this offers a great solution for that. The last step is to combine the executable and script, and we would get an actual and valid Mac OS X application - we do not need the compiling part, but it'd be cool ;).
I hope anybody can help me, poke me into the right direction to anything. This is just one idea I have, and something I hope to realize. I taught myself a good amount of c++ by trying to create a wrapper of a C++ class for a PHP extension. So I would try the trick again to learn more about objective-C.
Kind regards,
Kevin Ingwersen
PS: I am from germany, my english may not be very understandable - so please ask if you didn't understand something! :)