Skip to content

Commit 48127ec

Browse files
committed
Meilleure compatibilite Sf4
1 parent 4de1650 commit 48127ec

File tree

6 files changed

+55
-57
lines changed

6 files changed

+55
-57
lines changed

.travis.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ matrix:
1414
# Minimum supported dependencies with the latest and oldest PHP version
1515
- php: 7.2
1616
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
17-
- php: 5.5
17+
- php: 5.6
1818
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
1919

2020
# Test the latest stable release
21-
- php: 5.5
2221
- php: 5.6
2322
- php: 7.0
2423
- php: 7.1
@@ -39,7 +38,7 @@ matrix:
3938
before_install:
4039
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
4140
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
42-
- composer require --no-update symfony/phpunit-bridge:^4.0 ${DEPENDENCIES}
41+
- composer require --no-update symfony/phpunit-bridge:* ${DEPENDENCIES}
4342

4443
install:
4544
# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355

README.md

+11-20
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,29 @@
66
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
77
[![Build Status](https://img.shields.io/travis/expertcoder/SwiftmailerSendGridBundle.svg?style=flat-square)](https://travis-ci.org/expertcoder/SwiftmailerSendGridBundle)
88

9-
Symfony 2/3 bundle for SendGrid. Utilizes the SendGrid PHP Library https://github.com/sendgrid/sendgrid-php
9+
Symfony bundle for SendGrid. Utilizes the SendGrid PHP Library https://github.com/sendgrid/sendgrid-php
1010
to make it compatiable with SwiftMailer.
1111

12-
## Installation Example
12+
**Older version (1.x) can be found here:** https://github.com/expertcoder/SwiftmailerSendGridBundle/tree/1.x
13+
14+
## Installation
1315

1416
`composer require expertcoder/swiftmailer-send-grid-bundle`
1517

16-
**or**
18+
**or manually**
1719

1820
*composer.json*
1921
```json
2022
"require": {
2123
...
22-
"expertcoder/swiftmailer-send-grid-bundle": "~1.0"
24+
"expertcoder/swiftmailer-send-grid-bundle": "~2.0"
2325
}
2426

2527
```
2628

29+
Applications that don't use Symfony Flex
30+
----------------------------------------
31+
2732
*AppKernel.php*
2833
```php
2934
$bundles = [
@@ -41,27 +46,13 @@ parameters:
4146
*config.yml*
4247
```yml
4348
swiftmailer:
44-
transport: expertcoder_swift_mailer.send_grid.transport
49+
transport: expertcoder_swift_mailer.send_grid
4550

4651
expert_coder_swiftmailer_send_grid:
4752
api_key: %sendgrid_api_key%
48-
categories: [my_category] # optional, will be added to all mails sent
53+
categories: [my_category] # optional, will be added to all mails sent (can be seen on sendgrid dashboard)
4954
```
50-
#### Symfony 3
5155
52-
Since Symfony 3.2, you must name the custom transport service swiftmailer.mailer.transport.< name >
53-
54-
*services.yml*
55-
```yml
56-
services:
57-
swiftmailer.mailer.transport.expertcoder_swift_mailer.send_grid.transport:
58-
alias: expertcoder_swift_mailer.send_grid.transport
59-
```
60-
*config.yml*
61-
```yml
62-
imports:
63-
- { resource: services.yml }
64-
```
6556
## Important !
6657
6758
Following RFC 1341, section 7.2, if either `text/html` or `text/plain` are to be sent in your email: `text/plain` needs to be first, followed by `text/html`, followed by any other content.

composer.json

+37-29
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
{
2-
"name": "expertcoder/swiftmailer-send-grid-bundle",
3-
"type": "symfony-bundle",
4-
"description": "Swiftmailer Transport and Symfony bundle for Sendgrid",
5-
"homepage": "https://github.com/expertcoder/SwiftmailerSendGridBundle",
6-
"license": "MIT",
7-
"authors": [
8-
{
9-
"name": "Samual Anthony",
10-
"email": "sam@expertcoder.io"
2+
"name": "expertcoder/swiftmailer-send-grid-bundle",
3+
"type": "symfony-bundle",
4+
"description": "Swiftmailer Transport and Symfony bundle for Sendgrid",
5+
"homepage": "https://github.com/expertcoder/SwiftmailerSendGridBundle",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "Samual Anthony",
10+
"email": "sam@expertcoder.io"
11+
},
12+
{
13+
"name": "Maxime Hermouet",
14+
"email": "moux2003@hotmail.com"
15+
}
16+
],
17+
"require": {
18+
"php": ">=5.6",
19+
"sendgrid/sendgrid": "^7.0",
20+
"symfony/swiftmailer-bundle": "~3.2"
1121
},
12-
{
13-
"name": "Maxime Hermouet",
14-
"email": "moux2003@hotmail.com"
22+
"require-dev": {
23+
"nyholm/symfony-bundle-test": "^1.3"
24+
},
25+
"extra": {
26+
"branch-alias": {
27+
"dev-master": "2.0.x-dev"
28+
}
29+
},
30+
"autoload": {
31+
"psr-4": {
32+
"ExpertCoder\\Swiftmailer\\SendGridBundle\\": "src/"
33+
}
34+
},
35+
"autoload-dev": {
36+
"psr-4": {
37+
"ExpertCoder\\Swiftmailer\\SendGridBundle\\Tests\\": "tests/"
38+
}
1539
}
16-
],
17-
"require": {
18-
"php": ">=5.4",
19-
"symfony/symfony": "~2.7|~3.3|~4.0",
20-
"swiftmailer/swiftmailer": ">=4.2.0,<6.0.0",
21-
"sendgrid/sendgrid": "^5.0"
22-
},
23-
"autoload": {
24-
"psr-4": { "ExpertCoder\\Swiftmailer\\SendGridBundle\\": "src/" }
25-
},
26-
"autoload-dev": {
27-
"psr-4": { "ExpertCoder\\Swiftmailer\\SendGridBundle\\Tests\\": "tests/"}
28-
},
29-
"require-dev": {
30-
"nyholm/symfony-bundle-test": "^1.3"
31-
}
32-
}
40+
}

src/Resources/config/services.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<services>
88
<service
9-
id="expertcoder_swift_mailer.send_grid.transport"
9+
id="swiftmailer.mailer.transport.expertcoder_swift_mailer.send_grid"
1010
class="ExpertCoder\Swiftmailer\SendGridBundle\Services\SendGridTransport" >
1111
<argument>%expertcoder_swiftmailer_sendgrid.api_key%</argument>
1212
<argument>%expertcoder_swiftmailer_sendgrid.categories%</argument>

tests/BundleInitializationTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected function setUp()
1919
parent::setUp();
2020

2121
// Make services public that have an idea that matches a regex
22-
$this->addCompilerPass(new PublicServicePass('|expertcoder_swift_mailer.*|'));
22+
$this->addCompilerPass(new PublicServicePass('|swiftmailer.mailer.transport.expertcoder_swift_mailer.*|'));
2323
}
2424

2525
public function testInitBundle()
@@ -37,8 +37,8 @@ public function testInitBundle()
3737
$container = $this->getContainer();
3838

3939
// Test if services exists
40-
$this->assertTrue($container->has('expertcoder_swift_mailer.send_grid.transport'));
41-
$service = $container->get('expertcoder_swift_mailer.send_grid.transport');
40+
$this->assertTrue($container->has('swiftmailer.mailer.transport.expertcoder_swift_mailer.send_grid'));
41+
$service = $container->get('swiftmailer.mailer.transport.expertcoder_swift_mailer.send_grid');
4242
$this->assertInstanceOf(SendGridTransport::class, $service);
4343

4444
// Test if parameters exists

tests/manual-test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [ $# -eq 0 ] # check if argument exists
88
exit 0;
99
fi
1010

11-
composer require --dev --no-update symfony/phpunit-bridge:^4.0 dunglas/symfony-lock:^$1
11+
composer require --dev --no-update symfony/phpunit-bridge:* dunglas/symfony-lock:^$1
1212
composer update --prefer-dist --no-interaction --prefer-stable --quiet
1313
composer update --prefer-stable --prefer-lowest --prefer-dist --no-interaction
1414
./vendor/bin/simple-phpunit install

0 commit comments

Comments
 (0)