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

Zend Blog:
Modern cryptography in PHP 7.2 with Sodium
Nov 16, 2018 @ 12:14:24

On the Zend blog there's a new tutorial posted by Enrico Zimuel covering the use of libsodium in PHP 7.2 to provide stronger encryption for your data.

Recently, at ZendCon & OpenEnterprise 2018, I presented a session about the usage of Sodium in PHP 7.2. Here you can find the slides of this session.

Sodium is a powerful library for modern cryptography. It is a portable, cross-compilable, installable and packageable fork of NaCl, a famous cryptographic tool designed by Prof. D.J. Bernstein.

The tutorial begins with an outline of the Sodium encryption including the algorithms it can use and how it helps to prevent side-channel attacks. It then lists out some of the common use cases and provides a simple code sample showing how to use it to encrypt a simple message with a randomly generated key.

tagged: cryptography modern libsodium tutorial introduction

Link: https://blog.zend.com/2018/11/06/modern-cryptography-in-php-7-2-with-sodium/#.W-7xpJNKi-o

StarTutorial.com:
Modern PHP Developer - Exception
Oct 30, 2018 @ 13:49:38

The StarTutorial site has posted the latest in their "Modern PHP Developer" series of posts outlining some of the more recent changes to PHP and its ecosystem that can help you become a better developer. In this latest post they focus on Exceptions in PHP - the types, handling them and when they're most useful.

Since PHP 5 was released, Exception is added to PHP as an object-oriented programming language feature. By definition, an Exception is an exceptional event during program execution. In PHP, an Exception is simply an object (an instance of Exception class). When an exception occurs, PHP will halt current execution flow and look for an handler, and then it will continue its execution by the handler's code. If no handler is found, a PHP Fatal Error will be issued with an "Uncaught Exception ..." message and the program terminates.

The tutorial is then broken down into several parts:

  • When to use Exception
  • How to use Exception
  • Create your first custom exception 5.3
  • SPL exceptions
  • RuntimeException

For each item in the list, there's a summary of the topic and code examples to help illustrate the points made.

tagged: tutorial modern developer exceptions series

Link: https://www.startutorial.com/articles/view/modern-php-developer-exception

StarTutorial.com:
Modern PHP Developer - Iterator
Oct 16, 2018 @ 12:08:16

StarTutorial has continued their "Modern PHP Developer" series of tutorials with their latest covering the use of Iterators for working with sets of data.

If you have used a for loop in PHP, the idea of iteration is most likely not foreign to you. You pass an array to a for loop, and perform some logic inside the loop, but did you know that you can actually pass data structures other than arrays to a for loop? That's where Iterator comes into play.

The tutorial starts by introducing some of the basic concepts of what iterators are and how they're represented in PHP in their most basic form: arrays. They cover some of the basic array handing and functions before getting into the actual Iterator object handling. The article is then broken up into a few parts covering iterators and their functionality:

  • Your first iterator class
  • Why iterator?
  • SPL Iterators
  • ArrayObject vs SPL ArrayIterator
  • Iterating the File System
  • Peeking ahead with CachingIterator
  • Generator

Code and a summary of the functionality is included in each section providing you with a great start towards using iterators over simple arrays in your modern PHP applications.

tagged: developer tutorial introduction modern iterator

Link: https://www.startutorial.com/articles/view/modern-php-developer-iterator

Adnan Ahmed:
Modern Backend Developer in 2018
Apr 05, 2018 @ 12:55:05

On his Medium.com site, Adnan Ahmed has shared some of his thoughts about being a modern backend developer in 2018. In it he talks about the current state of backend development and makes some recommendations for those wanting to get started.

Web development today is completely different from what it was a few years ago; there are lots of different things that can easily baffle anyone entering into the web development. It was one of the reasons that we decided to make these step by step visual guides demonstrating the bigger picture and to give anyone a clear idea about what they have to follow to be in certain roles in web development.

