Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Tim Cotten:
How to Screw Up Singletons (in PHP)
Nov 08, 2016 @ 18:58:05

In a recent post to his site Tim Cotten talks about how it's possible to screw up singletons in PHP. Singletons are a design pattern that returns the same object once it is created each time the method is called.

“Echo chambers” are an oft-encountered downfall of developers when learning new skills or implementing unfamiliar systems. What begins as a simple question leads to a collection of up-voted knowledge perfectly ready to be copied into your project?—?a great thing for productivity (if you don’t mind getting it wrong).

[...] With that example of echo chambers in mind let’s follow the path of a developer deciding to implement the Singleton pattern in PHP.

He goes through the mindset of a PHP developer wanting to use a singleton in their application, finding an example on the web for their need (making a PDO instance). He gives a sample implementation based on the web examples and tries to execute a test script....with a less than helpful error message. He points out that he's not picking on the source of the example itself, but using it as an example of the "echo chamber" idea perpetuating an example without understanding the logic.

He continues along this same path of thinking with an example from another source - StackOverflow. He cites a specific example, points out the issue and the code it contains. He ends the post with some helpful suggestions on how to "break" this echo chamber and improve the resources in various places on the web.

tagged: singleton echochamber examples stackoverflow phptherightway bestpractices

Link: https://blog.cotten.io/how-to-screw-up-singletons-in-php-3e8c83b63189#.8n7u746sw

Jon LeMaitre:
A Response To PHP- The Wrong Way
Aug 22, 2016 @ 17:21:36

Jon LeMaitre has a new post to his Medium blog sharing his own response to the "PHP The Wrong Way" (phpthewrongway.com) and some of the points it makes.

For anyone who isn’t aware, there is a site call http://phptherightway.com, which is a summary of good (dare I say, best?) practices for writing PHP in 2016. In addition, there now exists http://phpthewrongway.com, whose aim is to provide a kind of counterbalance to http://phptherightway.com and what is presently mainstream PHP culture. This article is a rebuttal to the arguments found in http://phpthewrongway.com.

He starts by pointing out the three main positive points "The Wrong Way" makes:

  • keeping things simple
  • don't apply tools dogmatically
  • write secure software by default

However, as he points out, most of this advice is wrapped in "gross mischaracterizations of the PHP community, the nature of frameworks, standards, and PHP itself." Jon's post gets into a lot more detail on the various sections of "The Wrong Way", breaking them down into a series of quotes and matching responses. There's definitely some good points made here in Jon's post - I'd highly suggest balancing out the thoughts from "The Wrong Way" with it.

tagged: phpthewrongway response opinion phptherightway

Link: https://medium.com/@jon.lemaitre/a-response-to-php-the-wrong-way-fe7bb253e295#.5w6810pwg

PHP Town Hall:
Episode 27: Josh Lockhart and Jeremy Mikola
Jun 30, 2014 @ 14:30:35

The PHP Town Hall podcast is back with their latest episode, number 27, featuring two special guests: Jeremy Mikola and Josh Lockhart.

This episode is a long one, but we are back to improved audio and the video is not just one dude eating pizza for an hour. Josh Lockhart of PHP The Right Way and Slim fame, and Jeremy Mikola who is well known for banging on about clouds and playing magic the gathering. Oh, he also works for MongoDB.

The episode's discussion includes a wide range of topics (and plenty of rambling) about things like plans for Slim 3, Silex vs Slim, PHP The Right Way, Illuminate/Pagination and difficulties around pull requests. You can listen to this latest episode either through the in-page player, by downloading the mp3 or you can watch the video of the live Google Hangout recording.

tagged: phptownhall ep27 jeremymikola joshlockhart slim phptherightway illuminate pullrequest

Link: http://phptownhall.com//blog/2014/06/29/episode-27-foo/

7PHP.com:
Josh Lockhart - Find Good Online Resources And Communities & Use Them To Your Advantage
Apr 28, 2014 @ 14:17:41

7PHP.com has posted their latest community interview, this time with Josh Lockhart, an author behind the PHP The Right Way project and the Slim microframework. They talk some about his history with PHP, some thoughts on the current state of the language and resources/tools he recommends.

Someone finally took the responsibility to make things go in The Right Direction. And this man, this brave man, this ‘super-hero’ is here to make a change happen – he is named Mr Josh Lockhart. He is The Captain America of The PHP Community! Josh came forward with a convincing righful movement (if I can allow myself to tag it as such) to help PHP-ers get a sense of good direction when it comes to ‘dealing with/and taming’ PHP as a tool to make good software. This initiative is named as PHP The Right Way!

Josh answers other questions about his preference in environments, what he sees as the good and bad of PHP and his overall feel of the PHP community and where he feels e fits.

tagged: community interview 7php joshlockhart phptherightway slim

Link: http://7php.com/php-interview-josh-lockhart/

/Dev/Hell Podcast:
Episode 43: Erotic Art the Right Way
Apr 16, 2014 @ 14:15:47

