From 0c2d9fc8ff1daf70713408fa55a5624897ee3089 Mon Sep 17 00:00:00 2001 From: maestroerror Date: Tue, 27 Feb 2024 17:34:23 +0400 Subject: [PATCH] Created Facade and registered in composer.json --- README.md | 8 ++++---- composer.json | 10 ++++++++++ src/EloquentRegexServiceProvider .php | 20 ++++++++++++++++++++ src/Facades/EloquentRegex.php | 18 ++++++++++++++++++ 4 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 src/EloquentRegexServiceProvider .php create mode 100644 src/Facades/EloquentRegex.php diff --git a/README.md b/README.md index 3ac2c03..a324c79 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,10 @@ Examples: `->exact("hello world", false, "1+")` - Remove need for "end" method in BuilderPattern ✔️ - Add Dockblocs and comments for new methods ✔️ -- Add facade for Laravel -- Wrap Builder in class for static start - - "string" and "source" for builder start✔️ - - "start" and "pattern" for builderPattern start✔️ +- Add facade for Laravel ✔️ +- Wrap Builder in class for static start ✔️ + - "string" and "source" for builder start ✔️ + - "start" and "pattern" for builderPattern start ✔️ - Write documentation (add credit for https://regexr.com/ and ChatGPT) - Add automated tests on PR creation or on marging to main branch ✔️ diff --git a/composer.json b/composer.json index 455e7a7..ecab9cd 100644 --- a/composer.json +++ b/composer.json @@ -22,5 +22,15 @@ "allow-plugins": { "pestphp/pest-plugin": true } + }, + "extra": { + "laravel": { + "providers": [ + "Maestroerror\\EloquentRegex\\EloquentRegexServiceProvider" + ], + "aliases": { + "EloquentRegex": "Maestroerror\\EloquentRegex\\Facades\\EloquentRegex" + } + } } } diff --git a/src/EloquentRegexServiceProvider .php b/src/EloquentRegexServiceProvider .php new file mode 100644 index 0000000..b05760a --- /dev/null +++ b/src/EloquentRegexServiceProvider .php @@ -0,0 +1,20 @@ +app->singleton('eloquentregex', function ($app) { + return new \Maestroerror\EloquentRegex\EloquentRegex(); + }); + } + + public function boot() + { + // booting code + } +} diff --git a/src/Facades/EloquentRegex.php b/src/Facades/EloquentRegex.php new file mode 100644 index 0000000..b26fbe8 --- /dev/null +++ b/src/Facades/EloquentRegex.php @@ -0,0 +1,18 @@ +