Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
 
 
 
 
 
 
 
 
 
 

readme.md

PHP Transpiler

This tool transpiles PHP code into optimized PHP code.

Implemented features:

  1. Inlines require and include statements.

  2. Strips unnecessary whitespaces from the code.

  3. Strips comments from code.

Example

Run against files test.php and include.php in the same directory given as:

test.php

<?php

require 'include.php';

class Foo {
    public function msg() {
        return (new Bar)->msg();
    }
}

echo (new Foo)->msg();

include.php

<?php

class Bar {
    public function msg() {
        return "Example Return Message\n";  
    }
}

Transpiles into a single test.php that contains:

<?php  class Bar{public function msg(){return 'Example Return Message
';}}class Foo{public function msg(){return (new Bar())->msg();}}echo (new Foo())->msg();

For more examples and details on this project see the project page.

Usage

Installation

To install globally via composer run

composer global require brownbear/php-transpiler

CLI

Either analyze a source file or directory via:

php-transpiler analyze /src

or transpile a source directory into /out via:

php-transpiler transpile /src /out

Library

Not documented yet :/

Latest Stable Version Latest Unstable Version Minimum PHP Version Build Status Total Downloads Code Climate Test Coverage Dependency Status

About

Transpiles PHP code into logically equivalent, performance optimized PHP code

Resources

License

Releases

No releases published
You can’t perform that action at this time.