PHPackages                             phel-lang/phel-lang - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phel-lang/phel-lang

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phel-lang/phel-lang
===================

Phel is a functional programming language that compiles to PHP

v0.47.0(2d ago)5186.0k↑1340%30[1 issues](https://github.com/phel-lang/phel-lang/issues)13MITPHPPHP &gt;=8.4CI passing

Since Jan 31Pushed 1w ago7 watchersCompare

[ Source](https://github.com/phel-lang/phel-lang)[ Packagist](https://packagist.org/packages/phel-lang/phel-lang)[ Docs](https://phel-lang.org/)[ Fund](https://chemaclass.com/sponsor)[ RSS](/packages/phel-lang-phel-lang/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (79)Versions (268)Used By (13)

 [![Phel logo](logo_readme.svg)](logo_readme.svg)

 [ ![GitHub Build Status](https://github.com/phel-lang/phel-lang/workflows/CI/badge.svg) ](https://github.com/phel-lang/phel-lang/actions) [ ![PHPStan level 9](https://camo.githubusercontent.com/b72adb1f27170ecf486459c4b07e920bb3db2b464444bce8277e018270665646/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e) ](https://github.com/phel-lang/phel-lang/blob/main/phpstan.neon) [ ![Psalm level 1](https://camo.githubusercontent.com/bda1417d07f86745831148171d1a209a7101d6b6de5283b398fcddb73cb21cd4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5073616c6d2d6c6576656c253230312d627269676874677265656e) ](https://github.com/phel-lang/phel-lang/blob/main/psalm.xml) [ ![Psalm Type-coverage Status](https://camo.githubusercontent.com/8ea7485a3e886ee8322e6aba025cd062ab119c01ad093684dd30ba27d4a7887a/68747470733a2f2f73686570686572642e6465762f6769746875622f7068656c2d6c616e672f7068656c2d6c616e672f636f7665726167652e737667) ](https://shepherd.dev/github/phel-lang/phel-lang)

 [ ![Packagist Version](https://camo.githubusercontent.com/334284129036c8abf9d581ab936fe7a3aeda559870dba287d88f205aa3bd8313/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068656c2d6c616e672f7068656c2d6c616e67) ](https://packagist.org/packages/phel-lang/phel-lang) [ ![Packagist Downloads](https://camo.githubusercontent.com/a28e195a1ef3d02feb4554e454c92c66a5062a5d8c1d82e1b68c020568a8504c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068656c2d6c616e672f7068656c2d6c616e67) ](https://packagist.org/packages/phel-lang/phel-lang/stats) [ ![PHP Version Required](https://camo.githubusercontent.com/fcc780baff2c350e077de286aea39a1ed12639cdb2654b514361c1818e4ef283/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068656c2d6c616e672f7068656c2d6c616e67) ](https://packagist.org/packages/phel-lang/phel-lang) [ ![License](https://camo.githubusercontent.com/92a7e7c54c857979c1f3351c22796541088e64b8e0834d9f825dce91ca940551/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7068656c2d6c616e672f7068656c2d6c616e67) ](https://github.com/phel-lang/phel-lang/blob/main/LICENSE) [ ![Ask DeepWiki](https://camo.githubusercontent.com/0f5ae213ac378635adeb5d7f13cef055ad2f7d9a47b36de7b1c67dbe09f609ca/68747470733a2f2f6465657077696b692e636f6d2f62616467652e737667) ](https://deepwiki.com/phel-lang/phel-lang)

---

Lisp for PHP, macros, persistent data structures, REPL.

Get Started
-----------

[](#get-started)

```
composer require phel-lang/phel-lang
```

**1. Open a REPL**

```
./vendor/bin/phel repl
```

```
phel:1:> (->> [1 2 3 4 5] (filter odd?) (map #(* % %)) (reduce +))
35
phel:2:> (defn greet [name] (str "Hello, " name "!"))
| user/greet
phel:3:> (greet "Phel")
| "Hello, Phel!"
```

**2. Scaffold a project**

```
./vendor/bin/phel init         # add `--minimal` for a single-file layout
```

Creates `phel-config.php`, `src/phel/main.phel`, `tests/phel/main_test.phel`. Then:

```
./vendor/bin/phel run src/phel/main.phel   # run
./vendor/bin/phel test                     # tests
./vendor/bin/phel build                    # compile to PHP
./vendor/bin/phel config                   # inspect the merged config
```

**3. Eval inline or via stdin**

```
./vendor/bin/phel eval '(+ 1 2)'           # prints 3
echo '(println "hi")' | ./vendor/bin/phel eval -
./vendor/bin/phel eval -  "${fpath[1]}/_phel"

# fish
./vendor/bin/phel completion fish > ~/.config/fish/completions/phel.fish
```

The zsh script starts with `#compdef phel`, so completion only triggers for a binary named `phel` on your `$PATH`. If you call `./vendor/bin/phel` (or `./bin/phel` in a dev checkout), symlink a global `phel` first, e.g. on macOS + Homebrew:

```
phel completion zsh > "$(brew --prefix)/share/zsh/site-functions/_phel"
ln -sf "$PWD/bin/phel" "$(brew --prefix)/bin/phel"   # global `phel` so #compdef matches
rm -f ~/.zcompdump*                                  # force compinit to rebuild
# then open a new shell
```

> Prefer a project template? [`web-skeleton`](https://github.com/phel-lang/web-skeleton) or [`cli-skeleton`](https://github.com/phel-lang/cli-skeleton): click **Use this template** for a one-click start.

**More examples →****Data pipeline**

```
(def users
  [{:name "Ada" :age 36}
   {:name "Bob" :age 17}
   {:name "Cam" :age 41}])

(->> users
     (filter #(>= (:age %) 18))
     (map :name)
     sort)
;; => ["Ada" "Cam"]
```

**HTTP response**

```
(ns app (:require phel.http :as h))

(def req (h/request-from-globals))

(h/emit-response
  (h/response-from-map
    {:status 200
     :headers {"Content-Type" "text/plain"}
     :body (str "Hello " (:uri req))}))
```

**Macros**

```
(defmacro unless [pred & body]
  `(if (not ~pred)
     (do ~@body)))

(unless (zero? 1)
  (println "not zero"))
;; => not zero

(unless false (println "ok"))
;; => ok
```

**PHP interop**

```
(ns app)

(def now (php/new \DateTime))
(.format now "Y-m-d")
;; => "2026-04-20"

(def epoch (php/new \DateTime "1970-01-01"))
(.-days (.diff now epoch))
;; => 20564
```

Documentation
-------------

[](#documentation)

- [Getting Started](https://phel-lang.org/documentation/getting-started/): install, REPL, first script (5 min)
- [CLI Reference &amp; DX Guide](docs/cli-reference.md): every command, the dev loop, compile vs eval vs run vs build
- [phel-lang.org](https://phel-lang.org/documentation/): full documentation, tutorials, exercises, blog
- [Contributor docs](docs/README.md): repository internals, agent tooling, project layout
- [Packagist](https://packagist.org/packages/phel-lang/phel-lang)
- [CONTRIBUTING.md](.github/CONTRIBUTING.md): setup and workflow
- [AGENTS.md](AGENTS.md): architecture and review expectations

AI Coding Agents
----------------

[](#ai-coding-agents)

Skill files for Claude Code, Cursor, Codex, Gemini, Copilot, Aider: [resources/agents/](resources/agents/README.md)

```
./vendor/bin/phel agent-install [platform]   # install skill file for one agent (claude, cursor, ...)
./vendor/bin/phel agent-install --auto       # only agents detected in this project
./vendor/bin/phel agent-install --all        # every supported platform
```

### Repo-level AI tooling

[](#repo-level-ai-tooling)

Claude Code (`.claude/`) and Codex (`.codex/`, `.agents/`, `AGENTS.md`) configs generate from a single source tree under [.agnostic-ai/](.agnostic-ai/) via [agnostic-ai](https://github.com/Chemaclass/agnostic-ai). Those directories are gitignored; run `sync` after cloning to materialize them. Add more targets (Gemini, Cursor, ...) by appending to `targets:` in `agnostic-ai.yaml`.

```
brew install Chemaclass/tap/agnostic-ai   # or: go install github.com/chemaclass/agnostic-ai/cmd/agnostic-ai@latest
agnostic-ai sync                          # regenerate per-tool configs
```

Edit specs under `.agnostic-ai/{rules,agents,skills,hooks,scripts,overlays}/`, then `agnostic-ai sync` again. A CI gate runs `sync --check` on every PR to block drift between the source and the (gitignored) emitted files.

###  Health Score

68

—

FairBetter than 99% of packages

Maintenance98

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community39

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 74.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~4 days

Total

63

Last Release

2d ago

PHP version history (6 changes)v0.1.0PHP &gt;=7.4

v0.6.0PHP &gt;=8.0

v0.8.0PHP &gt;=8.0.2

v0.13.0PHP &gt;=8.2

v0.19.0PHP &gt;=8.3

v0.35.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d166420c6770c5941e10bd68b2d26501eabb432e280d8e6eba0a344bcc1e5ae?d=identicon)[Chemaclass](/maintainers/Chemaclass)

![](https://www.gravatar.com/avatar/95f5516d8a75725d151587359acd6914d0d35fc1b874334347ee80d726b291de?d=identicon)[jenshaase](/maintainers/jenshaase)

---

Top Contributors

[![Chemaclass](https://avatars.githubusercontent.com/u/5256287?v=4)](https://github.com/Chemaclass "Chemaclass (3714 commits)")[![jenshaase](https://avatars.githubusercontent.com/u/176220?v=4)](https://github.com/jenshaase "jenshaase (689 commits)")[![JesusValeraDev](https://avatars.githubusercontent.com/u/6381924?v=4)](https://github.com/JesusValeraDev "JesusValeraDev (316 commits)")[![SauronBot](https://avatars.githubusercontent.com/u/82400622?v=4)](https://github.com/SauronBot "SauronBot (84 commits)")[![jasalt](https://avatars.githubusercontent.com/u/2306521?v=4)](https://github.com/jasalt "jasalt (44 commits)")[![mabasic](https://avatars.githubusercontent.com/u/1839930?v=4)](https://github.com/mabasic "mabasic (32 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (31 commits)")[![plaffitt](https://avatars.githubusercontent.com/u/23403270?v=4)](https://github.com/plaffitt "plaffitt (23 commits)")[![smeghead](https://avatars.githubusercontent.com/u/112476?v=4)](https://github.com/smeghead "smeghead (23 commits)")[![drupol](https://avatars.githubusercontent.com/u/252042?v=4)](https://github.com/drupol "drupol (10 commits)")[![cgrabenstein](https://avatars.githubusercontent.com/u/6358948?v=4)](https://github.com/cgrabenstein "cgrabenstein (6 commits)")[![antonio-gg-dev](https://avatars.githubusercontent.com/u/13595197?v=4)](https://github.com/antonio-gg-dev "antonio-gg-dev (5 commits)")[![raspi-jesus-bot](https://avatars.githubusercontent.com/u/275256317?v=4)](https://github.com/raspi-jesus-bot "raspi-jesus-bot (4 commits)")[![t-matsudate](https://avatars.githubusercontent.com/u/41981585?v=4)](https://github.com/t-matsudate "t-matsudate (3 commits)")[![dominikb](https://avatars.githubusercontent.com/u/28777818?v=4)](https://github.com/dominikb "dominikb (3 commits)")[![geoffreyvanwyk](https://avatars.githubusercontent.com/u/194185?v=4)](https://github.com/geoffreyvanwyk "geoffreyvanwyk (3 commits)")[![lhsazevedo](https://avatars.githubusercontent.com/u/7695608?v=4)](https://github.com/lhsazevedo "lhsazevedo (3 commits)")[![aszenz](https://avatars.githubusercontent.com/u/25319264?v=4)](https://github.com/aszenz "aszenz (2 commits)")[![Lacsw](https://avatars.githubusercontent.com/u/12248879?v=4)](https://github.com/Lacsw "Lacsw (2 commits)")[![kambo-1st](https://avatars.githubusercontent.com/u/6493048?v=4)](https://github.com/kambo-1st "kambo-1st (2 commits)")

---

Tags

clojurecompilerdslfunctional-programmingimmutabilitylanguagelispmacrosphelphel-langphpphp-developerphp-langprogramming-languagerepls-expressionschemetranspilerlanguagefunctionallispphel

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phel-lang-phel-lang/health.svg)

```
[![Health](https://phpackages.com/badges/phel-lang-phel-lang/health.svg)](https://phpackages.com/packages/phel-lang-phel-lang)
```

###  Alternatives

[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[metamodels/core

MetaModels core

10156.4k68](/packages/metamodels-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[eliashaeussler/typo3-solver

Solver - Extends TYPO3's exception handling with AI generated solutions. Problems can also be solved from command line. Several OpenAI parameters are configurable and prompts and solution providers can be customized as desired.

302.1k](/packages/eliashaeussler-typo3-solver)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
