Whats New for PHP on Windows: Developers Get More Done With Joomla!

Want a quick way to get customized Web sites up and keep them up, while leveraging your PHP skills? See how to use Joomla! and Microsoft WebMatrix to do exactly that!

By Staff

Want a quick way to get Web sites up and keep them up, while leveraging your PHP skills? Microsoft© WebMatrix® combines with Joomla (often spelled "Joomla!") to give you a good-looking site "out of the box", backed by a rich development environment with a sweet combination of features. See for yourself exactly how true this is: First we'll spin up a new Joomla site, then detail what's involved in making it look the way you — or your customers — want.

Create, customize, and publish web pages. Download WebMatrix.

Quick-Start: Complete Minimal Installation

WebMatrix puts you within a few points-and-clicks of a fresh, new, well-configured Joomla site. First, install WebMatrix through this page or an equivalent one that provides WebMatrix version 2 beta. Note that WebMatrix is available in both 32- and 64-bit flavors.

A straightforward installation process supplies you with:

  • ASP.NET Web Pages 2 Developer Preview
  • Web Deploy 3.0 Beta Installer
  • Web Deploy 3.0 Beta without bundled SQL Support
  • IIS 7.5 Express Update; and
  • WebMatrix 2 Beta.

With these pieces in place, selection of "Microsoft WebMatrix" from the Start Menu takes you to a launch page like this:

Microsoft WebMatrix start menu

If you next choose "App Gallery" (see the following image), you'll find you can select "Joomla ...", and WebMatrix will do all the work of installing the components, including database backing, that you need for a local instance. Make sure you look over the wizard forms you fill out carefully; some of them scroll beyond what's visible in a single screen, and a common mistake is to wonder what is wrong with your password when you haven't entered one.

WebMatrix Web Gallery

Features of WebMatrix with Joomla

At this point, you have a working Joomla installation on your desktop: access (that is, select "Run" in the upper left, or, in the Files view, right-click and select "Launch in Browser") the top object in the WebMatrix IDE, and your browser immediately pops up the default Joomla home page, served by your personal development instance.

Joomla Installation

Beyond that, though, your installation is managed by WebMatrix, which is ready to customize your site, publish it to a production server, import other content and sites, and much more. The default development configuration includes IIS Express® as a Web server, and SQL Server Compact® (sometimes called "SQL CE") for relational database management. With a working model already beside you from the WebMatrix you just installed, consider the features of these components:

Joomla Features

Joomla itself is an industry-leading content-management system (CMS). Of the top million domains worldwide, a recent W3Tech survey shows that only WordPress accounts for more sites than Joomla; Joomla appears to be particularly popular outside the United States. Joomla is known for its easy-to-learn administration control panel, JoomShopping e-commerce module, and well-maintained Wiki-based documentation. The capabilities of a site are extended by installing or developing new modules written in PHP. PHP itself has been for many years, as you likely already know, "the most popular server-side Web scripting technology..."

WebMatrix Features

WebMatrix is an interactive development environment (IDE) for Web frameworks. It finds, chooses, configures, launches, and maintains not only Joomla installations, but also ASP.NET, WordPress and scores of other Web frameworks and systems. WebMatrix structures all this through a file-oriented architecture that's lighter-weight and simpler to start than the Model-View-Controller (MVC) approach implicit in other IDEs and architectures. If you want to use Joomla at the same time as you're also working with other Web frameworks, WebMatrix gives you the benefit of handling all configurations and workflow through a single unified interface. WebMatrix is not Visual Studio; however, it shares IntelliSense autocompletion with Visual Studio, deeply leverages PHP's and Joomla's rich documentation sets, and is current enough with standards to be nimble at editing HTML5 pages and templates.

A particular benefit of WebMatrix is its efficient management of deployment. Far too often in my own consulting, I come across teams where someone reports that "it worked on my desktop" or another development environment, but the production version actually seen by end-users fails in some way. That's a miserable situation, and one that WebMatrix essentially eliminates with its unified control over all configurations and installations.

WebMatrix is too rich with features to capture in a single introduction like this: with an hour or two of practice, and the help of the tutorials referenced below, you'll see that you can install and apply new Joomla themes, load extensions, test the content-management of your site, and much more. WebMatrix preserves the file-based structure typical for PHP projects, so you'll find it easy to use tools from WebMatrix, Joomla, or the command-line in any combination you choose. You can bring existing projects into the WebMatrix framework, or manage the files of a WebMatrix project without WebMatrix; navigating in either direction is straightforward and sensible. For a hint of the convenience WebMatrix brings, see what a simple customization reveals about its usability and sophistication:

Add a Computed Page to the Site

Return to the top-level site object in the Files view. Right-click, and select "New File." Choose the PHP File Type as shown in the following image:

Adding a PHP Page to a Joomla Site

Name your new page example1.php. WebMatrix fills the source with valid HTML5 boilerplate, and pops up an editor. If you begin to type "p h p i ..." in the body of the HTML, WebMatrix immediately prompts you to complete with "phpinfo", at the same time as it pops up a description of the function its code completion suggests.

Code Completion in WebMatrix

Not only is the code completion as swift and useful as Visual Studio's Intellisense has made familiar, but the function description is taken directly from PHP.NET's well-known documentation set. The result: WebMatrix takes care of the mechanics of PHP coding, including function names and signatures, and gives you the opportunity to concentrate on the ideas behind your Web site. In this one-line example, you quickly have a well-formed HTML page which embeds the proper PHP to provide these diagnostics:

Well-formed HTML page with proper PHP

If your orientation is more to Joomla than WebMatrix, you can open the Joomla Admin Console, and act through its views of your site.

Pushing the Envelope

There's more: NuGet® is a package manager "that makes it easy to install and update open source libraries and tools ..."; in particular, it's savvy about Joomla templates and themes. Microsoft Expression Web® (sometimes known by a code name, "Quartz"), is a PHP-aware HTML5 editor that helps create well-designed pages. The larger theme, though, is that the WebMatrix-Joomla combination gives you familiar point-and-click IDE functionality for everything standard a site is likely to need, while also affording you complete control over the low-level CSS3 or PHP or JavaScript coding necessary for your own unique designs.

It's challenging to show the polish of WebMatrix in action. Joomla on its own provides wide and deep CMS functionality that end-users can manage without ever touching PHP. Most Joomla site development is about configuration of Joomla facilities, notPHP coding. WebMatrix's achievement is to integrate well with the best practices of Joomla and PHP; it follows that WebMatrix is at its best when it simplifies the complex integrations that a difficult module or plug-in or extension makes necessary. A complete integration of the complexity that brings out the best of WebMatrix is beyond the scope of this introduction.

What is helpful, though, is to illustrate the simplest possible connection between the Joomla database and conventional PHP source. See this for yourself by creating a new .phpsource with content

          // For our current purpose, just treat all
          // this preliminary material as boilerplate.
        define('_JEXEC', 1);
        define('DS', DIRECTORY_SEPARATOR);
        if (file_exist(dirname(__FILE).'/defines.php')) {
          include_once dirname(__FILE__).'/defines.php';
        if (!defined('_JDEFINES')) {
          define('JPATH_BASE', dirname(__FILE__));
          require_once JPATH_BASE.'/includes/defines.php';
        require_once JPATH_BASE.'/includes/framework.php';

          // Page-specific code begins here.
        $db = &JFactory::getDBO();
        $query = 'SELECT * FROM `#__users`';
        $items = ($items = $db->loadObjectList())?$items:array();
        echo "Users with log-ins: ";

This example returns information about the log-in accounts known to the site. It's equally brief to access other site configuration parameters, themes for the site, available plug-ins or extensions, and all the other capabilities Joomla boasts. Keep in mind always that you get the most out of Joomla when you leverage its built-ins and minimize your own coding. WebMatrix's contribution is to tie all the parts of a complex site together consistently to make development as easy as possible.

'Interested in more background information before you start to experience WebMatrix for yourself? Microsoft offers a fine Getting started with Joomla and WebMatrix introduction. Far more of the details of the philosophy of WebMatrix use appear in this extended video.

Note that while WebMatrix is relatively lightweight and undemanding, all my attempts to install it on one particular older Vista machine failed; it was consistently painless and quick on Windows 7, though, and I did quite a bit of programming on another Vista machine with hardware identical to the one that stalled. Once you start to develop your Joomla sites with WebMatrix, you won't want to work without it.

Related Links

The following are links you might find of value:

# # #

This article was sponsored by Microsoft Corporation, but written independently by the author.

Add to My MSN