The Phel Language
Phel is a functional programming language that compiles to PHP. It is a dialect of Lisp inspired by Clojure and Janet.
Community
Feel free to ask questions and join discussions on the Phel Gitter channel.
Features
- Built on PHP's ecosystem
- Good error reporting
- Persistent Datastructures (Lists, Vectors, Maps and Sets)
- Macros
- Recursive functions
- Powerful but simple Syntax
- REPL
Why Phel?
Phel is a result of my failed attempts to do functional programming in PHP. Basically I wanted:
- A LISP-inspired
- functional programming language
- that runs on cheap hosting providers
- and is easy to write and debug
Example
The following example gives a short impression on how Phel looks like:
# 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)
Try Phel
The quickest way to try out Phel is to run our REPL Docker container.
docker run -it --rm phellang/repl
Getting started
Phel requires PHP >=8.2 and Composer.
Read the Getting Started Guide to create your first Phel program.
Status of Development
Phel is nearing completion, but it is not yet marked as fully stable. We want to continue evolving the language and refining it, so we're not shying away from making breaking changes at this stage. If you're curious, we invite you to test it out and share your feedback!
We warmly encourage contributions—whether it's by opening issues to highlight areas for improvement or, even better, submitting pull requests with your suggestions and enhancements!