TP

Using PHP objects from C# in a type-safe way

When you want to call PHP scripts from mainstream .NET languages, like C# you can follow two different ways. First you can use the pure mode as I demonstrated in one of the earlier articles on PHP application called Texy!. This approach can be used only for some specific applications, because pure mode has several restrictions - the two most important restrictions are that no global code or inclusions are allowed (you have to specify all source files during the compilation), but thanks to this restrictions Phalanger is able to produce classes that are compatible with .NET and can be called from C#. Second option is to create object dynamically by its name and perform all method invocations by name too. This approach can be used with any PHP scripts, but it isn't very convenient. In this article we present new features in the Phalanger beta 4 which extend the second approach and make it possible to use objects from any PHP script in C# using type-safe way.

Published: Monday, 30 April 2007, 1:26 AM
Tags: phalanger
Read the complete article

Phalanger 2.0 Beta 4 available!

This week we finished new release of Phalanger (the PHP compiler for .NET platform). The goal in this release was to fix many minor bugs preventing us from running some of the famous and most often deployed open-source PHP applications, so with the new release you'll be able to run for example MediaWiki, the wiki application that evolved from system used on Wikipedia or probably the best-known PHP blogging and publishing system WordPress. Other applications that we tested can be found at Phalanger website in the list of tested PHP applications [^]. Compatibility is very important for us, so if you have troubles running any open-source PHP application, let us know and we'll include it in our list!

Another thing that we focused on is interoperability between PHP scripts compiled using Phalanger and other .NET languages. Using .NET objects from Phalanger is very intuitive and has almost no limitations, however the other way is a bit difficult because of the dynamic nature of PHP language. If your PHP application can be compiled in the Phalanger pure mode, than the PHP objects can be exported and made available to C# and other languages. The methods of objects exported using this method take object (the base class for every .NET object) as a parameter, because PHP checks types at runtime, so this may be a bit confusing for the users. In the Beta 4 we tried to target these two issues - first, the fact that you have to use pure mode and second, the fact that exported objects can't contain any information about accepted types. This is a topic for entire article, so I'll write about it soon... Stay tuned :-)!

Here are the links for Phalanger 2.0 Beta 4 release:

Published: Sunday, 22 April 2007, 4:24 PM
Tags:
Read the complete article

All blog posts by tag

f# (112), functional (66), research (49), c# (37), academic (27), asynchronous (27), parallel (23), programming languages (22), functional programming (20), universe (20), meta-programming (18), philosophy (16), links (15), presentations (14), data science (12), writing (12), joinads (12), web (11), thegamma (11), talks (9), data journalism (9), math and numerics (9), random thoughts (9), phalanger (8), haskell (7), mono (7), webcast (7), design (6), architecture (5), fslab (5), open source (5), visualization (4), fun (4), accelerator (4), type providers (3), linq (3), f# data (3), .net (3), training (2), coeffects (2), deedle (2), monads (2), art (2), fractals (2), funscript (2), new york (2), manning (2), books (2)