Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3774946
D640.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D640.diff
View Options
diff --git a/app/Facades/Mailgun.php b/app/Facades/Mailgun.php
new file mode 100644
--- /dev/null
+++ b/app/Facades/Mailgun.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Nasqueron\Notifications\Facades;
+
+use Illuminate\Support\Facades\Facade;
+
+/**
+ * @see \Keruald\Mailgun\MailgunMessageFactory
+ */
+class Mailgun extends Facade {
+
+ /**
+ * Gets the registered name of the component.
+ *
+ * @return string
+ */
+ protected static function getFacadeAccessor() {
+ return 'mailgun';
+ }
+
+}
diff --git a/app/Providers/MailgunServiceProvider.php b/app/Providers/MailgunServiceProvider.php
new file mode 100644
--- /dev/null
+++ b/app/Providers/MailgunServiceProvider.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Nasqueron\Notifications\Providers;
+
+use Illuminate\Contracts\Foundation\Application;
+use Illuminate\Support\ServiceProvider;
+
+use GuzzleHttp\Client;
+use Keruald\Mailgun\MailgunMessageFactory;
+
+class MailgunServiceProvider extends ServiceProvider {
+ /**
+ * Bootstraps the application services.
+ *
+ * @return void
+ */
+ public function boot() {
+ }
+
+ /**
+ * Registers the application services.
+ *
+ * @return void
+ */
+ public function register() {
+ $this->app->singleton('mailgun', function (Application $app) {
+ $config = $app->make('config');
+ $key = $config->get('services.mailgun.secret');
+
+ return new MailgunMessageFactory(new Client, $key);
+ });
+ }
+}
diff --git a/composer.json b/composer.json
--- a/composer.json
+++ b/composer.json
@@ -12,8 +12,10 @@
"require": {
"php": ">=5.6.0",
"laravel/framework": "5.2.*",
+ "guzzlehttp/guzzle": "^6.2",
"keruald/github": "^0.2.0",
"keruald/broker": "^0.4.1",
+ "keruald/mailgun": "^0.0.1",
"netresearch/jsonmapper": "~0.1.0",
"sentry/sentry": "^0.13.0"
},
diff --git a/config/app.php b/config/app.php
--- a/config/app.php
+++ b/config/app.php
@@ -172,6 +172,7 @@
Nasqueron\Notifications\Providers\AppServiceProvider::class,
Nasqueron\Notifications\Providers\BrokerServiceProvider::class,
Nasqueron\Notifications\Providers\EventServiceProvider::class,
+ Nasqueron\Notifications\Providers\MailgunServiceProvider::class,
Nasqueron\Notifications\Providers\PhabricatorAPIServiceProvider::class,
Nasqueron\Notifications\Providers\PhabricatorProjectsMapServiceProvider::class,
Nasqueron\Notifications\Providers\ReportServiceProvider::class,
@@ -251,6 +252,7 @@
* App aliases...
*/
'Broker' => Nasqueron\Notifications\Facades\Broker::class,
+ 'Mailgun' => Nasqueron\Notifications\Facades\Mailgun::class,
'PhabricatorAPI' => Nasqueron\Notifications\Facades\PhabricatorAPI::class,
'ProjectsMap' => Nasqueron\Notifications\Facades\ProjectsMap::class,
'Raven' => Nasqueron\Notifications\Facades\Raven::class,
diff --git a/tests/Facades/MailgunTest.php b/tests/Facades/MailgunTest.php
new file mode 100644
--- /dev/null
+++ b/tests/Facades/MailgunTest.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Nasqueron\Notifications\Tests\Facades;
+
+use Nasqueron\Notifications\Tests\TestCase;
+
+use Config;
+use Mailgun;
+
+use Keruald\Mailgun\MailgunMessageFactory;
+
+class MailgunTest extends TestCase {
+
+ public function testIfFacadeAccessorCouldBeResolvedInAppContainer () {
+ $this->assertInstanceOf(
+ MailgunMessageFactory::class,
+ Mailgun::getFacadeRoot()
+ );
+ }
+
+}
diff --git a/tests/Providers/MailgunServiceProviderTest.php b/tests/Providers/MailgunServiceProviderTest.php
new file mode 100644
--- /dev/null
+++ b/tests/Providers/MailgunServiceProviderTest.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Nasqueron\Notifications\Tests\Providers;
+
+class MailgunServiceProviderTest extends TestCase {
+
+ public function testType () {
+ $this->assertServiceInstanceOf(
+ 'Keruald\Mailgun\MailgunMessageFactory',
+ 'mailgun'
+ );
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 15:27 (21 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2262709
Default Alt Text
D640.diff (4 KB)
Attached To
Mode
D640: Add Mailgun support
Attached
Detach File
Event Timeline
Log In to Comment