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.49.0(4w ago)5196.5k↑1259.4%30[1 issues](https://github.com/phel-lang/phel-lang/issues)13MITPHPPHP &gt;=8.4CI passing

Since Jan 31Pushed 1mo 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 2w ago

READMEChangelog (10)Dependencies (96)Versions (270)Used By (13)

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

 [ ![Tests](https://github.com/phel-lang/phel-lang/actions/workflows/tests.yml/badge.svg) ](https://github.com/phel-lang/phel-lang/actions/workflows/tests.yml) [ ![Quality](https://github.com/phel-lang/phel-lang/actions/workflows/quality.yml/badge.svg) ](https://github.com/phel-lang/phel-lang/actions/workflows/quality.yml) [ ![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.

Requirements
------------

[](#requirements)

PHP **8.4** or newer. Linux and macOS are supported: the full compiler, core and PHAR suites run on both in CI, and a failure on either blocks a release. Windows is best effort, running a reduced suite. What a version number promises, and for how long, is in the [stability policy](docs/stability.md).

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/main.phel`, `tests/main_test.phel`. With `--minimal` the two sources sit at the project root instead. Then:

```
./vendor/bin/phel run src/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 (new \DateTime))
(.format now "Y-m-d")
;; => "2026-04-20"

(def epoch (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
- [Architecture decisions](docs/adr/README.md): why the repository is shaped the way it is
- [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

66

—

FairBetter than 99% of packages

Maintenance90

Actively maintained with recent releases

Popularity45

Moderate usage in the ecosystem

Community40

Growing community involvement

Maturity81

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 ~8 days

Total

65

Last Release

29d 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

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k257.0M28.2k](/packages/friendsofphp-php-cs-fixer)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k257.3M12.4k](/packages/symfony-framework-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M779](/packages/sylius-sylius)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6943.5M450](/packages/drupal-core-recommended)[contao/core-bundle

Contao Open Source CMS

1301.7M3.1k](/packages/contao-core-bundle)

PHPackages © 2026

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