Fork me on GitHub

POD, the PHP preprocessor by Geoffroy Couprie

Productive web development

We all love PHP's power. Easy to use, deployed everywhere. It is often the tool of choice when you begin programming. But soon, you feel that the language is fighting against you. Weird syntax, failing options, etc.

Here comes POD

POD is a new language, very close to PHP, but with a simpler syntax, easier to read, easier to type. It directly translates to PHP, so you will be able to use it everywhere, and profit from the uncountable number of PHP libraries already available.

Syntax

POD

<html>
<head></head>
<body>
<?
  a = "Hello " + "World!"
?>
  <h1><? print a ?></h1>

<?
    A  = {
    -\ value
    +/ mul = (x, y) -> { ret x * y }
    -/ __construct = (val) -> { this.value = val }
    -/ show = () -> { print this.value }
  }

str = "<script>alert('pouet')</script>"
obj = new A(str)
obj.show()
?>
</body>
</html>

Equivalent PHP

<html>
<head></head>
<body>
<?php
$a = "Hello " . "World!";

?>
  <h1><?php print htmlentities($a); ?></h1>

<?php
class A{
    private $value;
    static public function mul($x, $y){ return $x * $y; }
           public function __construct($val){ $this->value = $val; }
           public function show(){ print htmlentities($this->value); }
};

$str = "<script>alert('pouet')</script>";
$obj = new A($str);
$obj->show();

?>
</body>
</html>

Features

Usage

$ ./bin/pod.php myfile.pod

Technology

POD is a monadic parser combinator written in PHP using the excellent PHPZ library to bring the power of typeclasses to PHP. The parser is easy to extend, with lots of unit tests to prevent errors, so don't hesitate to hack on it!

Download

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/Geal/pod