Skip to content

Commit

Permalink
Created Facade and registered in composer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
MaestroError committed Feb 27, 2024
1 parent 885ca2d commit 0c2d9fc
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ✔️

Expand Down
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,15 @@
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
"providers": [
"Maestroerror\\EloquentRegex\\EloquentRegexServiceProvider"
],
"aliases": {
"EloquentRegex": "Maestroerror\\EloquentRegex\\Facades\\EloquentRegex"
}
}
}
}
20 changes: 20 additions & 0 deletions src/EloquentRegexServiceProvider .php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Maestroerror\EloquentRegex;

use Illuminate\Support\ServiceProvider;

class EloquentRegexServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton('eloquentregex', function ($app) {
return new \Maestroerror\EloquentRegex\EloquentRegex();
});
}

public function boot()
{
// booting code
}
}
18 changes: 18 additions & 0 deletions src/Facades/EloquentRegex.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Maestroerror\EloquentRegex\Facades;

use Illuminate\Support\Facades\Facade;

class EloquentRegex extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'eloquentregex';
}
}

0 comments on commit 0c2d9fc

Please sign in to comment.