Prev: mysqli_connect problem
Next: gentoo php
From: "Bob McConnell" on 2 Mar 2010 09:52 From: pan > ""Hansen, Mike"" <Mike.Hansen(a)atmel.com> wrote in message >> news:7941B2693F32294AAF16C26B679A258D0EFDC318(a)csomb01.corp.atmel.com... >> Is there a PHP Best Practices Book, Document, or web site that has >> information similar to Perl Best Practices but for PHP? > > Yeah, it's hard to find this stuff. > > A google search on {+"Best Practices" +"PHP"} returned only > 4,340,000 hits. > > Maybe, some day, someone will think to write something up. The problem with this method is that scanning these results reveals conflicting and contradictory recommendations that are all over the place. Some are so old they may not even be valid PHP any more. Reading even a small subset of these pages is an exercise in frustration. But that makes sense as there doesn't appear to be any consistency nor consensus within the community, or even within some of the larger projects. Speaking of consensus, based on a recent discussion on the Perl Beginners mailing list, the Perl Best Practices book is now considered to be deprecated among the active Perl community. Many of its recommendations are obsolete and no longer used. It is long past due for a major rewrite. Bob McConnell
From: "Hansen, Mike" on 2 Mar 2010 12:51 > -----Original Message----- > From: Bob McConnell [mailto:rvm(a)cbord.com] > Sent: Tuesday, March 02, 2010 7:52 AM > To: pan; php-general(a)lists.php.net > Subject: RE: [PHP] Re: Best Practices Book, Document, Web Site? > > From: pan > > ""Hansen, Mike"" <Mike.Hansen(a)atmel.com> wrote in message > >> > news:7941B2693F32294AAF16C26B679A258D0EFDC318(a)csomb01.corp.atm > el.com... > >> Is there a PHP Best Practices Book, Document, or web site that has > >> information similar to Perl Best Practices but for PHP? > > > > Yeah, it's hard to find this stuff. > > > > A google search on {+"Best Practices" +"PHP"} returned only > > 4,340,000 hits. > > > > Maybe, some day, someone will think to write something up. > > The problem with this method is that scanning these results reveals > conflicting and contradictory recommendations that are all over the > place. Some are so old they may not even be valid PHP any > more. Reading > even a small subset of these pages is an exercise in frustration. But > that makes sense as there doesn't appear to be any consistency nor > consensus within the community, or even within some of the larger > projects. > > Speaking of consensus, based on a recent discussion on the Perl > Beginners mailing list, the Perl Best Practices book is now considered > to be deprecated among the active Perl community. Many of its > recommendations are obsolete and no longer used. It is long > past due for > a major rewrite. > > Bob McConnell Yep. Perl Best Practices is due for a rewrite/update. I came across this page that attempts to update it: http://www.perlfoundation.org/perl5/index.cgi?pbp_module_recommendation_commentary For PHP, I'll stick with the PEAR recommendations and do the best I can with whatever is missing. Thanks.
From: Shawn McKenzie on 2 Mar 2010 13:07 Paul M Foster wrote: > On Mon, Mar 01, 2010 at 01:48:14PM -0700, Hansen, Mike wrote: > >> Is there a PHP Best Practices Book, Document, or web site that has information similar to Perl Best Practices but for PHP? > > FWIW, we tried to create a thread to gather these "best practices" > ideas, and mostly what we got was arguments from people who took > exception one way or another. > > Paul > That is not correct. I take exception with your comments. -- Thanks! -Shawn http://www.spidean.com
From: J Ravi Menon on 5 Mar 2010 16:21
Other than coding standards, the other good read is: (it seems to cover most topics I have ran into while maintaining a high traffic site implemented in php 5): http://phplens.com/lens/php-book/optimizing-debugging-php.php It is 'best practices' from another angle - use of opcode cache (apc etc..), output buffering and so on. Coding standards vary a lot, so I would recommend sticking to one style once a consensus is reached among the team and preferably enforce it in automated fashion (e.g. http://pear.php.net/package/PHP_CodeSniffer/ as a svn pre-commit hook). The other easily over-looked part I have seen in many php projects is the code layout and directory structure, including dependency management (library code vs business logic etc..), and more importantly only exposing the main 'entry point' scripts (index.php or controller.php in a MVC model) in a apache doc root. Many times I have seen poorly laid out code that ends up getting deployed with the entire code bases exposed in a apache doc root. If care is not taken (e.g. naming some files .inc and no special apache rules to interpret them as a php handler), it is a security nightmare with critical files getting exposed. I have my own layout suggestion which has worked well for us, and once mastered, it makes everyone in the team very productive. Maybe this can be a separate topic in its own right. Ravi On Tue, Mar 2, 2010 at 9:51 AM, Hansen, Mike <Mike.Hansen(a)atmel.com> wrote: > > >> -----Original Message----- >> From: Bob McConnell [mailto:rvm(a)cbord.com] >> Sent: Tuesday, March 02, 2010 7:52 AM >> To: pan; php-general(a)lists.php.net >> Subject: RE: [PHP] Re: Best Practices Book, Document, Web Site? >> >> From: pan >> > ""Hansen, Mike"" <Mike.Hansen(a)atmel.com> wrote in message >> >> >> news:7941B2693F32294AAF16C26B679A258D0EFDC318(a)csomb01.corp.atm >> el.com... >> >> Is there a PHP Best Practices Book, Document, or web site that has >> >> information similar to Perl Best Practices but for PHP? >> > >> > Yeah, it's hard to find this stuff. >> > >> > A google search on {+"Best Practices" +"PHP"} returned only >> > 4,340,000 hits. >> > >> > Maybe, some day, someone will think to write something up. >> >> The problem with this method is that scanning these results reveals >> conflicting and contradictory recommendations that are all over the >> place. Some are so old they may not even be valid PHP any >> more. Reading >> even a small subset of these pages is an exercise in frustration. But >> that makes sense as there doesn't appear to be any consistency nor >> consensus within the community, or even within some of the larger >> projects. >> >> Speaking of consensus, based on a recent discussion on the Perl >> Beginners mailing list, the Perl Best Practices book is now considered >> to be deprecated among the active Perl community. Many of its >> recommendations are obsolete and no longer used. It is long >> past due for >> a major rewrite. >> >> Bob McConnell > > Yep. Perl Best Practices is due for a rewrite/update. I came across this page that attempts to update it: > http://www.perlfoundation.org/perl5/index.cgi?pbp_module_recommendation_commentary > > For PHP, I'll stick with the PEAR recommendations and do the best I can with whatever is missing. > > Thanks. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > |