{"id":8255,"date":"2020-01-16T17:24:02","date_gmt":"2020-01-16T08:24:02","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=8255"},"modified":"2020-01-16T17:24:04","modified_gmt":"2020-01-16T08:24:04","slug":"psr-php-standards-recommendation","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/8255","title":{"rendered":"PSR (PHP Standards Recommendation)"},"content":{"rendered":"\n<p>Today, I would like to share about PSR called PHP Standards Recommendation which are also known as coding standards of PHP. Actually, PHP does not have coding rules and standards itself. Developers tend to create their code to be more maintainable &amp; safer by using naming conventions and various coding styles. Some use frameworks like PEAR, Zend to standardize their code.<\/p>\n\n\n\n<h3>Just In Case If you don\u2019t know about `coding standards`<\/h3>\n\n\n\n<p>Coding rules and guidelines ensure that software is:<\/p>\n\n\n\n<ul><li><strong>Safe:<\/strong> It can be used without causing harm.<\/li><li><strong>Secure:&nbsp;<\/strong>It can\u2019t be hacked.<\/li><li><strong>Reliable:<\/strong> It functions as it should, every time.<\/li><li><strong>Testable:<\/strong> It can be tested at the code level.<\/li><li><strong>Maintainable:<\/strong> It can be maintained, even as your codebase grows.<\/li><li><strong>Portable:&nbsp;<\/strong>It works the same in every environment.<\/li><\/ul>\n\n\n\n<p>Standards are important for safety, security, and\nreliability.<\/p>\n\n\n\n<p>Every development team should use a standard. Even the\nmost experienced developer could introduce a coding defect \u2014 without realizing\nit. And that one defect could lead to a minor glitch. Or worse, a serious\nsecurity breach.<\/p>\n\n\n\n<p><strong>There are four main drivers for using\none:<\/strong><\/p>\n\n\n\n<ol><li>Compliance with industry standards (e.g., ISO).<\/li><li>Consistent code quality &#8211; no matter who writes the code.<\/li><li>Software security from the start.<\/li><li>Reduced development costs and accelerated time to market.<\/li><\/ol>\n\n\n\n<p>In 2009, There was a conference about PHP (<a href=\"https:\/\/tek.phparch.com\/\">https:\/\/tek.phparch.com\/<\/a>). At that conference, developers discussed about their opinions on working PHP projects and their complexities upon them. Finally, they decided to create coding standards to follow. The name of that association was PHP Standards Group. They updated their name as Framework Interoperability Group(FIG) later. &nbsp;You can see more detail about FIG here (<a href=\"https:\/\/www.php-fig.org\/\">https:\/\/www.php-fig.org\/<\/a>).<\/p>\n\n\n\n<p>Currently there are 13 approved standards.<\/p>\n\n\n\n<p>1&nbsp; Basic Coding Standard<\/p>\n\n\n\n<p>2&nbsp; Coding Style Guide<\/p>\n\n\n\n<p>3&nbsp; Logger Interface<\/p>\n\n\n\n<p>4&nbsp; Autoloading Standard<\/p>\n\n\n\n<p>6&nbsp; Caching Interface<\/p>\n\n\n\n<p>7&nbsp; HTTP Message Interface<\/p>\n\n\n\n<p>11&nbsp; Container Interface<\/p>\n\n\n\n<p>13&nbsp; Hypermedia Links<\/p>\n\n\n\n<p>14&nbsp; Event Dispatcher<\/p>\n\n\n\n<p>15&nbsp; HTTP Handlers<\/p>\n\n\n\n<p>16&nbsp; Simple Cache<\/p>\n\n\n\n<p>17&nbsp; HTTP Factories<\/p>\n\n\n\n<p>18&nbsp; HTTP Client<\/p>\n\n\n\n<p>If you are still curious to know about other standards that are currently reviewed, draft, abandoned. Check out this official link (<a href=\"https:\/\/www.php-fig.org\/psr\/\">https:\/\/www.php-fig.org\/psr\/<\/a>).<\/p>\n\n\n\n<p>By Yuuma.<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8255\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/8255\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"PSR (PHP Standards Recommendation)\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8255\" data-text=\"PSR (PHP Standards Recommendation)\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8255\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8255\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>Today, I would like to share about PSR called PHP Standards Recommendation which are also known as coding stan [&hellip;]<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[100],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/8255"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=8255"}],"version-history":[{"count":4,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/8255\/revisions"}],"predecessor-version":[{"id":8264,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/8255\/revisions\/8264"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=8255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=8255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=8255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}