# WxPHP

wxPHP (for wxWidgets for PHP) is an extension for the PHP programming language that wraps the wxWidgets library, which allows writing cross-platform software desktop applications that make use of the native graphical components available to the different platforms. It supports the three major operating systems: Windows, Linux and macOS.

## History

Near 2003, a group of enthusiastic people began writing on mailing lists and forums presenting the idea of a PHP extension that wrapped the wxWidgets library in a similar way to what PHP-GTK does for GTK+. A SourceForge project was created and many people joined in an effort to move the cause forward and make it a reality. Despite the will of the project members, no progress was made, until Mário Soares decided to join. After the join, the first commits occurred to the Concurrent Versions System (CVS) repository on SourceForge. The first commits consisted of wrapping the wxApp class, wxFrame, and some other basic controls, this is when wxPHP first saw the light. Inspired by wrapper generators like Simplified Wrapper and Interface Generator (SWIG), development was begun for a simple code generator that read the output of GCCXML ran over wxWidgets and transformed into a serialized PHP array. This helped save much time on the monotonous task of writing the same code repeatedly for each class and its methods. After having some basic functions and controls, an application was written using wxPHP, to assist the code generator on the selection of class methods that it could handle correctly.
In August 2011, Jefferson González wrote an email to the maintainer then, offering to make a website to boost wxPHP presence and attract more people and contributors. When the website was up and running, he began working with the wxPHP source code. Later, he decided to enable more methods and classes, discovering on the way that many features were unsupported by the code generator and extension. After several emails, the prior developer had the idea to parse the XML output generated by Doxygen from the wxWidget documentation. He undertook the work and began improving the code generator until it was rewritten, adding missing documentation and many features that would enable adding more wxWidgets functions.

## Present

As of 2012, wxPHP supports around 400 wxWidgets classes and thousands of methods, making it usable to develop a desktop commercial application. The project source code is now hosted on GitHub. A reference generator was written that serves as the documentation of the functions supported by the wxPHP extension. Also an interface generator has been written to get code completion on integrated development environments (IDEs) like NetBeans and Eclipse. Planning is underway to rewrite the code generator yet again using a modular and object-oriented programming approach that permits others to use it to generate code for other PHP wrappers.

## GUI Designer

Support for PHP code generation was added to wxFormBuilder to easily create applications, and get people not familiar to the library to get up to speed on learning it.

## Example

A minimal frame example that shows how to add a menu bar with menu items, button, status bar and connection of click events.