Skip to content

siguici/phi-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 

Phi φ

Phi is a modern transpiler that enhances PHP with strong typing, object-oriented improvements, and an integrated Blade-inspired templating system.

packagist-version-icon packagist-download-icon


⚡ Quick Start

📦 Install Phi

Install Phi via Composer with:

composer global require siguici/phi:dev-main

🎉 Try Phi

Create a hello.phi file:

Hello, $name!

Run it with:

phi run hello --name=Phi

This displays: Hello, Phi! 🎊


❓ What is 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 🔄


🔥 Why Choose Phi?

  • 🚀 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.

🌟 Features

  • 🛡️ 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.

📋 Requirements

🔹 PHP 8.4 or higher (8.4.3+ recommended)
🔹 Composer
🔹 Git
🔹 Node.js (Optional)


🚀 Installation

Install Phi from Packagist using Composer:

composer global require siguici/phi:dev-main

🛠️ Usage

Phi transpiles .phi files into .php, introducing enhanced features while maintaining PHP compatibility.

🔧 Example Command

phi source.phi

This converts source.phi into an optimized PHP file.

📝 Example Code

<?php
// Strongly-typed function in Phi
function greet<T extends string>(T $name): T {
    return "Hello, $name!";
}

echo greet("World");

🏆 Transpiled PHP Code

<?php

function greet(string $name): string {
    return "Hello, $name!";
}

echo greet("World");

?>

Phi ensures type safety at transpilation, making PHP development more robust. 🛡️


🤝 Contributing

We welcome contributions! 💖 Whether it's bug fixes, new features, or documentation improvements, feel free to contribute.

📌 How to Contribute

  1. 🍴 Fork the repository.
  2. 🌱 Create a new branch.
  3. 🛠️ Implement your changes and add tests.
  4. 📤 Submit a pull request.

Please follow our coding style and contribution guidelines. 🙌


📜 License

Phi is licensed under the MIT License. See the LICENSE.md file for details.


💬 Support & Community

For questions, issues, or feedback:

About

Phi φ is a modern superset of PHP that introduces strong typing, advanced OOP features, and a Blade-inspired templating system while maintaining full PHP compatibility.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages