phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

Maintainers

Package info

github.com/phel-lang/phel-lang

Homepage

pkg:composer/phel-lang/phel-lang

Fund package maintenance!

chemaclass.com/sponsor

Statistics

Installs: 3 557

Dependents: 15

Suggesters: 0

Stars: 475

Open Issues: 1


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.
  • Repository Guidelines Project structure, modules, build commands, and review expectations.

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

Resource What's there
CONTRIBUTING.md Setup, workflow, testing, and PR guidelines
Repository Guidelines Architecture, modules, build commands, review expectations
docs/ Guides, examples, and compiler internals
phel-lang.org Tutorials, exercises, and blog posts

New here? Start with CONTRIBUTING.md — it explains the two-language codebase and has a "Where to Start" section based on your interests.