Skip to content

Commit

Permalink
Renamed old names
Browse files Browse the repository at this point in the history
  • Loading branch information
emredipi committed Feb 22, 2024
1 parent b36c94c commit 96f82bc
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 52 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ return [
## Usage

```php
$webhookRelayer = new Moneo\WebhookRelayer();
echo $webhookRelayer->echoPhrase('Hello, Moneo!');
$requestForwarder = new Moneo\RequestForwarder();
echo $requestForwarder->echoPhrase('Hello, Moneo!');
```

## Testing
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
},
"autoload": {
"psr-4": {
"Moneo\\WebhookRelayer\\": "src/"
"Moneo\\RequestForwarder\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Moneo\\WebhookRelayer\\Tests\\": "tests/",
"Moneo\\RequestForwarder\\Tests\\": "tests/",
"Workbench\\App\\": "workbench/app/"
}
},
Expand Down Expand Up @@ -72,10 +72,10 @@
"extra": {
"laravel": {
"providers": [
"Moneo\\WebhookRelayer\\WebhookRelayerServiceProvider"
"Moneo\\RequestForwarder\\RequestForwarderServiceProvider"
],
"aliases": {
"WebhookRelayer": "Moneo\\WebhookRelayer\\Facades\\WebhookRelayer"
"RequestForwarder": "Moneo\\RequestForwarder\\Facades\\RequestForwarder"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions config/webhook-relayer.php → config/request-forwarder.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

// config for Moneo/WebhookRelayer
// config for Moneo/RequestForwarder
return [
'webhooks' => [
[
Expand All @@ -10,7 +10,7 @@
[
'url' => 'https://discord.com/api/webhooks/1209955556656291860/LAaczT-Pg785d5OzBmi6ivx2Vl7wAoruOwcVnZpb2eE2x8tf7fMi6R7_sr0IV0WoK83S',
'method' => 'POST',
'provider' => \Moneo\WebhookRelayer\Providers\Discord::class,
'provider' => \Moneo\RequestForwarder\Providers\Discord::class,
],
],
];
16 changes: 16 additions & 0 deletions src/Facades/RequestForwarder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Moneo\RequestForwarder\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @see \Moneo\RequestForwarder\RequestForwarder
*/
class RequestForwarder extends Facade
{
protected static function getFacadeAccessor()
{
return \Moneo\RequestForwarder\RequestForwarder::class;
}
}
16 changes: 0 additions & 16 deletions src/Facades/WebhookRelayer.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace Moneo\WebhookRelayer;
namespace Moneo\RequestForwarder;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class ProcessWebhookRelayer implements ShouldQueue
class ProcessRequestForwarder implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

Expand All @@ -26,7 +26,7 @@ public function __construct(
*/
public function handle(): void
{
$webhookRelayer = app(WebhookRelayer::class);
$webhookRelayer->triggerHooks($this->url, $this->params);
$requestForwarder = app(RequestForwarder::class);
$requestForwarder->triggerHooks($this->url, $this->params);
}
}
2 changes: 1 addition & 1 deletion src/Providers/DefaultProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Moneo\WebhookRelayer\Providers;
namespace Moneo\RequestForwarder\Providers;

use Illuminate\Http\Client\Factory;

Expand Down
2 changes: 1 addition & 1 deletion src/Providers/Discord.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Moneo\WebhookRelayer\Providers;
namespace Moneo\RequestForwarder\Providers;

use Illuminate\Http\Client\Factory;

Expand Down
2 changes: 1 addition & 1 deletion src/Providers/ProviderInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Moneo\WebhookRelayer\Providers;
namespace Moneo\RequestForwarder\Providers;

use Illuminate\Http\Client\Factory;

Expand Down
10 changes: 5 additions & 5 deletions src/WebhookRelayer.php → src/RequestForwarder.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace Moneo\WebhookRelayer;
namespace Moneo\RequestForwarder;

use Illuminate\Http\Client\Factory;
use Illuminate\Http\Request;
use Moneo\WebhookRelayer\Providers\DefaultProvider;
use Moneo\WebhookRelayer\Providers\ProviderInterface;
use Moneo\RequestForwarder\Providers\DefaultProvider;
use Moneo\RequestForwarder\Providers\ProviderInterface;

class WebhookRelayer
class RequestForwarder
{
public function __construct(
private readonly Factory $client,
Expand All @@ -17,7 +17,7 @@ public function __construct(

public function sendAsync(Request $request)
{
ProcessWebhookRelayer::dispatch($request->url(), $request->toArray());
ProcessRequestForwarder::dispatch($request->url(), $request->toArray());
}

public function triggerHooks(string $url, array $params)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace Moneo\WebhookRelayer;
namespace Moneo\RequestForwarder;

use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class WebhookRelayerMiddleware
class RequestForwarderMiddleware
{
public function __construct(
public readonly WebhookRelayer $webhookRelayer,
public readonly RequestForwarder $requestForwarder,
) {
}

Expand All @@ -20,7 +20,7 @@ public function __construct(
*/
public function handle(Request $request, Closure $next): Response
{
$this->webhookRelayer->sendAsync($request);
$this->requestForwarder->sendAsync($request);

return $next($request);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Moneo\WebhookRelayer;
namespace Moneo\RequestForwarder;

use Illuminate\Http\Client\Factory;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class WebhookRelayerServiceProvider extends PackageServiceProvider
class RequestForwarderServiceProvider extends PackageServiceProvider
{
public function configurePackage(Package $package): void
{
Expand All @@ -22,14 +22,14 @@ public function configurePackage(Package $package): void

public function registeringPackage()
{
$this->app->bind('laravel_webhook_relayer.client', function ($app): Factory {
$this->app->bind('laravel_request_forwarder.client', function ($app): Factory {
return $app[Factory::class];
});

$this->app->singleton(WebhookRelayer::class, function ($app): WebhookRelayer {
return new WebhookRelayer(
$app->make('laravel_webhook_relayer.client'),
config('webhook-relayer.webhooks'),
$this->app->singleton(RequestForwarder::class, function ($app): RequestForwarder {
return new RequestForwarder(
$app->make('laravel_request_forwarder.client'),
config('request-forwarder.webhooks'),
);
});
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

use Moneo\WebhookRelayer\Tests\TestCase;
use Moneo\RequestForwarder\Tests\TestCase;

uses(TestCase::class)->in(__DIR__);
8 changes: 4 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Moneo\WebhookRelayer\Tests;
namespace Moneo\RequestForwarder\Tests;

use Illuminate\Database\Eloquent\Factories\Factory;
use Moneo\WebhookRelayer\WebhookRelayerServiceProvider;
use Moneo\RequestForwarder\RequestForwarderServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;

class TestCase extends Orchestra
Expand All @@ -13,14 +13,14 @@ protected function setUp(): void
parent::setUp();

Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'Moneo\\WebhookRelayer\\Database\\Factories\\'.class_basename($modelName).'Factory'
fn (string $modelName) => 'Moneo\\RequestForwarder\\Database\\Factories\\'.class_basename($modelName).'Factory'
);
}

protected function getPackageProviders($app)
{
return [
WebhookRelayerServiceProvider::class,
RequestForwarderServiceProvider::class,
];
}

Expand Down

0 comments on commit 96f82bc

Please sign in to comment.