{"id":1656,"date":"2012-10-08T17:08:31","date_gmt":"2012-10-08T09:08:31","guid":{"rendered":"http:\/\/www.tzlee.com\/blog\/?p=1656"},"modified":"2012-10-09T11:46:10","modified_gmt":"2012-10-09T03:46:10","slug":"frameworks","status":"publish","type":"post","link":"https:\/\/tzlee.com\/blog\/2012\/10\/frameworks\/","title":{"rendered":"Oppa PHP Style"},"content":{"rendered":"<p>It&#8217;s been some time ever since I&#8217;ve done much serious coding and decided to get myself updated&#8230; with Korean music.<\/p>\n<p>Just joking.<\/p>\n<p>I&#8217;ve been doing some research on PHP <a href=\"http:\/\/en.wikipedia.org\/wiki\/Comparison_of_web_application_frameworks\">frameworks<\/a>. My primary requirements were that the framework supported MVC (most do), is capable of friendly URLs, is simple\/easy to use, provides basic wrappers around security (such as XSS and SQL Injection) and most importantly it must have good online support and resources.<\/p>\n<p>I pay particular attention to documentation as it plays an important part to help developers quickly learn\/adopt a new framework.<\/p>\n<p>I spent many hours over the weekend reading documentation, installation guides and watching tutorials and eventually settled for <a href=\"http:\/\/codeigniter.com\/\">CodeIgniter<\/a>. I found it quite complete and particularly easy to learn. It is well documented, has a good tutorials and did not require that I learn a new template syntax. Above all it deploys really quickly with minimal configuration.<\/p>\n<p>I would like to bring your attention to the <a href=\"http:\/\/codeigniter.com\/user_guide\/general\/styleguide.html\">Style Guide<\/a> in the CodeIgniter User Guide. It is very detailed and contains a lot of good coding practices, especially on how braces should be (opening on a new line instead of on the same line) and how PHP tags should be opened (and not necessarily closed). I suggest that PHP developers follow this style guide.<\/p>\n<p>There&#8217;s also an add-on to CodeIgniter that I would recommend and that is <a href=\"http:\/\/www.grocerycrud.com\/\">Grocery CRUD<\/a> (Create, Retrieve, Update, Delete). Grocery CRUD makes it extremely easy to create a simple maintenance screen for back-end data, especially for short-term projects. It&#8217;s certainly better than sending users to phpMyAdmin.<\/p>\n<p>Finally, just to share, here&#8217;s my version of <code>.htaccess<\/code> file that I use to remove <code>index.php<\/code> from the URL. It is largely similar to the example by CodeIgniter with an additional exception for CSS and JavaScript files.<\/p>\n<blockquote>\n<pre>RewriteEngine on\r\nRewriteCond $1 !^(index\\.php|images|user_guide|robots\\.txt|(.*)\\.css|(.*)\\.js)\r\nRewriteRule ^(.*)$ \/projects\/ci201210\/index.php\/$1 [L]<\/pre>\n<\/blockquote>\n<p>That said, I have only done <em>research<\/em> and not actually used the framework on a full project yet. I&#8217;d love to hear any comments and\/or recommendations you have.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been some time ever since I&#8217;ve done much serious coding and decided to get myself updated&#8230; with Korean music. Just joking. I&#8217;ve been doing some research on PHP frameworks. My primary requirements were that the framework supported MVC (most&#8230; <a class=\"more-link\" href=\"https:\/\/tzlee.com\/blog\/2012\/10\/frameworks\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8],"tags":[350,351,158],"class_list":["post-1656","post","type-post","status-publish","format-standard","hentry","category-tech","tag-codeigniter","tag-grocery-crud","tag-php"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts\/1656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/comments?post=1656"}],"version-history":[{"count":16,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts\/1656\/revisions"}],"predecessor-version":[{"id":1673,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts\/1656\/revisions\/1673"}],"wp:attachment":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/media?parent=1656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/categories?post=1656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/tags?post=1656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}