This project is read-only.
A small set of PHP files to support using the Microsoft AJAX Library with PHP web applications. The current release supports creating web service proxies in PHP code such that the Microsoft AJAX Library (a free download from can call them from client-side code. Future releases will support localization and globalization, debug and release scripts, and more features inspired by ASP.NET AJAX.


Download the current release: 4 Alpha


  • A web server -- Steve and Christian have personally tested on IIS7 (Vista) and Apache (Ubuntu 6.06, with PHP5.2 from 'feisty')
  • PHP 5.2 -- 5.2 is required for json_encode/json_decode; on older versions you can manually install php-json
  • Version 3.5 of the Microsoft AJAX Library (older versions are supported by 3 Alpha)


  1. Download the current release and unpack it locally.
  2. Download the Microsoft AJAX Library from
  3. From your PHP code, include MSAjaxService.php from your service code.
  4. From your client code, include MicrosoftAjax.js via a script tag. (This file is part of the Microsoft AJAX Library you downloaded in step 2.)

NOTE: The samples included in the full distribution will not work until you download the Microsoft AJAX Library. See the readme.txt in the MicrosoftAjaxLibrary directory where you unpacked PHP for Microsoft AJAX Library.

Hello World Example

A basic example showing how to expose a web service from PHP and consume it from the browser. This sample can be found under samples/HelloWorld in the source distribution.



require_once '../../dist/MSAjaxService.php';

class HelloService extends MSAjaxService
    function SayHello($name)
        return 'Hello, ' . $name . '!';

$h = new HelloService();



<title>Hello, World!</title>
<script type="text/javascript" src="../../MicrosoftAjaxLibrary/MicrosoftAjax.js"></script>
<script type="text/javascript" src="HelloService.php/js"></script>
Name: <input id="name" type="text" /> <input type="button" value="Say Hello" onclick="button_click(); return false;" />
<br />
Response from server: <span id="response"></span>
<script type="text/javascript">
    function button_click() {
        HelloService.SayHello($get('name').value, function (result) { $get('response').innerHTML = result; });

Last edited Aug 30, 2008 at 11:44 AM by cwenz, version 12