-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "freebird-airlines/laravel-amqplib", | ||
"description": "Laravel wrapper for php-amqplib", | ||
"license": "MIT", | ||
"keywords": ["laravel", "lumen", "amqplib"], | ||
"authors": [ | ||
{ | ||
"name": "Tolga Boztuna", | ||
"email": "tolga.boztuna@freebirdairlines.com" | ||
} | ||
], | ||
"require": { | ||
"php-amqplib/php-amqplib": "^3.1", | ||
"illuminate/support": "^8.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.5.10" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"FreebirdAirlines\\Amqp\\": "src/FreebirdAirlines/Amqp/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"FreebirdAirlines\\Amqp\\Tests\\": "tests/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
beStrictAboutOutputDuringTests="true" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
failOnRisky="true" | ||
failOnWarning="true" | ||
processIsolation="false" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
verbose="true" | ||
> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<directory suffix=".php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace FreebirdAirlines\Amqp\Providers; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
use PhpAmqpLib\Connection\AMQPStreamConnection; | ||
|
||
class AmqpServiceProvider extends ServiceProvider | ||
{ | ||
protected $defer = true; | ||
|
||
/** | ||
* Register services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->app->singleton('Amqp', function ($app) { | ||
return new AMQPStreamConnection( | ||
config('amqp.connection.host'), | ||
config('amqp.connection.port'), | ||
config('amqp.connection.username'), | ||
config('amqp.connection.password') | ||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Bootstrap services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
|
||
} | ||
|
||
public function provides() | ||
{ | ||
return 'Amqp'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace FreebirdAirlines\Amqp\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class Amqp extends Facade | ||
{ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'Amqp'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
'connection' => [ | ||
'host' => env('AMQP_HOST', '127.0.0.1'), | ||
'port' => env('AMQP_PORT', 5672), | ||
'username' => env('AMQP_USER', 'guest'), | ||
'password' => env('AMQP_PASS', 'guest') | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace FreebirdAirlines\Amqp\Tests; | ||
|
||
|
||
use FreebirdAirlines\Amqp\AmqpServiceProvider; | ||
use GrahamCampbell\TestBench\AbstractPackageTestCase; | ||
|
||
/** | ||
* This is the abstract class. | ||
*/ | ||
abstract class AbstractTestCase extends AbstractPackageTestCase | ||
{ | ||
public function setTheApiKey() | ||
{ | ||
$this->app->config->set('amqp.apikey', 'abcdefg'); | ||
} | ||
|
||
protected function getServiceProviderClass($app) | ||
{ | ||
return AmqpServiceProvider::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace FreebirdAirlines\Amqp\Tests\Facades; | ||
|
||
|
||
use FreebirdAirlines\Amqp\Facades\Amqp; | ||
use GrahamCampbell\TestBenchCore\FacadeTrait; | ||
use FreebirdAirlines\Amqp\Tests\AbstractTestCase; | ||
|
||
class BugherdTest extends AbstractTestCase | ||
{ | ||
use FacadeTrait; | ||
|
||
/** | ||
* Get the facade accessor. | ||
* | ||
* @return string | ||
*/ | ||
protected function getFacadeAccessor() | ||
{ | ||
return 'Amqp'; | ||
} | ||
|
||
/** | ||
* Get the facade class. | ||
* | ||
* @return string | ||
*/ | ||
protected function getFacadeClass() | ||
{ | ||
return Amqp::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace FreebirdAirlines\Amqp\Tests; | ||
|
||
use PhpAmqpLib\Connection\AMQPStreamConnection; | ||
use GrahamCampbell\TestBenchCore\ServiceProviderTrait; | ||
|
||
/** | ||
* This is the servicer provider test class. | ||
*/ | ||
class ServiceProviderTest extends AbstractTestCase | ||
{ | ||
use ServiceProviderTrait; | ||
|
||
public function testAmqpConnectionIsInjectable() | ||
{ | ||
$this->assertIsInjectable(AMQPStreamConnection::class); | ||
} | ||
} |