Own Marketplace Server using PHP/MySQL

First of all, thanks to Tom Seidel who is the project lead of Remus and provides an open source marketplace server. The marketplace server uses J2EE and needs a Jetty or another application server.

But why on earth do we need another marketplace server solution?

Simple question, simple answer. I’m not familiar with J2EE. Furthermore, it’s more expensive to rent a root server for running a Jetty than using a hosted standard server with PHP and MySQL. Anyhow, the marketplace server from Tom works well and I used it for a while, but honestly, I’ve already planned get rid of my noisy and power consuming home server which I’ve used instead of an expensive hosted root server.

Homer Application Server

Hence, I thought by myself, isn’t it possible to create a marketplace server utilizing PHP and MySQL, in respect to the point that I still have a hosted standard server with http://www.openchrom.net?

After studying the marketplace server specification, it was obvious what to do. The query results will be returned in XML format. No problem for PHP.

header("Content-Type: text/xml; charset=utf-8");
$doc = new DOMDocument;
$root = $doc->createElement('marketplace');
$rootNode = $doc->appendChild($root);
echo $doc->saveXML();

All queries use a distinct syntax to retrieve the marketplace results. This query for example (http://marketplace.eclipse.org/featured/api/p) is used to retrieve a list of featured plug-ins from the Eclipse Marketplace. The GET paramters are variable and depend on the used Eclipse version. Hence, is it possible to redirect the query to a PHP file which itself returns the requested XML file? Yes it is, if you’re using an Apache with activated “mod_rewrite” option. Well, most of the providers do have the “mod_rewrite” option activated. Simply create a “.htaccess” file and route the marketplace requests to distinct PHP files.

RewriteEngine on
RewriteRule ^featured/api/p$ http://www.openchrom.net/marketplace/featured.php?%{QUERY_STRING}

An own marketplace can be included in a RCP solution by using the extension point “org.eclipse.epp.mpc.ui.catalog”. I’ve included my own marketplace for OpenChrom in the following way:

		description="Install new plug-ins from the OpenChrom marketplace."
		label="OpenChrom Marketplace"

Last but not least, a check shows that it works fine! Moreover, it’s now possible to return only those plug-ins that match to the specific OpenChrom version and used operating system.

OpenChrom Marketplace Client

That’s it. In the next article, I’ll describe how to fetch dependent plug-ins automatically.


About Philip Wenig

Founder of OpenChrom
This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Own Marketplace Server using PHP/MySQL

  1. Pingback: Own Marketplace Server – Part II | OpenChrom

  2. jastram says:

    Nice post, and quite useful, as I am in the middle of buiding a marketplace of my own. Just wondering: Did you post the complete php-based marketplace somewhere open? I could not find it. I can probably take it from here, it’ll just take longer.

    Thanks! Michael

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s