Upgrade to Pro — share decks privately, control downloads, hide ads and more …

メールのヘッダと本文をまとめてTwigでテンプレート

 メールのヘッダと本文をまとめてTwigでテンプレート

8e844e43f029ec38e206a464cf4587b3?s=128

Takashi Kanemoto

November 12, 2014
Tweet

More Decks by Takashi Kanemoto

Other Decks in Programming

Transcript

  1. ϝʔϧͷϔομͱຊจΛ ·ͱΊͯTwigͰςϯϓϨʔτ #nagoyaphp 2014.11.16 @qckanemoto

  2. @qckanemoto • (ג)ΧϧςοτίϛϡχέʔγϣϯζCTO • PHPྺ2.5೥ • ϦεςΟϯά޿ࠂӡ༻πʔϧʮLisketʯ

  3. PHPͰϝʔϧૹ৴͢Δͱ͖

  4. 1. SwiftMailerͰී௨ʹ΍Δͱ

  5. 1. SwiftMailerͰී௨ʹ΍Δͱ ϝʔϧͷจ໘͕ϝϯςͮ͠Β͍ͷͰ ςϯϓϨʔτʹ௥͍ग़͍ͨ͠ײ

  6. 2. TwigͰςϯϓϨʔτͯ͠ΈΔ

  7. 2. TwigͰςϯϓϨʔτͯ͠ΈΔ ͏Μɺ͍͍ײ͡ɻύνύνύνʙ

  8. 2. TwigͰςϯϓϨʔτͯ͠ΈΔ

  9. 2. TwigͰςϯϓϨʔτͯ͠ΈΔ

  10. 2. TwigͰςϯϓϨʔτͯ͠ΈΔ ͍ͭ͜Β͸͜ΕͰ͍͍ͷ͔ʁʁ

  11. 3. ͜͏ͳͬͨΒخͦ͠͏

  12. 3. ͜͏ͳͬͨΒخͦ͠͏ ϝʔϧͷ಺༰ʹؔ͢Δ৘ใ͕ શͯςϯϓϨʔτʹ௥͍ग़͍ͤͯΔ

  13. ࡞ͬͨ

  14. TwiggedSwiftMessageBuilder https://github.com/qckanemoto/TwiggedSwiftMessageBuilder

  15. Ͱ͖Δ͜ͱ • ϔομ΋ຊจ΋·ͱΊͯTwigͰςϯϓϨʔτ • ςϯϓϨʔτʹม਺Λ౉ͯ͠ల։ • HTMLϝʔϧͰͷม਺ͷΤεέʔϓ͸TwigͰ΍Δ • HTMLϝʔϧΛΠϯϥΠϯstyleԽʢGmailରԠʣ •

    HTMLϝʔϧʹը૾ΛຒΊࠐΉ
  16. ͍ͭͰʹSilex ServiceProviderԽ https://github.com/qckanemoto/TwiggedSwiftMessageServiceProvider • POST͞ΕͨϑΥʔϜͷσʔλΛςϯϓϨʔτ༻ͷ࿈૝ ഑ྻʹม׵͢ΔαʔϏεΛಉࠝʢ໰͍߹ΘͤϑΥʔϜ ͱ͔Ͱ׆༂ʣ

  17. Silex? • PHPϚΠΫϩϑϨʔϜϫʔΫ • Hello WorldͳΒ6ߦͰಈ͘ ࢀߟIUUQTJMFYTFOTJPMBCTPSH

  18. ࣮૷಺༰ • \Twig_TemplateΫϥεͷ
 renderBlock()ϝιουΛ׆༻ • ΠϯϥΠϯstyleԽʹ͸
 github.com/TijsVerkoyen/CssToInlineStyles Λར༻ • ը૾ͷຒΊࠐΈ͸ϓϨʔεϗϧμΛࠩ͠ࠐΜͰ͓͍

    ͯޙͰContent-IDʹஔ׵ͱ͍͏ྗٕ
  19. ͓·͚ • @koyhoge͞Μ͕ࣅͨΑ͏ͳ͜ͱ͓ͬ͠Όͬͯ ·ͨ͠ • https://speakerdeck.com/koyhoge/ merutenpuretodousitemasuka

  20. PR

  21. WE’RE HIRING! • Nagoya • PHP • Symfony2 • AngularJS

    • GitHub • CircleCI • Mac/Win • Multi Monitors SNS͔ϝʔϧͰ͓ؾܰʹ͝࿈བྷ͍ͩ͘͞ʂ
  22. Thanks ;)