The post starts with a large infographic showing the basic steps and some of the related technologies and concepts to go with them. Following this they break it down into more detail in a text form with summaries attached for each. There are a lot of topics in the list (24 of them) but here's some of the highlights:

  • Learn a Language
  • Learn a Package Manager
  • Standards and Best Practices
  • Security
  • ?Learn about the Relational [and NoSQL] Databases
  • Learning a Framework
  • Caching
  • RESTful APIs
  • Different Auth Methods
  • GraphQL [and Graph Databases]

His final recommendation is one that's good for beginners and veterans in the software development world alike: "keep exploring". If you stop learning and stop trying new things you'll stagnate in your own work and career. Challenge yourself to learn something new - a new language, tool or technique - as often as possible and apply it to your work.

tagged: modern backend developer 2018 summary steps recommendations

Link: https://medium.com/tech-tajawal/modern-backend-developer-in-2018-6b3f7b5f8b9

php[architect]:
November 2017 Issue Released - Modern Magento
Nov 07, 2017 @ 11:30:20

php[architect] magazine has released their latest issue - the November 2017 edition, "Modern Magento".

Articles in this month's issue include:

  • 11 Debugging Tricks in Magento by Sergii Kovalenko
  • Editing the Magento Core For Fun and Profit by Joshua Warren
  • Command and Query API Design in Magento 2 by Igor Miniailo
  • Headless and Serverless: Writing Modern PHP Applications by Eugene Tulika

All of the usual columns are returning too including the "Education Station", "Community Corner" and "Artisanal". This month's issue is completely free to give you an idea of what kind of content you can expect from the magazine. You can pick up a copy of your own (or subscribe for the year) over on the php[architect] site.

tagged: phparchitect magazine november2017 modern magento issue release

Link: https://www.phparch.com/magazine/2017-2/november/

SitePoint PHP Blog:
Are Bitwise Operators Still Relevant in Modern PHP?
Aug 22, 2017 @ 11:16:47

In a post to the SitePoint PHP site editor Bruno Skvorc wonders if bitwise operators are still relevant in modern PHP development.

Many of you probably scratched your heads reading this title. “Bitwhat?”

In this article, we’ll look at what bitwise operators are, and whether or not their use is still relevant in this modern age of computing.

He starts off by illustrating a common use case for the bitwise operators in evaluating user permissions. He first proposes doing things on the database side, creating tables for double or single joins that could get us the information we need. He also shows an approach for what he calls a "column stampede": adding a new column to the user table when a new permission is needed. Instead he proposes the bitwise option, first explaining how values are stored and then showing how with a single value, you could potentially store all of a user's permissions in one field. Next he shows how to perform the select to determine of a user has a set of permissions and how to store them when making an insert/update.

tagged: bitwise operator modern development permission calculation tutorial

Link: https://www.sitepoint.com/bitwise-operators-still-relevant-modern-php/

Medium.com:
10 Modern Software Over-Engineering Mistakes
Oct 19, 2016 @ 12:45:19

In this recent post to his Medium.com site Subhas Dandapani shares what he sees as the top ten modern software over-engineering mistakes developers make in modern application development.

Few things are guaranteed to increase all the time: Distance between stars, Entropy in the visible universe, and Fucking business requirements. Many articles say Don't over-engineer but don’t say why or how. Here are 10 clear examples.

Important Note: Some points below like “Don’t abuse generics” are being misunderstood as “Don’t use generics at all”, “Don’t create unnecessary wrappers” as “Don’t create wrappers at all”, etc. I’m only discussing over-engineering and not advocating cowboy coding.

Points in his "top ten problems" list include:

  • Engineering is more clever than Business
  • Everything is Generic
  • Shallow Wrappers
  • Overzealous Adopter Syndrome
  • In House “Inventions”

