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

momochanにも分かるPSR講座

 momochanにも分かるPSR講座

ゆうきゃん

April 08, 2021
Tweet

More Decks by ゆうきゃん

Other Decks in Programming

Transcript

  1. PSRͱ͸ • https://www.php- fi g.org/psr • PHP Standards Recommendations •

    PHPඪ४ίʔσΟϯάקࠂ • ४ڌ(ڧ੍Ͱ͸ͳ͍)
  2. ࡦఆϓϩηε • Pre-Draft (ఏҊ) • Draft (૲Ҋ) • Review (ධՁ)

    • Accepted (ঝೝ) • Deprecated (ඇਪ঑) • Abandoned (์غ)
  3. PSRҰཡ Accepted (ঝೝ) • PSR-1 Basic Coding StandardʢجຊతͳίʔσΟϯάඪ४ʣ • PSR-3

    Logger InterfaceʢϩΨʔΠϯλϑΣʔεʣ • PSR-4 AutoloaderʢΦʔτϩʔμʔʣ • PSR-6 Caching InterfaceʢΩϟογϯάΠϯλʔϑΣΠεʣ • PSR-7 HTTP Message InterfaceʢHTTPϝοηʔδΠϯλʔϑΣΠεʣ • PSR-11 Container InterfaceʢίϯςφΠϯλϑΣʔεʣ • PSR-12 Extended Coding Styleʢ֦ுίʔσΟϯάελΠϧʣ • PSR-13 Hypermedia LinksʢϋΠύʔϝσΟΞϦϯΫʣ • PSR-14 Event DispatcherʢΠϕϯτσΟεύονϟʔʣ • PSR-15 HTTP HandlersʢHTTPϋϯυϥʣ
  4. PSRҰཡ Draft (૲Ҋ) • PSR-5 PHPDoc Standard (PHPDocඪ४) • PSR-19

    PHPDoc tags (PHPDocλά) • PSR-20 Clock (ΫϩοΫ)
  5. PSRҰཡ Abandoned (์غ) • PSR-8 Huggable Interface (ϋάΞϒϧΠϯλʔϑΣ Πε) •

    PSR-9 Security Advisories (ηΩϡϦςΟΞυόΠβ Ϧ) • PSR-10 Security Reporting Process (ηΩϡϦςΟϨ ϙʔτϓϩηε)
  6. PSRΧςΰϦ • ΦʔτϩʔσΟϯά(PSR-0, 4) • ΠϯλʔϑΣΠε(PSR-3, 6, 11,13, 14, 16)

    • HTTP(PSR-7, 15, 17, 18) • ίʔσΟϯάελΠϧ(PSR-1, 2, 12)
  7. PSRൈਮ঺հ(PSR-1) • Basic Coding Standard • ϑΝΠϧͰ͸λά <?php ΋͘͠͸<?= ͷΈΛ࢖༻͢Δ

    • PHPίʔυͷϑΝΠϧͰ͸BOMͳ͠ͷUTF-8ͷΈΛ࢖༻͢Δ • Ϋϥε໊͸ύεΧϧέʔεͰએݴ͢Δ • Ϋϥεఆ਺͸ɺશͯେจࣈͰΞϯμʔείΞ۠੾ΓΛར༻ͯ͠એ ݴ͢Δ • ϝιου໊͸ΩϟϝϧέʔεͰએݴ͢Δ
  8. PSRൈਮ঺հ(PSR-12, PSR-2) • Extended Coding Style Guide • PSR-2 ͷίʔσΟϯάελΠϧΨΠυͷ֦ுͱͳΔ

    • શͯͷ PHP ϑΝΠϧ͸ɺUnix LFʢϥΠϯϑΟʔυʣͷߦ຤ͷΈΛ࢖༻ ͢Δ • શͯͷ PHP ϑΝΠϧ͸ɺۭനҎ֎ͷߦͰऴΘΓɺ୯Ұͷ LF Ͱऴྃ͢Δ • PHP ͷΈΛؚΉϑΝΠϧͰ͸ɺऴྃλάΛলུ͢Δ • ΠϯσϯτϨϕϧ͝ͱʹ̐ͭͷεϖʔεͷΠϯσϯτΛ࢖༻͢Δ