Skip to content

Commit bded9b6

Browse files
Merge pull request #79 from mailjet/DE-1277-laravel-mailjet-missing-symfony-http-client-dependency
Laravel package improvements.
2 parents 572a827 + ddd733b commit bded9b6

20 files changed

+406
-200
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ Please also set your email from address and name.
2929
]
3030
```
3131

32+
## Laravel 11.0+
33+
In the file `example-app/bootstrap/providers.php`
34+
```php
35+
use Mailjet\LaravelMailjet\MailjetServiceProvider;
36+
37+
return [
38+
App\Providers\AppServiceProvider::class,
39+
MailjetServiceProvider::class,
40+
];
41+
````
42+
3243
* In the aliases array:
3344

3445
```php
@@ -128,7 +139,3 @@ public function handle(ContactsV4Service $contactsV4Service)
128139
...
129140
}
130141
```
131-
132-
## ToDo
133-
134-
* Add additional unit tests to increase code coverage.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
],
3232
"require": {
3333
"php": "^7.1.3|^8.0",
34-
"laravel/framework": "~5.1|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
34+
"laravel/framework": "^9.0|^10.0|^11.0",
3535
"mailjet/mailjet-apiv3-php": "^1.5.6|^1.5",
36+
"symfony/http-client": "^7.1",
3637
"symfony/mailjet-mailer": "^6.0"
3738
},
3839
"require-dev": {

src/Contracts/CampaignContract.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,28 @@
88

99
interface CampaignContract
1010
{
11-
public function getAllCampaigns(array $filters = null);
11+
/**
12+
* @param array|null $filters
13+
* @return array
14+
*/
15+
public function getAllCampaigns(array $filters = null): array;
1216

13-
public function findByCampaignId(string $id);
17+
/**
18+
* @param string $id
19+
* @return array
20+
*/
21+
public function findByCampaignId(string $id): array;
1422

15-
public function findByNewsletterId(string $id);
23+
/**
24+
* @param string $id
25+
* @return array
26+
*/
27+
public function findByNewsletterId(string $id): array;
1628

17-
public function updateCampaign(string $id, Campaign $campaign);
29+
/**
30+
* @param string $id
31+
* @param Campaign $campaign
32+
* @return array
33+
*/
34+
public function updateCampaign(string $id, Campaign $campaign): array;
1835
}

src/Contracts/CampaignDraftContract.php

Lines changed: 82 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,86 @@
88

99
interface CampaignDraftContract
1010
{
11-
public function getAllCampaignDrafts(array $filters = null);
12-
13-
public function findByCampaignDraftId(string $id);
14-
15-
public function create(CampaignDraft $campaignDraft);
16-
17-
public function update(string $id, CampaignDraft $campaignDraft);
18-
19-
public function getDetailContent(string $id);
20-
21-
public function createDetailContent(string $id, array $content);
22-
23-
public function getSchedule(string $id);
24-
25-
public function scheduleCampaign(string $id, string $date);
26-
27-
public function updateCampaignSchedule(string $id, string $date);
28-
29-
public function removeSchedule(string $id);
30-
31-
public function sendCampaign(string $id);
32-
33-
public function testCampaign(string $id, array $recipients);
34-
35-
public function getCampaignStatus(string $id);
11+
/**
12+
* @param array|null $filters
13+
* @return array
14+
*/
15+
public function getAllCampaignDrafts(array $filters = null): array;
16+
17+
/**
18+
* @param string $id
19+
* @return array
20+
*/
21+
public function findByCampaignDraftId(string $id): array;
22+
23+
/**
24+
* @param CampaignDraft $campaignDraft
25+
* @return array
26+
*/
27+
public function create(CampaignDraft $campaignDraft): array;
28+
29+
/**
30+
* @param string $id
31+
* @param CampaignDraft $campaignDraft
32+
* @return array
33+
*/
34+
public function update(string $id, CampaignDraft $campaignDraft): array;
35+
36+
/**
37+
* @param string $id
38+
* @return array
39+
*/
40+
public function getDetailContent(string $id): array;
41+
42+
/**
43+
* @param string $id
44+
* @param array $content
45+
* @return array
46+
*/
47+
public function createDetailContent(string $id, array $content): array;
48+
49+
/**
50+
* @param string $id
51+
* @return array
52+
*/
53+
public function getSchedule(string $id): array;
54+
55+
/**
56+
* @param string $id
57+
* @param string $date
58+
* @return array
59+
*/
60+
public function scheduleCampaign(string $id, string $date): array;
61+
62+
/**
63+
* @param string $id
64+
* @param string $date
65+
* @return array
66+
*/
67+
public function updateCampaignSchedule(string $id, string $date): array;
68+
69+
/**
70+
* @param string $id
71+
* @return array
72+
*/
73+
public function removeSchedule(string $id): array;
74+
75+
/**
76+
* @param string $id
77+
* @return array
78+
*/
79+
public function sendCampaign(string $id): array;
80+
81+
/**
82+
* @param string $id
83+
* @param array $recipients
84+
* @return array
85+
*/
86+
public function testCampaign(string $id, array $recipients): array;
87+
88+
/**
89+
* @param string $id
90+
* @return array
91+
*/
92+
public function getCampaignStatus(string $id): array;
3693
}

src/Contracts/ContactMetadataContract.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,33 @@
88

99
interface ContactMetadataContract
1010
{
11-
public function getAll();
12-
13-
public function get(string $id);
14-
15-
public function create(ContactMetadata $metadata);
16-
17-
public function update(string $id, ContactMetadata $metadata);
18-
19-
public function delete(string $id);
11+
/**
12+
* @return array
13+
*/
14+
public function getAll(): array;
15+
16+
/**
17+
* @param string $id
18+
* @return array
19+
*/
20+
public function get(string $id): array;
21+
22+
/**
23+
* @param ContactMetadata $metadata
24+
* @return array
25+
*/
26+
public function create(ContactMetadata $metadata): array;
27+
28+
/**
29+
* @param string $id
30+
* @param ContactMetadata $metadata
31+
* @return array
32+
*/
33+
public function update(string $id, ContactMetadata $metadata): array;
34+
35+
/**
36+
* @param string $id
37+
* @return array
38+
*/
39+
public function delete(string $id): array;
2040
}

src/Contracts/ContactsListContract.php

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,55 @@
99

1010
interface ContactsListContract
1111
{
12-
public function create(string $id, Contact $contact, $action = Contact::ACTION_ADDFORCE): array;
13-
14-
public function update(string $id, Contact $contact, $action = Contact::ACTION_ADDNOFORCE): array;
15-
12+
/**
13+
* @param string $id
14+
* @param Contact $contact
15+
* @param string $action
16+
* @return array
17+
*/
18+
public function create(string $id, Contact $contact, string $action = Contact::ACTION_ADDFORCE): array;
19+
20+
/**
21+
* @param string $id
22+
* @param Contact $contact
23+
* @param string $action
24+
* @return array
25+
*/
26+
public function update(string $id, Contact $contact, string $action = Contact::ACTION_ADDNOFORCE): array;
27+
28+
/**
29+
* @param string $id
30+
* @param Contact $contact
31+
* @param bool $force
32+
* @return array
33+
*/
1634
public function subscribe(string $id, Contact $contact, bool $force = true): array;
1735

36+
/**
37+
* @param string $id
38+
* @param Contact $contact
39+
* @return array
40+
*/
1841
public function unsubscribe(string $id, Contact $contact): array;
1942

43+
/**
44+
* @param string $id
45+
* @param Contact $contact
46+
* @return array
47+
*/
2048
public function delete(string $id, Contact $contact): array;
2149

50+
/**
51+
* @param string $id
52+
* @param Contact $contact
53+
* @param string $oldEmail
54+
* @return array
55+
*/
2256
public function updateEmail(string $id, Contact $contact, string $oldEmail): array;
2357

58+
/**
59+
* @param ContactsList $list
60+
* @return array
61+
*/
2462
public function uploadManyContactsList(ContactsList $list): array;
2563
}

src/Contracts/ContactsV4Contract.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@
99

1010
interface ContactsV4Contract
1111
{
12-
public function delete($id);
13-
}
12+
/**
13+
* @param int $id
14+
* @return bool
15+
*/
16+
public function delete(int $id): bool;
17+
}

