> Markdown version of [/videos/791-phel-a-native-lisp-for-php](https://www.wearedevelopers.com/videos/791-phel-a-native-lisp-for-php). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Phel, a native Lisp for PHP Want to write Clojure-style Lisp without leaving PHP? Meet Phel, a native functional dialect that brings pure functions and immutable data structures directly to your PHP runtime. - **Speakers:** Jose Reales - **Event:** World Congress 2023 - **Published:** October 23, 2023 - **Duration:** 9:57 - **URL:** https://www.wearedevelopers.com/videos/791-phel-a-native-lisp-for-php ## Summary Phel is a native Lisp dialect inspired by Clojure and Janet that transpiles directly into PHP. Just as Clojure leverages the JVM, Phel operates entirely within the PHP ecosystem, offering seamless interoperability with native PHP functions, objects, and Composer packages. The language was created to bridge the gap between object-oriented and functional paradigms, equipping developers with declarative syntax, immutable data structures, and pure functions without forcing them out of the standard PHP runtime environment. Transitioning to Phel means trading PHP's C-like syntax for Scheme-inspired s-expressions, replacing mutable variables and imperative loops with constant definitions and tail recursion. Interaction with PHP is straightforward: developers simply use a `php/` prefix to instantiate objects (`php/new`), call static methods, or access the standard library. The ecosystem includes a robust local development environment via a Docker-based Read-Eval-Print Loop (REPL) and a native testing library, ensuring that functional codebases remain thoroughly testable and maintainable. Practical applications written in Phel—such as interactive terminal games—demonstrate the power of functional state management and highlight the performance benefits of using specific data structures like vectors and hash maps over generic PHP arrays. Ultimately, Phel serves not as a complete replacement for PHP, but as an educational stepping stone. By mastering functional patterns to eliminate side-effects and focus on declarative outcomes, PHP developers can internalize concepts that make their traditional object-oriented code cleaner and more resilient. **Keywords:** phel language, lisp dialect transpilation, php functional programming, clojure inspired syntax, php interoperability, immutable data structures, declarative programming patterns, read-eval-print loop, php composer ecosystem, tail recursion implementation, functional state management, native php transcompiler, object-oriented vs functional, s-expressions syntax, php object integration ## Chapters 1. **Origins and architectural concept of the Phel language** (00:39) — The history of the open-source project and its foundation as a Lisp dialect compiling to PHP. 1. **Core functional principles and basic Phel syntax demonstration** (01:51) — Contrasting functional immutability against object-oriented state before introducing basic Lisp parenthesis syntax. 1. **Native data types and control structures in Phel** (03:44) — Exploring essential functional data structures, conditional operators, and looping mechanisms unique to the language. 1. **Seamless interoperability and object instantiation with native PHP** (05:36) — Accessing native PHP functions, instantiating objects, and leveraging the Composer ecosystem directly from Phel code. 1. **Exploring the read-eval-print loop and Docker environment** (06:33) — Utilizing an official Docker image to quickly launch an interactive interpreter for real-time development. 1. **Demonstrating a terminal-based Snake game built in Phel** (07:18) — A practical code walkthrough of building an interactive terminal application using pure functional logic and recursion. 1. **Compiler refactoring insights and educational goals of Phel** (08:48) — Recent architecture updates to the compiler and community resources for teaching functional concepts to PHP engineers. ## Related Moments - [Embracing Lisp syntax and metaprogramming paradigms](https://www.wearedevelopers.com/videos/103-java-with-a-clojure-mindset) (from "Java with a Clojure mindset") - [Introduction to Project Loom and reactive programming](https://www.wearedevelopers.com/videos/993-java-s-project-loom-co-the-end-for-reactive-programming) (from "Java's Project Loom & Co - the end for reactive programming?") - [Learning Java features and design patterns interactively](https://www.wearedevelopers.com/videos/536-chatgpt-and-java-a-match-made-in-heaven-or-hell) (from "ChatGPT and Java: A Match Made in Heaven or Hell?") - [Key benefits of learning the Clojure programming language](https://www.wearedevelopers.com/videos/229-using-backend-languages-for-frontends-why-clojurescript-is-an-awesome-idea) (from "Using backend languages for frontends: Why ClojureScript is an awesome idea!") - [Approaching Java development with a Clojure mindset](https://www.wearedevelopers.com/videos/103-java-with-a-clojure-mindset) (from "Java with a Clojure mindset") - [Reflecting on language design history and future competitors](https://www.wearedevelopers.com/videos/526-the-design-and-evolution-of-c) (from "The Design and Evolution of C++") ## Related Articles - [Dev Digest 138 - Are you secure about this?](https://www.wearedevelopers.com/magazine/486-dev-digest-138-are-you-secure-about-this) - [Dev Digest 131 - AI'm not sure about OSS](https://www.wearedevelopers.com/magazine/472-dev-digest-131-ai-m-not-sure-about-oss) - [Dev Digest 109 -Egg-citing things…](https://www.wearedevelopers.com/magazine/408-dev-digest-109-egg-citing-things) - [Using Java 17 latest features in real world projects](https://www.wearedevelopers.com/magazine/121-using-java-17-latest-features-in-real-world-projects) ## Related Jobs - [Senior Software Engineer](https://www.wearedevelopers.com/jobs/ext/15942-senior-software-engineer) at **GitHub** - [Junior Frontend Engineer](https://www.wearedevelopers.com/jobs/ext/1532351-junior-frontend-engineer) at **Almedia** - [Software Engineer](https://www.wearedevelopers.com/jobs/ext/1304673-software-engineer) at **Bitpanda** - [Senior Software Engineer, React (Websites & Martech)](https://www.wearedevelopers.com/jobs/ext/1605272-senior-software-engineer-react-websites-martech) at **Bitpanda** - [Senior Fullstack Engineer, Angular & Nestjs (Defi Wallet)](https://www.wearedevelopers.com/jobs/ext/1983681-senior-fullstack-engineer-angular-nestjs-defi-wallet) at **Bitpanda** - [Mid/Senior Full-Stack Engineer (Web-first)](https://www.wearedevelopers.com/jobs/ext/1210833-mid-senior-full-stack-engineer-web-first) at **SMG Swiss Marketplace Group**