From 72bfd6a4f0ca5a47f372c5e83ecbc08f705d9fee Mon Sep 17 00:00:00 2001 From: Patrick Stewart Date: Tue, 18 Jun 2024 16:00:33 -0700 Subject: [PATCH] update: updating readme and correcting code in application.dart add cody --- .vscode/cody.json | 10 ++ README.md | 93 ++++++++++++++++++- .../lib/src/console/application.dart | 28 +++--- 3 files changed, 116 insertions(+), 15 deletions(-) create mode 100644 .vscode/cody.json diff --git a/.vscode/cody.json b/.vscode/cody.json new file mode 100644 index 0000000..47475ee --- /dev/null +++ b/.vscode/cody.json @@ -0,0 +1,10 @@ +{ + "port": { + "prompt": "Act as a Senior Developer who is a master in PHP and Dart langauges. Port the PHP file to Dart.", + "context": { + "selection": false, + "currentFile": true + }, + "mode": "ask" + } +} \ No newline at end of file diff --git a/README.md b/README.md index 6843d6e..d7b47e7 100644 --- a/README.md +++ b/README.md @@ -1 +1,92 @@ -# framework +# Fabric Framework + +Welcome to the Fabric Framework, a comprehensive port of Laravel's Illuminate components to Dart. Fabric aims to provide a robust, scalable, and feature-rich framework for building modern web applications using Dart. + +## Overview + +Fabric is designed to mirror Laravel's Illuminate components, ensuring a familiar structure for developers accustomed to Laravel while leveraging Dart's modern language features. The framework consists of various packages that collectively offer a complete solution for web development. + +## Goals + +1. **Maintain Laravel's Structure:** Keep the directory and component structure identical to Laravel, but adhere to Dart best practices. +2. **Ensure Modularity:** Port each Illuminate component as a separate Dart package for modular usage. +3. **Enable Rapid Development:** Provide a running base application quickly to facilitate real-time testing and development. + +## Key Features + +- **Modular Packages:** Each Illuminate component is available as a standalone Dart package. +- **Comprehensive Routing:** Powerful routing capabilities inspired by Laravel. +- **Dependency Injection:** Built-in support for dependency injection to promote loose coupling. +- **Middleware Support:** Use middleware for filtering HTTP requests entering your application. +- **Authentication & Authorization:** Robust tools for user authentication and authorization. +- **Database Abstraction:** Database-agnostic query builder and ORM. +- **Queueing System:** Manage background tasks and queues. +- **Event Broadcasting:** Real-time event broadcasting for modern applications. + +## Getting Started + +### Prerequisites + +- Dart 3.0 or higher +- A basic understanding of Dart and Laravel + +### Installation + +1. **Clone the Repository:** + + ```bash + git clone https://github.com/yourusername/fabric-framework.git + cd fabric-framework + ``` + +2. **Install Dependencies:** + + ```bash + dart pub get + ``` + +### Usage + +Fabric is structured to be as familiar as possible to Laravel developers. Here’s a quick example of setting up a simple application: + +1. **Create a New Dart File:** + + ```dart + import 'package:fabric/fabric.dart'; + + void main() { + final app = Application(); + + app.get('/', (Request req) { + return Response.ok('Hello, World!'); + }); + + app.run(); + } + ``` + +2. **Run the Application:** + + ```bash + dart run + ``` + +### Documentation + +Comprehensive documentation is available to help you get started with Fabric. Visit [Fabric Documentation](https://yourdocumentationlink.com) for detailed guides, tutorials, and API references. + +## Contributing + +We welcome contributions from the community. If you’re interested in contributing, please read our [Contributing Guide](CONTRIBUTING.md) for information on how to get started. + +### Reporting Issues + +If you encounter any issues or bugs, please report them on our [Issue Tracker](https://github.com/yourusername/fabric-framework/issues). + +## License + +Fabric is open-source software licensed under the [MIT license](LICENSE). + +## Acknowledgements + +Fabric is inspired by Laravel, and we extend our gratitude to the Laravel community for their continuous efforts in building and maintaining an excellent PHP framework. diff --git a/packages/contracts/lib/src/console/application.dart b/packages/contracts/lib/src/console/application.dart index 2618481..599b8fa 100644 --- a/packages/contracts/lib/src/console/application.dart +++ b/packages/contracts/lib/src/console/application.dart @@ -1,17 +1,17 @@ -// TODO: Find dart replacements for missing imports. -class ConsoleApplication implements Application { - String _lastOutput = ''; +import 'package:symfony_console/symfony_console.dart'; - @override - int call(String command, {List parameters = const [], OutputInterface? outputBuffer}) { - // Implementation of the command execution - // Set _lastOutput with the command output for demonstration - _lastOutput = 'Command executed: $command'; - return 0; // Return appropriate exit code - } +abstract class Application { + /// Run an Artisan console command by name. + /// + /// [command] is the name of the command to run. + /// [parameters] is the list of parameters to pass to the command. + /// [outputBuffer] is the buffer to capture the command output. + /// + /// Returns the exit code of the command. + int call(String command, {List parameters = const [], OutputInterface? outputBuffer}); - @override - String output() { - return _lastOutput; - } + /// Get the output from the last command. + /// + /// Returns the output as a string. + String output(); }