bridgetphp/bridget

This package is abandoned and no longer maintained. The author suggests using the bridget/bridget package instead.

Bridget - A modern PHP superset with strong typing and OOP enhancements


README

packagist-version-icon packagist-download-icon

Bridget is a modern PHP framework designed to enhance development with strong typing, advanced object-oriented features, and a powerful templating system inspired by Blade. πŸ’‘βœ¨

⚑ Quick Start

πŸ“¦ Install Bridget

Install Bridget via Composer with:

composer global require bridget/bridget:dev-main

πŸŽ‰ Try Bridget

Create a hello.bg file:

Hello, $name!

Run it with:

bridget run hello --name=Bridget

This displays: Hello, Bridget! 🎊

❓ What is Bridget?

Bridget 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 Bridget?

  • πŸš€ 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 Bridget from Packagist using Composer:

composer global require bridget/bridget:dev-main

πŸ› οΈ Usage

Bridget transpiles .bg files into .php, introducing enhanced features while maintaining PHP compatibility.

πŸ”§ Example Command

bridget source.bridget

This converts source.bg into an optimized PHP file.

πŸ“ Example Code

<?php
// Strongly-typed function in Bridget
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");

?>

Bridget 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

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

πŸ’¬ Support & Community

For questions, issues, or feedback: