Skip to content
This repository was archived by the owner on Jan 18, 2018. It is now read-only.

Commit 9c2e314

Browse files
Initial commit
0 parents  commit 9c2e314

6 files changed

+236
-0
lines changed

FactoryInterface.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
/*
4+
* This file is part of NotifyMe.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace NotifyMeHQ\Contracts;
13+
14+
interface FactoryInterface
15+
{
16+
/**
17+
* Create a new gateway instance.
18+
*
19+
* @param string[] $config
20+
*
21+
* @return \NotifyMeHQ\Contracts\GatewayInterface
22+
*/
23+
public function make(array $config);
24+
}

GatewayInterface.php

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of NotifyMe.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace NotifyMeHQ\Contracts;
13+
14+
interface GatewayInterface
15+
{
16+
/**
17+
* Send a notification.
18+
*
19+
* @param string $to
20+
* @param string $message
21+
*
22+
* @return \NotifyMeHQ\Contracts\ResponseInterface
23+
*/
24+
public function notify($to, $message);
25+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 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.

ManagerInterface.php

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
3+
/*
4+
* This file is part of NotifyMe.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace NotifyMeHQ\Contracts;
13+
14+
interface ManagerInterface
15+
{
16+
/**
17+
* Get a connection instance.
18+
*
19+
* @param string|null $name
20+
*
21+
* @return \NotifyMeHQ\Contracts\GatewayInterface
22+
*/
23+
public function connection($name = null);
24+
25+
/**
26+
* Reconnect to the given connection.
27+
*
28+
* @param string|null $name
29+
*
30+
* @return \NotifyMeHQ\Contracts\GatewayInterface
31+
*/
32+
public function reconnect($name = null);
33+
34+
/**
35+
* Disconnect from the given connection.
36+
*
37+
* @param string|null $name
38+
*
39+
* @return void
40+
*/
41+
public function disconnect($name = null);
42+
43+
/**
44+
* Get the configuration for a connection.
45+
*
46+
* @param string $name
47+
*
48+
* @return array
49+
*/
50+
public function getConnectionConfig($name);
51+
52+
/**
53+
* Get the default connection name.
54+
*
55+
* @return string
56+
*/
57+
public function getDefaultConnection();
58+
59+
/**
60+
* Set the default connection name.
61+
*
62+
* @param string $name
63+
*
64+
* @return void
65+
*/
66+
public function setDefaultConnection($name);
67+
68+
/**
69+
* Return all of the created connections.
70+
*
71+
* @return \NotifyMeHQ\Contracts\GatewayInterface[]
72+
*/
73+
public function getConnections();
74+
}

ResponseInterface.php

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
/*
4+
* This file is part of NotifyMe.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace NotifyMeHQ\Contracts;
13+
14+
interface ResponseInterface
15+
{
16+
/**
17+
* Determine if the message has been sent by the gateway.
18+
*
19+
* @return bool
20+
*/
21+
public function isSent();
22+
23+
/**
24+
* Get the response message from the gateway.
25+
*
26+
* @return string
27+
*/
28+
public function message();
29+
30+
/**
31+
* Get the raw data from the gateway.
32+
*
33+
* @return array
34+
*/
35+
public function raw();
36+
37+
/**
38+
* Set the raw response array from the gateway.
39+
*
40+
* @param array $response
41+
*
42+
* @return \NotifyMeHQ\Contracts\ResponseInterface
43+
*/
44+
public function setRaw(array $response);
45+
46+
/**
47+
* Map the given array onto the response's properties.
48+
*
49+
* @param array $attributes
50+
*
51+
* @return \NotifyMeHQ\Contracts\ResponseInterface
52+
*/
53+
public function map(array $attributes);
54+
}

composer.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "notifymehq/contracts",
3+
"description": "Provides a common interface for notification services",
4+
"license": "MIT",
5+
"keywords": ["notifymehq", "notifyme", "notifications", "integrations"],
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+
},
23+
"autoload": {
24+
"psr-4": {
25+
"NotifyMeHQ\\Contracts\\": ""
26+
}
27+
},
28+
"config": {
29+
"preferred-install": "dist"
30+
},
31+
"extra": {
32+
"branch-alias": {
33+
"dev-master": "1.0-dev"
34+
}
35+
},
36+
"minimum-stability": "dev",
37+
"prefer-stable": true
38+
}

0 commit comments

Comments
 (0)