├── LICENSE ├── composer.json ├── config └── notifyme.php └── src ├── Facades └── NotifyMe.php ├── NotifyMeManager.php └── NotifyMeServiceProvider.php /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2016 Alt Three Services Limited 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "notifymehq/laravel", 3 | "description": "Provides a laravel bridge for notifyme", 4 | "license": "MIT", 5 | "keywords": ["notifymehq", "notifyme", "laravel"], 6 | "authors": [ 7 | { 8 | "name": "James Brooks", 9 | "email": "james@alt-three.com" 10 | }, 11 | { 12 | "name": "Graham Campbell", 13 | "email": "graham@alt-three.com" 14 | }, 15 | { 16 | "name": "Joseph Cohen", 17 | "email": "joe@alt-three.com" 18 | } 19 | ], 20 | "require": { 21 | "php": ">=5.5.9", 22 | "graham-campbell/manager": "^2.3", 23 | "illuminate/contracts": "5.1.*|5.2.*|5.3.*", 24 | "illuminate/support": "5.1.*|5.2.*|5.3.*", 25 | "notifymehq/contracts": "^1.0", 26 | "notifymehq/factory": "^1.0" 27 | }, 28 | "require-dev": { 29 | "graham-campbell/testbench": "^3.1", 30 | "phpunit/phpunit": "^4.8|^5.0" 31 | }, 32 | "autoload": { 33 | "psr-4": { 34 | "NotifyMeHQ\\Laravel\\": "src/" 35 | } 36 | }, 37 | "autoload-dev": { 38 | "psr-4": { 39 | "NotifyMeHQ\\Tests\\Laravel\\": "tests/" 40 | } 41 | }, 42 | "config": { 43 | "preferred-install": "dist" 44 | }, 45 | "extra": { 46 | "branch-alias": { 47 | "dev-master": "1.0-dev" 48 | } 49 | }, 50 | "minimum-stability": "dev", 51 | "prefer-stable": true 52 | } 53 | -------------------------------------------------------------------------------- /config/notifyme.php: -------------------------------------------------------------------------------- 1 | 'webhook', 26 | 27 | /* 28 | |-------------------------------------------------------------------------- 29 | | NotifyMe Connections 30 | |-------------------------------------------------------------------------- 31 | | 32 | | Here are each of the connections setup for your application. Examples of 33 | | configuring each supported driver is shown below. You can of course have 34 | | multiple connections per driver (gateway). 35 | | 36 | */ 37 | 38 | 'connections' => [ 39 | 40 | 'campfire' => [ 41 | 'driver' => 'campfire', 42 | 'from' => 'notifyme', 43 | 'token' => 'your-token', 44 | ], 45 | 46 | 'gitter' => [ 47 | 'driver' => 'gitter', 48 | 'token' => 'your-token', 49 | ], 50 | 51 | 'hipchat' => [ 52 | 'driver' => 'hipchat', 53 | 'from' => 'notifyme', 54 | 'token' => 'your-token', 55 | ], 56 | 57 | 'pagerduty' => [ 58 | 'driver' => 'pagerduty', 59 | 'token' => 'your-token', 60 | ], 61 | 62 | 'pushover' => [ 63 | 'driver' => 'pushover', 64 | 'token' => 'your-token', 65 | ], 66 | 67 | 'slack' => [ 68 | 'driver' => 'slack', 69 | 'from' => 'notifyme', 70 | 'token' => 'your-token', 71 | 'as_user' => true, 72 | ], 73 | 74 | 'twilio' => [ 75 | 'driver' => 'twilio', 76 | 'from' => 'your-phone', 77 | 'client' => 'your-id', 78 | 'token' => 'your-token', 79 | ], 80 | 81 | 'webhook' => [ 82 | 'driver' => 'webhook', 83 | 'endpoint' => 'https://example.com/notify', 84 | ], 85 | 86 | 'yo' => [ 87 | 'driver' => 'yo', 88 | 'token' => 'your-token', 89 | ], 90 | 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /src/Facades/NotifyMe.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | class NotifyMe extends Facade 22 | { 23 | /** 24 | * Get the registered name of the component. 25 | * 26 | * @return string 27 | */ 28 | protected static function getFacadeAccessor() 29 | { 30 | return 'notifyme'; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/NotifyMeManager.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | class NotifyMeManager extends AbstractManager implements ManagerInterface 25 | { 26 | /** 27 | * The factory instance. 28 | * 29 | * @var \NotifyMeHQ\Contracts\FactoryInterface 30 | */ 31 | protected $factory; 32 | 33 | /** 34 | * Create a new notifyme manager instance. 35 | * 36 | * @param \Illuminate\Contracts\Config\Repository $config 37 | * @param \NotifyMeHQ\Contracts\FactoryInterface $factory 38 | * 39 | * @return void 40 | */ 41 | public function __construct(Repository $config, FactoryInterface $factory) 42 | { 43 | parent::__construct($config); 44 | 45 | $this->factory = $factory; 46 | } 47 | 48 | /** 49 | * Create the connection instance. 50 | * 51 | * @param string[] $config 52 | * 53 | * @return \NotifyMeHQ\Contracts\GatewayInterface 54 | */ 55 | protected function createConnection(array $config) 56 | { 57 | return $this->factory->make($config); 58 | } 59 | 60 | /** 61 | * Get the configuration name. 62 | * 63 | * @return string 64 | */ 65 | protected function getConfigName() 66 | { 67 | return 'notifyme'; 68 | } 69 | 70 | /** 71 | * Get the factory instance. 72 | * 73 | * @return \NotifyMeHQ\Contracts\FactoryInterface 74 | */ 75 | public function getFactory() 76 | { 77 | return $this->factory; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/NotifyMeServiceProvider.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | class NotifyMeServiceProvider extends ServiceProvider 25 | { 26 | /** 27 | * Boot the service provider. 28 | * 29 | * @return void 30 | */ 31 | public function boot() 32 | { 33 | $this->setupConfig(); 34 | } 35 | 36 | /** 37 | * Register the service provider. 38 | * 39 | * @return void 40 | */ 41 | public function register() 42 | { 43 | $this->registerFactory(); 44 | $this->registerManager(); 45 | } 46 | 47 | /** 48 | * Setup the config. 49 | * 50 | * @return void 51 | */ 52 | protected function setupConfig() 53 | { 54 | $source = realpath(__DIR__.'/../config/notifyme.php'); 55 | 56 | if (class_exists('Illuminate\Foundation\Application', false)) { 57 | $this->publishes([$source => config_path('notifyme.php')]); 58 | } 59 | 60 | $this->mergeConfigFrom($source, 'notifyme'); 61 | } 62 | 63 | /** 64 | * Register the factory class. 65 | * 66 | * @return void 67 | */ 68 | protected function registerFactory() 69 | { 70 | $this->app->singleton('notifyme.factory', function () { 71 | return new NotifyMeFactory(); 72 | }); 73 | 74 | $this->app->alias('notifyme.factory', NotifyMeFactory::class); 75 | $this->app->alias('notifyme.factory', FactoryInterface::class); 76 | } 77 | 78 | /** 79 | * Register the manager class. 80 | * 81 | * @return void 82 | */ 83 | protected function registerManager() 84 | { 85 | $this->app->singleton('notifyme', function ($app) { 86 | $config = $app['config']; 87 | $factory = $app['notifyme.factory']; 88 | 89 | return new NotifyMeManager($config, $factory); 90 | }); 91 | 92 | $this->app->alias('notifyme', NotifyMeManager::class); 93 | $this->app->alias('notifyme', ManagerInterface::class); 94 | } 95 | 96 | /** 97 | * Get the services provided by the provider. 98 | * 99 | * @return string[] 100 | */ 101 | public function provides() 102 | { 103 | return [ 104 | 'notifyme.factory', 105 | 'notifyme', 106 | ]; 107 | } 108 | } 109 | --------------------------------------------------------------------------------