Skip to main content

Functional Lisp for PHP developers

Phel compiles a Lisp dialect to PHP. Macros, persistent data structures, and REPL-driven development on any PHP host.

Phel by example

(->> (range 1 11)
     (filter odd?)
     (map #(* % %))
     (reduce +))
# => 165
Threading pipelines
  • Reads top to bottom, no nested calls
  • Each step is one pure function
  • Immutable data, predictable output
  • Same ->> macro PHP devs miss from RxJS or pipe operators

Why Phel?

vs vanilla PHP

More expression. Same runtime.

Macros, persistent collections, and a REPL, without leaving the PHP ecosystem. Composer, FPM, shared hosting all work.

vs Clojure on JVM

Lisp without the JVM.

Same Lisp ideas as Clojure, deployed like a PHP app. No JVM warmup, no AOT pipeline, no extra hosting target.

vs PHP FP libraries

Language, not library.

Real homoiconic syntax, real macros, real tail-call elimination. A library can't extend PHP's grammar. Phel doesn't need to.

Try it in 30 seconds

Try without installing anything. Drops you into a REPL.

docker run -it --rm phellang/repl

Full walkthrough in the installation guide.

Common questions

Is Phel production-ready?
Not yet. Phel is pre-1.0. The core language and tooling are usable for personal projects, prototypes, and internal tools, but breaking changes can land between minor releases. Track release notes if you depend on it.
Can I call PHP libraries from Phel?
Yes. Phel compiles to PHP, so any Composer package, function, or class is directly callable via the php/ prefix. See the interop guide.
How is Phel different from Clojure?
Phel borrows ideas from Lisp and Clojure (immutable data, macros, threading) but targets the PHP runtime, not the JVM. No agents, no STM, no atoms. Phel maps to PHP's execution model. See the design rationale.
What PHP version do I need?
The current release targets PHP 8.4 or later. Earlier Phel versions support older PHP releases if you need them.
Where do I get help?
Open a thread on GitHub Discussions, file an issue on GitHub, or read the full documentation.