In the latest episode of the /Dev/Hell podcast (Episode #34, "Erotic Art the Right Way") hosts Ed Finkler and Chris Hartjes talk with Josh Lockhart of Slim framework fame.

Our latest episode features someone who we’re been trying to get on for a while: Josh Lockhart, the developer of the Slim Framework for PHP and the founder of the PHP The Right Way project. We also have a new sponsor in Nude New Relic!

Topics they discuss include things like Slim, Sinatra, Flask and Guzzle. You can listen to this latest episode either by downloading the mp3 or using the in-page player. You can also subscribe to their feed to get this and other great shows.

tagged: devhell podcast ep43 joshlockhart slimframework phptherightway

Link: http://devhell.info/post/2014-04-13/erotic-art-the-right-way/

SitePoint PHP Blog:
PHP The Right Way: The Book
Feb 03, 2014 @ 18:05:57

On the SitePoint PHP blog today Bruno Skvorc talks about one of the best resources out there for people new to the PHP language (or even those wanting to hone their skills) - PHP: The Right Way. In his post he talks about the guide, it being published on LeanPub and where the proceeds from the book are going.

We can’t keep the newbies away, and we can’t educate the clients because most clients learn exclusively on mistakes. Shared host environments are also to blame, because their plans seldom include the most recent version of PHP, and are, due to price and ease of use, still the preferred hosting solution for legions of newcomers. So what can we do to spread best practices?

PTRW is a community effort, a website built entirely around spreading best up-to-date PHP practices. It’s far from exhaustive – instead, it tries to bullet-list the things you should pay attention to, and links to quality resources where one can learn more about the various aspects it covers.

The book is an online resource, but it's been put on LeanPub to make it more portable and available offline. Since the book is a community resource and no one person should make the money from it, the choice was made to have all proceeds go to the Electronic Frontier Foundation. He finishes off the post with a brief interview with the book's maintainers Phil Sturgeon and Josh Lockhart.

tagged: phptherightway book eff interview philsturgeon joshlockhart

Link: http://www.sitepoint.com/php-right-way-book

Reddit.com:
What are the must see talks/tutorials about php?
Dec 11, 2013 @ 18:47:36

On Reddit.com a conversation has started about some of the "must see" talks or tutorials that are out there for PHP. It starts with a suggestion of this talk about Symfony2 and includes other suggestions of:

If you have a talk or tutorial you think is a good resource for any level of PHP developer, head over and add it to the list!

tagged: mustsee talk tutorial suggestion video phptherightway

Link: http://www.reddit.com/r/PHP/comments/1shr8o/what_are_the_must_see_talkstutorials_about_php/

Community News:
PHP The Right Way adds Dependency Injection Information
Dec 02, 2013 @ 17:54:39

The popular "PHP The Right Way" site has added a new section about a technology that's already in wide use across PHP frameworks and other applications in the community - Dependency Injection.

Dependency Injection is providing a component with it’s dependencies either through constructor injection, method calls or the setting of properties. It is that simple. [...] If you have ever read about Dependency Injection then you have probably seen the terms “Inversion of Control” or “Dependency Inversion Principle”. These are the complex problems that Dependency Injection solves.

The new section talks about some of the fundamentals behind the use of DI (dependency injection), what the "Inversion of Control" and "Dependency Inversion Principle" are and a bit about a common implementation - dependency injection containers.

tagged: phptherightway dependency injection section tutorial

Link: http://www.phptherightway.com/#dependency_injection

Community News:
The League of Extraordinary Packages
Aug 16, 2013 @ 16:19:14

A new site has started up that's trying to provide a listing of the "highest quality packages" out there for PHP based on PHP-FIG standards and good practices - the League of Extraordinary Packages.

The League of Extraordinary Packages has one driving mission, to track down and develop PHP packages of the highest quality possible, using modern tools, standards and practices to distribute, test and strengthen the code.

Members of The League follow the standards put forward by the PHP-FIG, follow the best practices detailed by PHP The Right Way and distribute all code through Composer.

So far there's a few on the list, but it promises to grow quickly. Libraries already included are things like Geotools, oauth2-client and statsd.

tagged: league extraordinary packages composer phpfig phptherightway

Link: http://www.thephpleague.com

Voices of the ElePHPant Podcast:
Interview with Josh Lockhart
Aug 07, 2012 @ 14:47:10

The Voices of the ElePHPant podcast has released their latest interview with a PHP community member - Josh Lockhart, creator of the PHP - the Right Way project.

Cal's three questions center around his involvement in this project:

  • Why did you start "PHP - The Right Way"?
  • What makes "PHP - The Right Way" different from other beginner PHP resources out there?
  • Who can contribute to "PHP - The Right Way"?

You can listen to this latest episode either through the in-page player, by download the mp3 or subscribe to their feed.

tagged: voicesoftheelephpant podcast interview community joshlockhart phptherightway

Link:


Trending Topics: