jaytaph / Transphpile

PHP 7 to PHP 5.6 Transpiler
BSD 3-Clause "New" or "Revised" License
177 stars 9 forks source link

Best practice to transpile composer package #10

Open felixfbecker opened 8 years ago

felixfbecker commented 8 years ago

Hi, I was wondering what is the best practice if you want to transpile a composer package? Say I am the author of a package, write the source in PHP7 and want to publish it in PHP5. Would I have to check in the compiled source code to GitHub?

felixfbecker commented 8 years ago

Or could a post-package-install script be used? https://getcomposer.org/doc/articles/scripts.md

jaytaph commented 8 years ago

Hi @felixfbecker

Thanks for using this transpiler. To be honest, it's currently in a very early phase, and it should be regarded as a proof-of-concept than a real package you can use (this is why it's not yet on composer/packagist for instance)

felixfbecker commented 8 years ago

My use case is for https://github.com/felixfbecker/php-language-server. I started it in PHP 7 and I enjoy the language features. But there are many people requesting PHP 5 support. I don't really want to rewrite everything when eventually all these people will upgrade one day. So this seems like the perfect fit. It seems like everything expect anonymous classes worked, see https://github.com/felixfbecker/php-language-server/issues/23

The language server itself depends on other alpha versions of packages so I would be fine to use it honestly. I have continuous integration and tests set up so it's easy to verify that everything works.

felixfbecker commented 8 years ago

Maybe you could publish this as a development version, e.g. 0.0.1? That way it is clear that it is under development but you can follow semver.

shmax commented 7 years ago

👍 for launching this, even at an early stage. I'd like to use it for a few projects I'm involved with as well, and would be happy to assist with testing and fixes.