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

Zend Framework Blog:
Migrating to Expressive 2.0
Mar 14, 2017 @ 12:36:17

The Zend Framework blog has a tutorial they've posted showing you how to migrate up to Zend Expressive v2.0 from a v1.x application and some of the things that could break along the way.

Last week, we released Expressive 2. A new major version implies breaking changes, which often poses a problem when migrating. That said, we did a lot of work behind the scenes to try and ensure that migrations can happen without too much effort, including providing migration tools to ease the transition.

In this tutorial, we will detail migrating an existing Expressive application from version 1 to version 2.

Using this repository for a testbed, they walk through the steps for the update:

  • Creating a migration branch
  • Updating dependencies
  • using the zendframework/zend-expressive-tooling to aid in the migration
  • scanning your code to find possible breaking locations
  • moving over to the programmatic pipeline structure

They also include some bonus information covering self-invoking functions, the zend-config-aggregator and development mode. The post ends with the updates you'll need to make to middleware to implement the http-interop/http-middleware MiddlewareInterface.

tagged: zendframework zendexpressive v2 migration guide tool

Link: https://framework.zend.com/blog/2017-03-13-expressive-2-migration.html

Jef Claes:
How to organize a meetup
Feb 24, 2017 @ 09:24:25

If you've ever been interested in starting a technology-centric meetup in your area but haven't known where to start, Jef Claes has some helpful hints to help you get started.

I've organized a few DDDBE meetups in the past, and always succeed in forgetting something. Either someone points it out well in advance, or I end up stressing last minute. This post partly serves as a checklist for myself, but it would be a welcome side effect to also see it encourage others to help out organizing future meetups. Organizing a meetup is not rocket science, having a list of what to take care of is a good start.

He breaks down the recommendations into a list of ten things to do to make a successful meetup happen:

  • Contacting a speaker
  • Gathering speaker requirements
  • Selecting a location sponsor
  • Contacting a location sponsor
  • Meetup.com
  • Speaker gift
  • Recordings
  • Day of the meetup
  • Give thanks

While ten steps sounds like a lot, some of these are optional (like the speaker gift) but they can help to build a good reputation for the group and make it easier to find future speakers.

tagged: usergroup guide organize meetup technology top10

Link: http://www.jefclaes.be/2017/02/how-to-organize-meetup.html

Jeroen de Dauw:
Implementing the Clean Architecture
Feb 21, 2017 @ 10:41:45

In a recent post to his site Jeroen de Dauw looks at some of his own work and ideas around implementing clean architecture in PHP-based applications. The idea behind "clean architecture" is a focus on separation of concerns and dividing the systems into "layers" with contained logic in each.

Both Domain Driven Design and architectures such as the Clean Architecture and Hexagonal are often talked about. It’s hard to go to a conference on software development and not run into one of these topics. However it can be challenging to find good real-world examples. In this blog post I’ll introduce you to an application following the Clean Architecture and incorporating a lot of DDD patterns. The focus is on the key concepts of the Clean Architecture, and the most important lessons we learned implementing it.

In his post he looks at a real-world application (the Wikimedia Deutschland fundraising software) and how Domain Driven Design plays into the "clean" structure. He then walks through code examples, directory structures and lessons learned along the way (including bounded contexts and effective validation).

tagged: clean architecture tutorial guide domaindrivendesign designpattern

Link: https://www.entropywins.wtf/blog/2016/11/24/implementing-the-clean-architecture/

Toptal.com:
The Ultimate Guide to Building a WordPress Plugin
Dec 23, 2016 @ 12:07:41

For those newer to the world of WordPress, you might only be casually familiar with WordPress plugins and their use. You might have only installed them and used them before but have you wondered what it would take to make your own? In this new tutorial from Toptal.com Ratko Solaja gives you a "ultimate guide" to getting started down the road of custom WordPress plugin development.

Plugins are a vital part of WordPress websites that need specific functionalities. While the official WordPress repository has more than 45,000 plugins from you to choose from, many of these plugins miss the mark.

Just because a plugin is in the repository doesn’t mean it won’t hinder its performance or compromise its security. So what can you do? Well, you can build your own.

He starts with the planning stages of his example plugin (a real-world project helps when learning new things) - one that allows users to save content for later reading. He outlines the goals of the settings screen, how saving will work, messages to the user and what the "saved" screen will do. He recommends starting with a boilerplate plugin and working from there. He then goes through each step of the development process:

  • Handle activation and deactivation
  • Create a plugin settings page
  • Create the plugin functionality
  • Make the plugin modular
  • Generate translation files

The end result is a complete plugin with both the required frontend and backend functionality to make the "save content" feature work. All code is provided and plenty of links to more information and other resources are sprinkled throughout the article.

tagged: toptal wordpress plugin guide tutorial content example

Link: https://www.toptal.com/wordpress/ultimate-guide-building-wordpress-plugin

Zend Developer Zone:
Welcome to PHP
Nov 09, 2016 @ 11:05:02

It's no secret that PHP is one of the most popular languages for web development available. The language has enjoyed quite a bit of popularity over the years with more and more developers discovering and learning it all the time. On the Zend Developer Zone they've put together a guide just for those new to the PHP language and its community: Welcome to PHP.

Every day new developers discover the power of PHP and start looking for resources to help them learn more. It would be impossible to gather a complete list of all the resources, people, and projects that are useful to developers new to PHP. However, I decided it was time to put together a list designed to be starting point.

Ok, so all we need on the Internet is one more list. That having been said, I couldn’t think of a better way to organize this data other than into a list of lists. [...] Otherwise, here it is, presented to you in all its glory. If you like it, if you know someone new to PHP, please share it. I do hope that it is useful to anyone and everyone looking to get more involved or learn more. As the title says, Welcome to PHP!

The post is broken down into several sections (lists) including:

  • Language Resources
  • Community
  • Forums
  • Frameworks
  • News

There's plenty of links and descriptions of each resource linked to in these and a few other sections. If you're new to the world of PHP or even just looking to expand your horizons to more PHP-related things outside of your "developer bubble" check out the full post.

tagged: welcometophp language community guide introduction list resources

Link: https://devzone.zend.com/welcome-to-php/

Chike Mgbemena:
PHP 7 In-Depth Look
Nov 04, 2016 @ 11:58:51

Chike Mgbemena has posted a great guide for those out there still getting familiar with what PHP 7 has to offer and things to watch for when migrating your PHP 5.x code up to this latest version.

PHP 7 was released on 03 Dec 2015, and so many people have not yet started using or learning about the awesome features it has. I wrote this post to give a breakdown of the features released with PHP 7 for those that have not yet learnt about them and even if you know it, you might still learn something from this post.

Rasmus Lerdorf (creator of PHP) claims that apps running PHP 7 performance is improved by 100% or more. Memory usage is lower also, so if you are running a lot of servers, PHP 7 is an essential upgrade. One of the big changes in PHP 7 is the refactored ZEND Engine(PHPNG) which is now faster, memory usage reduced and a “green” version of PHP which makes you run less hardware to run your code.

He starts with a list of things that have been removed from PHP 7 including the MySQL extension (not mysqli), posix regular expression handling and the deprecation of the "salt" option in password hashing. He goes on to talk about some of the new things that come with PHP 7 including:

  • the "spaceship" operator
  • allowing constants to be defined as arrays (previously just strings)
  • the random_bytes and random_integer functions

He also covers one of the most major changes in PHP 7: the inclusion of type hinting and checking, generators, error handling updates and a few other miscellaneous changes.

tagged: php7 indepth language changes guide

Link: http://chikemgbemena.com/2016/10/29/php-7-in-depth-look/

Paragon Initiative:
Securing a PHP Application in 2016: The Pocket Guide
Jul 11, 2016 @ 12:45:11

The Paragon Initiative has posted a new tutorial giving you a pocket guide version to securing your PHP application in 2016.

Please set aside most of what you've heard over the years; chances are, most of it just muddies the water. Security is not a product. Security is not a checklist. Security is not an absolute.

Security is a process. Security is an emergent property of a mature mindset in the face of risk.

Perfect security is not possible, but attackers do have budgets. If you raise the cost of attacking a system (your application or the networking infrastructure it depends on) so high that the entities that would be interested in defeating your security are incredibly unlikely to succeed, you'll be incredibly unlikely to be compromised.

The post talks about the "essence of security" and how most prevention methods don't even add much processing overhead or overall development time. He makes four recommendations of things to do in current and future development to help secure your applications:

  • Use PHP 7 in All New Development
  • Use HTTPS Everywhere
  • Use Security Headers
  • Use Trustworthy Reference Material

The post ends with a few other things to think about when building secure applications including raising the "cost" of attacking your system and keeping in mind that your platform may not be the attacker's "end game".

tagged: paragoninitiative secure application pocket guide top4 php7 https headers references

Link: https://paragonie.com/blog/2016/07/securing-php-application-in-2016-pocket-guide

Torben Köhn:
PHP Generators – A Guide and Tutorial
Jun 22, 2016 @ 13:45:44

For those that may have heard about generators but aren't too familiar with them or what they do, Torben Köhn has posted a great introduction to them and their functionality.

In my in-depth guide about iterators I talked about what iterators are exactly and how you can use them. At the end I told you that I’ll also write one for generators. Here it is.

First off, if you don’t know what an iterator is and you’d not be able to explain to someone else what it is, you will not have much fun with this because you won’t exactly recognize the use-cases. I suggest you read my iterator-guide first. After this, don’t get scared off by some confusing words used here, I’ll try to clarify every single one.

He breaks up the rest of the post into different sections, each walking you through different aspects of generators:

  • What is a generator?
  • The yield-keyword
  • Iterating a generator
  • Yielding keys
  • Yielding in a loop
  • An infinite generator

He wraps up the post sharing some real use-cases for generators to help you understand them with a bit more practical application (including stacking them, file system handling and co-routines).

tagged: generators tutorial introduction guide beginner

Link: http://tk.talesoft.io/2016/06/06/php-generators-a-guide-and-tutorial/

SitePoint PHP Blog:
Contributing to PHP: How to Fix Bugs in the PHP Core
Apr 12, 2016 @ 10:37:27

On the SitePoint PHP blog Thomas Punt continues his series about how you can contribute back to the PHP language. In his previous post he talked about contributing to the PHP manual. In this latest part of the series he moves into something with a bit more complexity: contributing to the core of the language itself.

Previously, we covered contributing to PHP’s documentation. Now, we will be covering how to get involved with PHP’s core. To do this, we will be looking at the workflow for fixing a simple bug in the core.

Since submitting new features to PHP has already been explained pretty well, we will not be covering that here. Also, this article does not seek to teach PHP’s internals. For more information on that, please see my previous posts on adding features to PHP.

In this article he assumes you at least already have a working knowledge of the PHP source and how to locate/update code and execute it. He focuses instead on the bugfix process and workflow needed to:

  • find a bug to fix
  • create a test to reproduce the issue
  • use a debugger to find the exact spot where the problem is
  • and create a simple fix

In this case it's a pretty simple issue to correct, but there are much more complex things that would require more work than just a simple "if" check. This guide can help you get started on the correct workflow, however, and be sure you're handling things as the project expects.

tagged: contribute fix bug core language guide workflow test phpt

Link: http://www.sitepoint.com/contributing-to-php-how-to-fix-bugs-in-the-php-core/

Adam Culp:
Setting up step debugging in Zend Studio
Apr 11, 2016 @ 11:52:43

Adam Culp has posted a guide on his site showing you how to set up debugging in Zend Studio, the PHP IDE from Zend. In it he walks you through the setup on both the server and client side to get them working happily together.

Recently I was helping someone set up step debugging in Zend Studio, and had some difficulties. Therefore I decided to create a blog post to remind me later, and perhaps help others get it set up.

I was doing this on an Ubuntu laptop, so while menus may vary slightly the process should be very similar. Also, I did this using a local virtual machine in VirtualBox, but using Bridged networking mode to simulate a remote server. In Zend Studio I had a project created with the Zend Framework Skeleton Application, and created a virtualhost in the virtual environment that mirrored that.

He starts with the server, pointing out that the only thing really needed there is an installed and working version of Xdebug. He then goes through each step in the IDE, complete with screenshots:

  • Configuring the server in the Preferences
  • Testing the connection between the two
  • Enabling debugging on the project
  • Ensuring the server is configured correctly to use debugging when specified

While some of his instructions are more specific to a Zend Server installation, they can still be mostly applied to any kind of system. You can also check the Xdebug documentation for additional help.

tagged: debugging zendstudio guide zendserver configuration testing xdebug

Link: http://www.geekyboy.com/archives/1220