Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Laravel with SendGrid
Search
s-ichikawa
June 16, 2016
Programming
0
2.8k
Laravel with SendGrid
Laravel勉強会 2016/6/17 発表資料
s-ichikawa
June 16, 2016
Tweet
Share
More Decks by s-ichikawa
See All by s-ichikawa
15分で分かった気になるGraphQL
ichikawa
3
3.1k
GraphQL入門
ichikawa
3
1.1k
ReactPHPとの戯れ
ichikawa
0
480
商品監視を支える技術.key.pdf
ichikawa
0
86
SendGridで人生変わった
ichikawa
2
2.2k
Other Decks in Programming
See All in Programming
標準ライブラリの動向とイテレータのパフォーマンス
makki_d
3
190
Iteratorでページネーションを実現する
sonatard
3
700
Pydantic x Database API:turu-pyの開発
yassun7010
1
530
型付きで行うVSCode拡張機能開発 / VSCode Meetup #31
mazrean
0
230
C#および.NETに対する誤解をひも解く
ymd65536
0
230
sqlcを利用してsqlに型付けを
kamiyam
0
240
NANIMACHI
naokiito
0
940
Micro Frontends for Java Microservices - dev2next 2024
mraible
PRO
0
190
Applied NLP in the Age of Generative AI
inesmontani
PRO
3
1.2k
Go製CLIツールGatling Commanderによる負荷試験実施の自動化
okmtz
3
680
Compose Multiplatform과 Ktor로 플랫폼의 경계를 넘어보자
kwakeuijin
0
250
モジュラモノリス、その前に / Modular monolith, before that
euglena1215
6
650
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
6
260
Facilitating Awesome Meetings
lara
49
6k
WebSockets: Embracing the real-time Web
robhawkes
59
7.3k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.6k
What's new in Ruby 2.0
geeforr
341
31k
Optimizing for Happiness
mojombo
375
69k
A Tale of Four Properties
chriscoyier
155
22k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Git: the NoSQL Database
bkeepers
PRO
425
64k
Navigating Team Friction
lara
183
14k
GraphQLの誤解/rethinking-graphql
sonatard
65
9.9k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.5k
Transcript
Laravel with SendGrid 2016.5.17
I am … Twitter: @ichikawa_0829 ▸ ϑϦʔϥϯε ▸ dots.
What is SendGrid?
What is SendGrid ▸ ϝʔϧ৴Λߦ͏ͨΊͷΫϥυαʔϏε ▸ ΞΧϯτൃߦ͢Ε͙͢ʹSMTPଓɺWeb(REST) APIɺϚʔέ ςΟϯάϝʔϧػೳΛͬͯϝʔϧΛૹ৴Ͱ͖Δ ▸
ແྉ͕͋Δ(ແྉͰ400௨/) ▸ SMTP APIͱ͍͏ػೳ͕ศར ▸ ։෧ΫϦοΫͷΠϕϯτΛHookͰ͖Δ ▸ ཧը໘͔Β༷ʑͳ౷ܭใ͕ࢀরՄೳ About
None
None
In Laravel
LaravelͰϝʔϧΛૹ৴͢Δ߹ ▸ SendGridͷSMTPαʔόΛ͏ ▸ WebAPIΛ͏ In Laravel
SendGridͷSMTPαʔόΛ͏ ▸ ެࣜHP ͰLaravelͰૹ৴͢Δํ๏ͱͯ͠ɺ͜ͷํ๏͕հ ͞Ε͍ͯ·͢ ▸ config/mail.phpʹSendGridͷSMTPαʔόͷଓใΛ ࢦఆ͢Δ͚ͩɻ ▸ ؆୯ʂ
In Laravel
<?php return array( 'driver' => 'smtp', 'host' => 'smtp.sendgrid.net', 'port'
=> 587, 'from' => array('address' => '
[email protected]
', 'name' => 'John Smith'), 'encryption' => 'tls', 'username' => 'sendgrid_username', 'password' => 'sendgrid_password', ); config/mail.php In Laravel SendGridͷSMTPαʔόΛ͏
Web APIΛͬͯϝʔϧΛૹ৴͢Δ߹ ▸ SendGridͷ΄΅શͯͷػೳWebAPIܦ༝Ͱ༻͢ΔͨΊ ͷΤϯυϙΠϯτ͕༻ҙ͞Ε͍ͯΔ ▸ curlެࣜϥΠϒϥϦɺίϛϡχςΟϕʔεϥΠϒϥϦΛ ༻ͯ͠ϦΫΤετ͛Δ ▸ SendGridͷSMTPαʔόΛ͏ΑΓॲཧ͕ૣ͘ऴΔέʔε͕
ଟ͍ͷͰՄೳͳΒWeb APIΛ͏͜ͱ͕ਪ͞Ε͍ͯΔ In Laravel
ૣ͘ͳΔՄೳੑ͕͋ΔͳΒWebAPI͍͍ͨ (͔͠Կނ͔֎ʹ͔ͬͯSMTPଓग़དྷͳ͍͠…)
ެࣜϥΠϒϥϦΛͬͯΈΔ ▸ sendgrid/sendgrid-php ΛcomposerͳͲͰΠϯετʔϧ͢ Δ ▸ $sendgrid = new SendGrid('YOUR_SENDGRID_APIKEY');
▸ $email = new SendGrid\Email(); ▸ $email->addTo('
[email protected]
'); // ͱ͔৭ʑઃఆ͢Δ ▸ $sendgrid->send($email); In Laravel
͏ͪΐͬͱLaravelͬΆ͘Γ͍ͨͳ͊…
͏ͪΐͬͱLaravelͬΆ͘Γ͍ͨͳ͊… (ͩͬͯMail::send()Ͱॻ͍ͯ͋Δطଘίʔυ͕ࢁɻɻɻ)
ଞΛ୳ͯ͠ݟͨΒͳ͍ɻɻɻ
࡞ͬͪΌ͓ʂ
ϝʔϧपΓͲ͏ͳͬͯΔʁ ▸ mail.driverͷઃఆʹ߹ΘͤͨTransportΫϥεΛ࣋ͭ SwiftMailerΛ$app['swift.mailer']ʹొ ▸ $app['swift.mailer']Λ࣋ͭIlluminate\Mail\Mailerͱ͍͏Ϋϥ εʹ৭ʑઃఆΛߦ͍$app['mailer']ʹొ ▸ Illuminate\Support\Facades\MailͰ$app['mailer']Λొ ࡞ͬͪΌ͓ʂ
ҙ֎ͱ࡞ΕΔ͔ ▸ ཁSendGrid༻ͷTransportΫϥε࡞ΕOK (࣮ࡍͦΕΛ ొ͢ΔҝͷTransportManagerͱɺMailServiceProvider ඞཁ) ▸ MandrillMailgunͷιʔεݟͨΒGuzzleHttp\ClientͰ POSTͯ͠Δ͚ͩ ▸
ΠέΔʂΠέΔͧʂ ࡞ͬͪΌ͓ʂ
laravel-sendgrid-deriver https://packagist.org/packages/s-ichikawa/laravel-sendgrid-driver
laravel-sendgrid-driver ▸ ଞͷdriverͱಉ༷ɺconfigϑΝΠϧʹز͔ͭઃఆΛՃ͢Ε OK ▸ SendGridΛศརʹ͏ͨΊʹ͔ܽͤͳ͍SMTP API͑Δ Α͏ʹ͠·ͨ͠ ▸ MailServiceProviderTransportManagerݩͷͷΛܧঝ
ͯ͠ΔͷͰଞͷdriverͦͷ··͑Δ ࡞ͬͪΌ͓ʂ
࡞ͬͪΌ͓ʂ 3/1 ॳPull Request 5/17 500install 5/25 1000install 5/13 N.Yͷਓ͔Β࣭
6/13 2000install
·ͱΊ ▸ ύοέʔδ։ൃLaravelͷ͍͍ษڧʹͳΓ·ͨ͠ ▸ SendGridศརɻLaravelͰ͏ͳΒlaravel-sendgrid-driver ࢼ͍͚ͯͨͩ͠Δͱخ͍͠Ͱ͢ɻ(Կ͔͋Ε༏͘͠PRΛ…) ▸ ެ։ͨ͠ʹ͍ͭͯͷ࣭PullRequestͬͺΓӳޠ͕ ଟ͍ɻӳޠ͕ΜΖ͏… ▸
composer require Ͱࣗͷύοέʔδ͕ೖΔͷخ͍͠ɻ ͬͯΒ͑Δͱࣗ৴ʹͳΔɻ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