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
500
商品監視を支える技術.key.pdf
ichikawa
0
86
SendGridで人生変わった
ichikawa
2
2.2k
Other Decks in Programming
See All in Programming
CSC509 Lecture 12
javiergs
PRO
0
160
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
1
110
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
Contemporary Test Cases
maaretp
0
130
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
910
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
Amazon Qを使ってIaCを触ろう!
maruto
0
400
C++でシェーダを書く
fadis
6
4.1k
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Music & Morning Musume
bryan
46
6.2k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
A Philosophy of Restraint
colly
203
16k
Facilitating Awesome Meetings
lara
50
6.1k
Side Projects
sachag
452
42k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
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 Ͱࣗͷύοέʔδ͕ೖΔͷخ͍͠ɻ ͬͯΒ͑Δͱࣗ৴ʹͳΔɻ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