Print Print
Reading time 5:42

wxphp logo
Developer(s)Mário Soares
Jefferson González
Stable release / May 30, 2015; 6 years ago (2015-05-30)[1]
Written inC/C++ / PHP
Operating systemCross-platform
TypeProgramming Library
LicensePHP License

wxPHP stands for "wxWidgets for PHP" and is a PHP extension that wraps the wxWidgets library, which allows writing multi-platform 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 Mac OS X by using the PHP language. Applications are written in PHP language, and since it is an interpreted language, it does not require an intermediate compilation step in order to run the application, provided the PHP interpreter has the extension available.


Near 2003, a group of enthusiastic people started writing on mailing lists[2] and forums presenting the idea of a PHP extension that wrapped the wxWidgets library in a similar way that PHP-GTK does for GTK+. A SourceForge project was created[3] and many people joined[4] in an effort to move the cause forward and make it a reality. Despite the will of project members, the same wasn't going anywhere[5] until Mário Soares decided to join in.[6] After the join, the first commits were done to the 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 on wrapper generators like SWIG, development was started for a simple code generator that read the output of GCCXML[7] ran over wxWidgets and transformed into a serialized PHP array. This helped save a lot of time on the monotonous task of writing the same code again and again for each class and its methods. After having some basic functionality and controls, an application was written using wxPHP itself, 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 current maintainer offering to make a website in order to boost wxPHP presence as attract more people and contributors. When the website was up and running, he started playing with the wxPHP sources. Later, decided to enable more methods and classes, discovering on the way that many features weren't supported by the code generator and extension itself. After several emails previous developer came with the idea of parsing the XML output generated by Doxygen from the wxWidget documentation. He took the task granted and started improving the code generator until it was re-written, adding lacking documentation and many features that would enable adding more wxWidgets functionality.


wxPHP now supports around 400 wxWidgets classes and thousands of methods, making it pretty 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 functionality supported by the wxPHP extension. Also an interface generator[8] has been written in order to get code completion on IDE's like NetBeans and Eclipse. Planning is undergoing to re-write the code generator yet again using a modular and object oriented approach that permits other people to use it to generate code for other PHP wrappers.[9]

GUI Designer

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


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


class MainFrame extends wxFrame
    function onQuit()

    function onAbout()
        $dlg = new wxMessageDialog(
                "Welcome to wxPHP!!\nBased on wxWidgets 3.0.0\n\nThis is a minimal wxPHP sample!",
                "About box...",


    function __construct()
                 "Minimal wxPHP App", 
                 new wxSize(350, 260)

         $mb = new wxMenuBar();

         $mn = new wxMenu();
         $mn->Append(2, "E&xit", "Quit this program");
         $mb->Append($mn, "&File");

         $mn = new wxMenu();
         $mn->AppendCheckItem(4, "&About...", "Show about dialog");
         $mb->Append($mn, "&Help");


         $scite = new wxStyledTextCtrl($this);

         $sbar = $this->CreateStatusBar(2);
         $sbar->SetStatusText("Welcome to wxPHP...");

         $this->Connect(2, wxEVT_COMMAND_MENU_SELECTED, array($this,"onQuit"));
         $this->Connect(4, wxEVT_COMMAND_MENU_SELECTED, array($this,"onAbout"));

$mf = new mainFrame();



See also

  • PHP-GTK, PHP bindings to GTK+
  • PHP-Qt, PHP bindings to the Qt toolkit
  • WinBinder, native window bindings for PHP
  • PHP Desktop, PHP desktop GUI framework with HTML5 Chrome/IE engine


  1. ^ "Changes" on GitHub
  2. ^ "wxPHP?". Retrieved 2012-06-06.
  3. ^ "wxPHP has Risen". Retrieved 2012-06-06.
  4. ^ "wxPHP SourceForge Mailing list". Retrieved 2012-06-06.
  5. ^ "wxPHP Progress". Retrieved 2012-06-06.
  6. ^ "Working Version". Retrieved 2012-06-07.
  7. ^ "GCC-XML". Retrieved 2012-06-06.
  8. ^ "Code Completion Interface File". Retrieved 2012-06-06.
  9. ^ "PEG - A PHP Extension Generator".

By: Wikipedia.org
Edited: 2021-06-18 14:12:02
Source: Wikipedia.org