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

最近の WordPress(あと PHP)ってこんな感じ!!! ~ 使ってみよう WP-CL...

最近の WordPress(あと PHP)ってこんな感じ!!! ~ 使ってみよう WP-CLI と WP REST API 、書いてみよう PHP ~

2016.06.29 イドバタ会議#1 にて発表したスライドです。

More Decks by Toro_Unit (Hiroshi Urabe)

Other Decks in Technology

Transcript

  1. ࠷ۙͷ WordPressʢ͋ͱ PHPʣͬͯ ͜Μͳײ͡!!! ~ ࢖ͬͯΈΑ͏ WP-CLI ͱ WP REST

    API ɺॻ͍ͯΈΑ͏ PHP ~ Toro_Unit / 2016.6.29 @ΠυόλΧΠΪ Vol.1 2016.6.29 @ΠυόλΧΠΪ Vol.1 1
  2. Toro_Unit ઎෦ ߛ (͏Β΂ ͻΖ͠) Web Designer / Front-end Engineer

    Github: @torounit Twitter: @Toro_Unit Facebook: fb.me/torounit Blog: https://torounit.com 2016.6.29 @ΠυόλΧΠΪ Vol.1 3
  3. Profile • ෱ౡݝ܊ࢁࢢੜ·Εɻ • ܈അݝଠాࢢҭͪɻ • ௕໺ݝদຊࢢ̕೥໨ɻ • ʹ͡Ύ͏ͳͳ͍͞ɻ source:

    https://commons.wikimedia.org/wiki/ File:Gunma- NaganoPrefecturalRoad11202.jpg 2016.6.29 @ΠυόλΧΠΪ Vol.1 4
  4. Code Contribution • WordPress ίΞߩݙऀ (4.3 ~) • ϓϥάΠϯ։ൃऀ •

    Custom Post Type Permalinks ...and more. • Active Installs: 60,000+ • ͦͷ΄͔ؔ࿈ϓϩδΣΫτ΁ͷߩݙʢVCCW, WP-CLIʣ 2016.6.29 @ΠυόλΧΠΪ Vol.1 6
  5. Community • WordBench ௕໺ ϞσϨʔλʔʢҰॹʹ΍ͬͯ͘ΕΔํΛ੾ ࣮ʹ଴ͬͯ·͢ɻʣ • WordCamp Kansai /

    Tokyo 2015 εϐʔΧʔ • WordCamp Kansai / Tokyo 2016 ࣮ߦҕһ / εϐʔΧʔ • WordBash / WordWine .... 2016.6.29 @ΠυόλΧΠΪ Vol.1 7
  6. • ϓϥάΠϯͷΠϯετʔϧɾ༗ޮԽ wp plugin install custom-post-type-permalinks -- activate • ౤ߘσʔλͷ࡞੒

    wp post create --post_title='Sample Post' • μϛʔσʔλͷੜ੒ wp post generate --count=10 • ઃఆͷมߋ wp option update my_option hoge 2016.6.29 @ΠυόλΧΠΪ Vol.1 13
  7. ͜Μͳײ͡Ͱ౤ߘͷσʔλΛऔಘͰ͖·͢ɻ $ curl https://torounit.com/wp-json/wp/v2/posts | jq . [ { "id":

    2349, "date": "2016-06-21T20:32:30", "date_gmt": "2016-06-21T11:32:30", "guid": { "rendered": "https://torounit.com/?p=2349" }, "modified": "2016-06-29T12:44:40", "modified_gmt": "2016-06-29T03:44:40", "slug": "composer-wordpress-development-kit-3-0-2", "type": "post", "link": "https://torounit.com/blog/2016/06/21/2349/", "title": { "rendered": "Composer WordPress Development Kit 3.0.2 ΛϦϦʔε͠·ͨ͠ɻ" }, "content": { "rendered": ... 2016.6.29 @ΠυόλΧΠΪ Vol.1 17
  8. • ΧςΰϦʔͰߜΓࠐΜͩΓɺ GET /wp-json/wp/v2/posts?categories=<id> • ಛఆͷ౤ߘΛऔಘͨ͠Γɺ GET /wp-json/wp/v2/posts/<id> • ௥Ճͨ͠Γ(ཁೝূ)ɺ

    POST /wp-json/wp/v2/posts/ • ΤϯυϙΠϯτΛϓϥάΠϯͰࣗ༝ʹ௥Ճͨ͠Γ΋ग़དྷ· ͢ʂ 2016.6.29 @ΠυόλΧΠΪ Vol.1 18
  9. • WEB / ϞόΠϧΞϓϦέʔγϣϯͷόοΫΤϯυʹ WordPress ͱ͍͏બ୒ࢶʂ • όοΫΤϯυΛWordPressɺϑϩϯτΤϯυΛ node.js ౳ʹ

    ෼཭͢Δ͜ͱͰεέʔϥϒϧͳߏ੒΋ɻ • https://github.com/ustwo/ustwo.com-frontend • JSͷϑϨʔϜϫʔΫͷษڧͷͨΊʹόοΫΤϯυͷAPIΛ· ͣ࡞Δͱ͔͍͏ۤߦ͔Βͷղ์! 2016.6.29 @ΠυόλΧΠΪ Vol.1 19
  10. ࠷ۙͷPHPࣄ৘ • Composer ͱ͍͏ npm Έ͍ͨͳύοέʔδ؅ཧγεςϜʂ PEAR͡Όͳ͍Αʂ • WordPress ΋

    ͍͓ͪ͏؅ཧग़དྷΔΑʢ਒͑੠ʣ • Slim ͱ͔ Sinatra Έ͍ͨͳWAF΋͋ΔΑʂ • twigͱ͔ɺϚτϞͳςϯϓϨʔτΤϯδϯ΋͋ΔΑʂ • WordPress ؔ܎ͳ͍͚ͲɺLaravel ͱ͔͍͢͝Αʂ 2016.6.29 @ΠυόλΧΠΪ Vol.1 24