Each item in the list comes with a bit of explanation and an image or two where appropriate. There's definitely some things in here that are a bit debatable, but development has and will always have a file line between over-engineering and "just the right amount" of work. The trick is figuring out where that line is for your development work.

tagged: top10 list modern software overengineering engineering mistake opinion

Link: https://medium.com/@rdsubhas/10-modern-software-engineering-mistakes-bc67fbef4fc8#.byuwr484j

Symfony Finland:
Learn Symfony and modern PHP with Bolt 3.0 - a Silex powered CMS
May 11, 2016 @ 09:36:53

On the Symfony Finland site there's a new article posted about the recently released v3.0 of the Bolt CMS and details about this Silex-powered, modern PHP-based system.

On Tuesday 10th of May the development team released a new major version of Bolt CMS. The Open Source content management system is a lightweight and easy to use tool for managing websites and blogs. In addition it's perfect for learning modern PHP development practises.

The third major version of Bolt continues on the path, being an evolution rather than a revolution. The CMS is built on the Silex microframework based on the Symfony PHP components.

The article talks about the "solid foundation" of Silex and good project management skills of the team behind it. They then get into the installation of the tool and some of the libraries that it uses to get the job done (including Twig and YAML handling). They also list some of the things that are new in the v3.0 of the CMS including:

  • A new extensible Storage layer
  • Backend UI refresh
  • Improved tests / code coverage
  • New documentation
  • Web asset queues, and easier to keep files out of webroot

There's also mention of some of the things that were removed and didn't make the cut to be included in the release. The post ends with links to other resources where you can find out about Bolt, get its source and a few other articles about people putting it to use.

tagged: bold cms silex symfony modern release v3 overview installation

Link: https://www.symfony.fi/entry/learn-symfony-and-modern-php-with-bolt-3-0-a-silex-powered-cms

Acquia Blog:
Quick Tips for Writing Object Oriented Code in PHP
Jul 13, 2015 @ 10:58:14

On the Acquia blog Adam Weingarten has shared some tips for writing good (and modern) object-oriented code in PHP:

Recently I began working on a D8 module, but this isn't a story about a D8 module. The work I did provided me an opportunity to get back to my pre-Drupal object oriented (OO) roots. Writing OO code in PHP presented some curve balls I wasn’t prepared for. Here are some of the issues I encountered:

His tips touch on things like:

  • Using a code structure that can be autoloaded via PSR-4
  • Namespacing your classes
  • Working with types and type hinting
  • Using docblock comments for autocomplete in IDEs

There's also a few other quick topics he finishes the post out with: the lack of enums in PHP, working with associative arrays, no functional overloading and assigning responsibility to classes.

tagged: oop tips objectoriented code modern psr4 namespace typing docblock missing

Link: https://www.acquia.com/blog/quick-tips-for-writing-object-oriented-code-in-php/09/07/2015/3285651

IBM developerWorks:
PHP renewed: Password security in modern PHP
Apr 17, 2015 @ 08:53:15

The IBM developerWorks site has a new tutorial posted talking about how PHP has been "renewed" in recent versions, more specifically in the password security department.

When PHP was first crafted in the mid-1990s, the term web application didn't even exist yet. Password protection, then, wasn't one of the features that the PHP creators devoted resources to. After all, you didn't need to worry about passwords when you used PHP just to put a site-visit counter or a date-modified stamp on your web page. But 20 years have passed, and now it's almost unthinkable to create a web application that doesn't involve password-protected user accounts. It's of the utmost importance that PHP programmers safeguard account passwords by using the latest and most secure methods.

The article goes on to talk about the importance of using secure hashing methods for password storage, the speed at which "cracking" programs can run and the use of "rainbow tables". It then gets into some of the older methods commonly used for password storage and protection and shows how to refactor them into the new password hashing functionality introduced in PHP 5.5.

tagged: password security hashing renewed modern language release

Link: http://www.ibm.com/developerworks/web/library/wa-php-renewed_2/index.html