View on GitHub

PingPHP

A PHP code generator which use Python Like grammar

Download this project as a .zip file Download this project as a tar.gz file

Build Status

Introduction

Installation

To install PingPHP, simply:

$ sudo pip install pingphp

or from source:

$ sudo python setup.py install

Getting Started

Generate PingPHP.conf.json file.

$ pinginit

Then edit the config file with Wildcard.

{
    "ignoreFiles": [
        "test1/*"
    ], 
    "transFiles": [
        "test/**/*.ping"
    ], 
    "destDir": "dest"
}

Generate files:

$ pingrun

Generate files and observe their changes:

$ pingsee

Grammatical Details

CodeSample

Input file: part of typeHinting.ping

''''''
class MyClass:

    public test(otherclass:OtherClass):
        echo otherclass.var

    public test_array(input_array:array):
        print_r(input_array)

    public test_interface(iterator:Traversable):
        echo get_class(iterator)

    public test_callable(callback:callable, data):
        call_user_func(callback, data)

myclass = new MyClass()

Output file: part of typeHinting.php

<?php
class MyClass { 

    public function test(OtherClass $otherclass) { 
        echo $otherclass->var; 
    }

    public function test_array(array $input_array) { 
        print_r($input_array); 
    }

    public function test_interface(Traversable $iterator) { 
        echo get_class($iterator); 
    }


    public function test_callable(callable $callback, $data) { 
        call_user_func($callback, $data); 
    }
}

$myclass = new MyClass(); 

Related

Author

License

Copyright (c) 2015 zxylvlp

MIT