bridgetphp / bridget
Bridget - A modern PHP superset with strong typing and OOP enhancements
Requires
- php: ^8.4
- ext-readline: *
Requires (Dev)
- siguici/php-devtools: ^1.1
This package is not auto-updated.
Last update: 2025-02-24 14:33:08 UTC
README
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
- π΄ 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. π
π License
Bridget is licensed under the MIT License. See the LICENSE.md file for details.
π¬ Support & Community
For questions, issues, or feedback:
- π Open an issue
- π¬ Join our discussions