phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

Fund package maintenance!
chemaclass.com/sponsor

Installs: 3 277

Dependents: 15

Suggesters: 0

Security: 0

Stars: 469

Watchers: 9

Forks: 22

Open Issues: 3

pkg:composer/phel-lang/phel-lang


README

Phel logo

GitHub Build Status Scrutinizer Code Quality Scrutinizer Code Coverage Psalm Type-coverage Status Ask DeepWiki

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.

Example

; 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)

Documentation

Getting Started

Learning Resources

Reference

  • Website Official website with tutorials, exercises, and blog posts.
  • Packagist Official PHP package repository.
  • Internals Deep dive into the compiler architecture.

Build PHAR

Run the following command to create a standalone PHAR executable:

./build/phar.sh

The generated build/out/phel.phar can then be executed directly.

Contribute

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.