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

Developer Drive:
Looming PHP 7 and its effect on WordPress
Nov 26, 2015 @ 11:54:15

On the Developer Drive site they've posted an article for all of the WordPress users (and other curious folks) about the impact PHP 7 will have on the current WordPress system.

It’s no big secret now that PHP 7 is just on the horizon, and with that development comes questions on how it affects sites that run on WordPress. PHP 7 is a massive update to the server-side web development language called PHP, yet it’s also going to have an impact on any PHP-powered CMS like Drupal, Joomla and Magento.

They go through some of the major changes in PHP 7 and talk briefly about what kind of effects they'll have on those running this popular CMS including:

  • Performance upgrades
  • New and improved operators
  • Continuous 64-bit support
  • Anonymous class support

They recommend that you keep an eye out for messages from your host that they might be upgrading, backing up your site to prevent loss and update your plugins/themes prior to any PHP 7 switch over.

tagged: php7 wordpress features update recommendation hosting

Link: http://www.developerdrive.com/2015/11/looming-php-7-and-its-effect-on-wordpress/

Kinsta Blog:
10 Things Not To Do In PHP 7
Nov 11, 2015 @ 09:53:36

On Kinsta.com Daniel Pataki has posted a list of seven things not to do in PHP 7 when it's finally released. It's no secret that there's a lot of new functionality coming with this new version but that also potentially means some bad practices coming along with them.

I’ve already shared some of the upcoming features of PHP 7, in this article I thought I’d take a look at some of the bad patterns we should stop using as we switch to the lightning fast PHP 7.

Among the things on his list are suggestions like:

  • Do Not Use mysql_ Functions (removed from core)
  • Do Not Use PHP Close Tags At The End Of A file
  • Do Not Perform Queries In A Loop
  • Do Not Trust User Input

Some of the suggestions do have a direct relation to what PHP 7 has to offer but most of them are just good practices to follow during your development work. Quite a few good tips in there, especially if you're relatively new to the language and want to start with PHP 7 and go.

tagged: php7 top10 opinion development practice habits recommendation

Link: https://kinsta.com/blog/10-things-not-to-do-in-php-7/

How to Validate Data
Nov 10, 2015 @ 10:18:52

In this post to thePHP.cc site Sebastian Bergmann looks at validation data, both in the sense of user input and the contents of objects you're application is currently working with.

Validating data seems to be one of the most important tasks of an application. After all, you cannot trust data from external sources. So let us have a look at how to efficiently implement data validation.

He gives an example of a user profile with requirements on the data it should contain. He focuses on the email address property as it's one of the easier options to validate (or is it). He walks through the usual progression from controller injection to setter injection of the value but wonders when the validation should happen to keep the Profile object from becoming invalid. He points out that simply having a validate method perform the checks isn't enough as it may not always be called correctly, leading to potentially invalid objects. Instead he recommends an alternative - using a validator object/tool in the setters of your object instance as the values are set. This prevents the object from getting into an unknown state and provides immediate feedback to the developer when something's wrong.

tagged: data validation object recommendation setter business rules

Link: https://thephp.cc/news/2015/11/how-to-validate-data

Source Blog:
Good Code Runs on Good Communication
Sep 18, 2015 @ 11:10:27

On the Source blog there's a great post that reinforces something that all developers should keep in mind when developing their applications: good code runs on good communication. "Tech language" barriers can make this difficult, but this post gives you a few suggestions on places to start improving.

When I started the interactive team at the Sun Sentinel in 2013, I thought the biggest challenge would be the code. I was wrong. [...] It wasn’t always easy. When you need someone on your side, but they don’t speak the same tech language, it can be very difficult. Investing (not necessarily financially, but emotionally and mentally) in creating a space where teams can work better together is key. Here are some strategies for overcoming the language barrier to make collaboration smoother.

They recommend things like:

  • having face-to-face conversations to work out the best solutions
  • avoiding assumptions about skill levels
  • pausing to check and ensure everyone understands the current state of conversation
  • agreeing on common terms and naming

Finally, they make a recommendation that could make some of the developers out their cringe a bit: "document the madness". As they point out, having good documentation of not only the result of the work but also the process along the way can be crucial for future work and others not directly involved in the process to review.

tagged: good code communication opinion recommendation language conversation

Link: https://source.opennews.org/en-US/articles/code-runs-communication/

When You're Hacked in WordPress: Staying Safe Later On
Feb 20, 2015 @ 14:19:00

NetTuts.com has posted the second part in their "When You're Hacked - WordPress" tutorial series today with this new article showing you how to stay safe once you've recovered from the initial attack.

n the first part of this series, we went through what to do when your website gets hacked. In this second part, we're going to learn about staying safe and being able to act quickly when another unpleasant incident happens.

They start by answering the overarching question everyone wants to know about WordPress (as it relates to security) - "is it safe?" They follow this with some recommendations to help keep your install safe including:

  • Staying Up to Date
  • Using Safe Plugins & Themes
  • Using a Security-Related WordPress Plugin

Check out the rest of the article for the full list and a quick summary of each, some with links to the actual tools and plugins to help you protect your installation.

tagged: wordpress hack stay safe tutorial series part2 recommendation

Link: http://code.tutsplus.com/tutorials/when-youre-hacked-in-wordpress-staying-safe-later-on--cms-22748

When You're Hacked in WordPress: Dealing With a Hacked WordPress Site
Feb 19, 2015 @ 10:50:30

On the NetTuts.com site today there's a new tutorial showing you what you can do when your WordPress site is hacked.

One of the worst things that can happen to your website just happened: It's been hacked. Somebody broke into your computer and got passwords, or your passwords were weak, or somebody exploited a security vulnerability caused by WordPress or your hosting provider, or something else happened that let a hacker hack your website...What do we do now? It's not the time to feel sorry for yourself, it's time to take action and bring back your website.

They start with a brief look at how a WordPress site might be hacked, not specific exploits, but topics and types of vulnerabilities. Following this they talk about thier recommended steps to do when the hack is discovered including:

  • Shut It Down NOW!
  • Contact Your Hosting Provider for Details
  • Find Out What Caused It and Take Action
  • Fix and Double-Check Everything and Go Live Again

Each step comes with a summary of the steps inside and even a "checklist" of things to verify before bringing the site back up.

tagged: wordpress hack remediation plan steps recommendation

Link: http://code.tutsplus.com/tutorials/when-youre-hacked-in-wordpress-dealing-with-a-hacked-wordpress-site--cms-22747

Piotr Pasich:
ClassManager - You shall not pass
Jan 30, 2015 @ 11:42:55

Piotr Pasich has shared some thoughts on naming in his latest post to his site today. In it he talks about one of the "hardest things in computer science" (naming things) and makes some recommendations to help you make naming in your code more effective.

Precise names for classes is notoriously difficult. Done right, it makes code more self-documenting and provides a vocabulary for reasoning about code at a higher level of abstraction. There are a couple simple tips&tricks to make the names more readable: do not abbreviate, do not add any extra informations (underscore, type), avoid single letter prefixes, etc etc.

But what if you already know and use those rules and you still want to improve naming in your code? I assume that you care, you’re not selfish and you think about elses when you write the code. You ask one of the most important question to yourself, during architecture implementation – how the fellow sitting next to will behave while reading the code.

He's broken up the remainder of the post into different sections, each with a high level recommendation and some follow up description:

  • Ask somebody else
  • Does it have a single responsibility you can name?
  • Simple Superclass Name
  • Qualified Subclass Name
  • Adding ‘Interface’ word

He ends with a few names to avoid (like *Manager, *Helper or *Handler) to help prevent ambiguity. He reinforces providing meaning in your naming and making it easier for others to understand what's going on.

tagged: classmanager naming opinion recommendation avoid meaning

Link: http://piotrpasich.com/classmanager-you-shall-not-pass/

SitePoint PHP Blog:
Create a Movie Recommendation App with Prediction.io – Implementation
Sep 16, 2014 @ 10:54:16

The SitePoint PHP blog continues their series about creating a movie prediction engine with Prediction.io in this second part focusing on implementation. In the first part of the series they set up the server and configuration to make the jump into the code. This second part gets more into the application side and features working code linking the prediction engine with the TheMovieDB API.

He jumps right into the code, showing how to:

  • Fetch the data from the TMDB (via Flight and Guzzle)
  • Populate the data back into the Prediction.io database
  • Picking a random movie from the list (and outputting it to a page)
  • Get movies the engine predicts as recommendations

The recommendations are based on ratings on other movies in the database with most of that logic happening behind the scenes instead of in the PHP script. The results are then output to the page along with the other movie data.

tagged: movie recommendation predictionio server tutorial api implementation

Link: http://www.sitepoint.com/create-movie-recommendation-app-prediction-io-implementation/

SitePoint PHP Blog:
Create a Movie Recommendation App with Prediction.io - Setup
Sep 15, 2014 @ 09:47:24

On the SitePoint PHP blog today Wern Ancheta has posted the first part of a series about creating a recommendation engine with the help of PHP and a system called Prediction IO.

In this tutorial, I'm going to walk you through Prediction IO, an open-source machine learning server. It allows you to create applications that could do the following: recommend items (e.g. movies, products, food), predict user behavior, identify item similarity and rank items. You can pretty much build any machine learning application with ease using Prediction IO. You don't have to deal with numbers and algorithms and you can just concentrate on building the app itself.

He walks you through the download and install of the Prediction IO software, how to start up the server and how to access its web interface. He shows you how to create an "engine" that will be used to make the recommendations and some of the settings allowing you to tailor it to your needs. The script will hook into The Movie DB API for content. He starts in on the PHP packages that will be needed to make the API connection and recommendations, but the actual code will come in a later article.

tagged: movie recommendation predictionio server tutorial api movie

Link: http://www.sitepoint.com/create-movie-recommendation-app-prediction-io-setup/

Why You Should Stop Stalling and Start Presenting
Jun 13, 2014 @ 11:47:01

In her latest post Snipe does her best to motivate those out there that have thought about speaking or presenting at a technology conference but are "stalling" and finding excuses not to. The post pulls from some of her own past experiences as a speaker in various communities, PHP and otherwise.

My last post generated a bit of buzz when it was posted to HackerNews recently, so I figured I’d take this opportunity to reiterate something I’ve been saying on Twitter for a while now. If you have never presented a conference before, make this the year you change that.

She breaks the rest of the post up into different reasons to stop making excuses and just do it:

  • It is an incredible experience that makes you better at other things
  • You will meet great people and learn about their experiences
  • Even if you suck the first time, it really is okay, even if it doesn’t feel like it at the time
  • It’s great for your career
  • If you are part of an underrepresented minority, your peers need to see you on that stage
  • Your audience is actually far more forgiving than you imagine
  • You’re smarter than you think. Things that are obvious to you are not obvious to everyone else
  • It feels really fucking awesome talking about stuff you care about

She also shares a few panic-aversion tactics she's worked up over the years including starting small, working with "power poses" and a reminder to use the "presenter view" feature in your presentation software of choice.

tagged: presentation conference speaking experience opinion recommendation

Link: http://www.snipe.net/2014/06/why-you-should-stop-stalling-and-start-presenting/