Phel is a functional, Lisp-inspired programming language that compiles to PHP. It brings the expressive power of Clojure and the simplicity of Janet to the PHP ecosystem — enabling you to write concise, immutable, and composable code that runs anywhere PHP does.
; Define a namespace
(ns my\example)
; Define a variable with name "my-name" and value "world"
(def my-name "world")
; Define a function with name "print-name" and one argument "your-name"
(defn print-name [your-name]
(print "hello" your-name))
; Call the function
(print-name my-name)- Website
Discover features, tutorials, exercises, and the latest blog posts. - Installation
Get started quickly with scaffolding or manual installation. - Packagist
Find Phel on the official PHP package repository. - Internals
Learn more about the compiler’s inner workings. - Examples
Explore practical scripts you can run directly with the Phel CLI.
Run the following command to create a standalone PHAR executable:
./build/phar.shThe generated build/out/phel.phar can then be executed directly.
Please refer to CONTRIBUTING.md for information on how to contribute to Phel. For a quick overview of project layout, tooling, and review expectations, visit the Repository Guidelines.