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.7k
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
2.9k
GraphQL入門
ichikawa
3
1k
ReactPHPとの戯れ
ichikawa
0
400
商品監視を支える技術.key.pdf
ichikawa
0
79
SendGridで人生変わった
ichikawa
2
2.1k
Other Decks in Programming
See All in Programming
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
110
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
220
Changed Rules: Architectures with Lightweight Stores
manfredsteyer
PRO
0
240
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
680
Ruby Pattern Matching
bkuhlmann
0
920
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
4k
PHPはいつから死んでいるかの調査
chiroruxx
1
370
Ruby GitHub Packages
bkuhlmann
0
630
Rails と人魚の話/rails-and-mermaid
sanfrecce_osaka
0
100
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
410
エンターテイメント業界で利用されるAWS
demuyan
0
210
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
630
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
59
5k
Clear Off the Table
cherdarchuk
83
310k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
12
4.6k
Bash Introduction
62gerente
604
210k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
1
3.4k
Web Components: a chance to create the future
zenorocha
305
41k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
240
1.2M
YesSQL, Process and Tooling at Scale
rocio
163
13k
What's new in Ruby 2.0
geeforr
337
31k
Web development in the modern age
philhawksworth
202
10k
Visualization
eitanlees
135
14k
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 Ͱࣗͷύοέʔδ͕ೖΔͷخ͍͠ɻ ͬͯΒ͑Δͱࣗ৴ʹͳΔɻ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