Skip to main content

Scala.php v0.1.1

· One min read
Jakub Kozłowski

UPDATE: Scala.php is now discontinued. See the denouncement post.

Scala.php 0.1.1 has been released!

This is the first public release of Scala.php.

Scala.php is a PHP backend for the Scala compiler: it takes your Scala code and outputs PHP code from it, which you can include into an existing PHP application, run on its own, or package into a library.

You can learn more about its features on the homepage, or you can go ahead and get started.

In the meantime, here's a demo:

src/main/scala/Demo.scala
import java.nio.file.Files
import java.nio.file.Paths
import scala.io.StdIn

object Demo {

def main(
args: Array[String]
): Unit = {

println("What's your name?")
val name = StdIn.readLine()

val greeting = s"Hello $name!"

Files.writeString(Paths.get("greeting.txt"), greeting)

println(Files.readString(Paths.get("greeting.txt")))
}

}
Output
> What's your name?
< Jakub
> Hello Jakub!