src/Contracts/EventCallbackUrlContract.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,33 @@
88

99
interface EventCallbackUrlContract
1010
{
11+
/**
12+
* @return array
13+
*/
1114
public function getAll(): array;
1215

16+
/**
17+
* @param string $id
18+
* @return array
19+
*/
1320
public function get(string $id): array;
1421

22+
/**
23+
* @param EventCallbackUrl $url
24+
* @return array
25+
*/
1526
public function create(EventCallbackUrl $url): array;
1627

28+
/**
29+
* @param string $id
30+
* @param EventCallbackUrl $url
31+
* @return array
32+
*/
1733
public function update(string $id, EventCallbackUrl $url): array;
1834

35+
/**
36+
* @param string $id
37+
* @return array
38+
*/
1939
public function delete(string $id): array;
2040
}

src/Contracts/MailjetServiceContract.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,40 @@
99

1010
interface MailjetServiceContract
1111
{
12+
/**
13+
* @param array $resource
14+
* @param array $args
15+
* @param array $options
16+
* @return Response
17+
*/
1218
public function post(array $resource, array $args = [], array $options = []): Response;
1319

20+
/**
21+
* @param array $resource
22+
* @param array $args
23+
* @param array $options
24+
* @return Response
25+
*/
1426
public function get(array $resource, array $args = [], array $options = []): Response;
1527

28+
/**
29+
* @param array $resource
30+
* @param array $args
31+
* @param array $options
32+
* @return Response
33+
*/
1634
public function put(array $resource, array $args = [], array $options = []): Response;
1735

36+
/**
37+
* @param array $resource
38+
* @param array $args
39+
* @param array $options
40+
* @return Response
41+
*/
1842
public function delete(array $resource, array $args = [], array $options = []): Response;
1943

44+
/**
45+
* @return Client
46+
*/
2047
public function getClient(): Client;
2148
}

0 commit comments

Comments
 (0)