Phi is a modern transpiler that enhances PHP with strong typing, object-oriented improvements, and an integrated Blade-inspired templating system.
Install Phi via Composer with:
composer global require siguici/phi:dev-mainCreate a hello.phi file:
Hello, $name!
Run it with:
phi run hello --name=PhiThis displays: Hello, Phi! 🎊
Phi is a cutting-edge PHP framework that introduces:
✅ Strong typing for better code reliability 🔍 ✅ Advanced OOP features for maintainable applications 🏗️ ✅ A powerful templating system for seamless UI rendering 🎨 ✅ Full PHP compatibility ensuring easy adoption 🔄
- 🚀 Enhances PHP without breaking compatibility – Upgrade your projects without major rewrites.
- ✍️ No need for PHPDoc & annotations – Types are enforced at both transpilation and runtime.
- ⚡ Inspired by TypeScript – Offers both static and dynamic typing for flexibility.
- 🎭 Blade-like templating – Clean and structured HTML rendering.
- 🛡️ Strong Typing – Enforces types at compile-time and runtime.
- 🏗️ Advanced OOP – Expands PHP’s object-oriented capabilities.
- 🔄 Dynamic & Static Typing – Inspired by TypeScript.
- 🖥️ Integrated Templating Engine – A Blade-like system for clean HTML rendering.
- 🧩 Seamless PHP Integration – 100% compatible with existing PHP code.
🔹 PHP 8.4 or higher (8.4.3+ recommended)
🔹 Composer
🔹 Git
🔹 Node.js (Optional)
Install Phi from Packagist using Composer:
composer global require siguici/phi:dev-mainPhi transpiles .phi files into .php, introducing enhanced features while maintaining PHP compatibility.
phi source.phiThis converts source.phi into an optimized PHP file.
<?php
// Strongly-typed function in Phi
function greet<T extends string>(T $name): T {
return "Hello, $name!";
}
echo greet("World");<?php
function greet(string $name): string {
return "Hello, $name!";
}
echo greet("World");
?>Phi ensures type safety at transpilation, making PHP development more robust. 🛡️
We welcome contributions! 💖 Whether it's bug fixes, new features, or documentation improvements, feel free to contribute.
- 🍴 Fork the repository.
- 🌱 Create a new branch.
- 🛠️ Implement your changes and add tests.
- 📤 Submit a pull request.
Please follow our coding style and contribution guidelines. 🙌
Phi is licensed under the MIT License. See the LICENSE.md file for details.
For questions, issues, or feedback:
- 🚀 Open an issue
- 💬 Join our discussions