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

php[architect]:
April 2016 Issue Released - Off the Island: Drupal
Apr 04, 2016 @ 12:13:28

php[architect] magazine has released their latest issue for April 2016 - Off the Island: Drupal:

I’m excited to see the Drupal and PHP communities building bridges to collaborate (“Getting off the island” as Larry Garfield likes to say) and also learn from each other. This month, we’ll look at how the Drupal project has embraced tools and techniques like object-oriented programming and Composer.

This month's edition includes articles about:

  • Drupal 8 Module Development
  • Composer and Drupal 8
  • Drupal Security & Vulnerability Management (this month's free article)
  • Generating documentation from source code

As usual, the regular columns have come back for another edition - Community Corner, Security Corner, Education Station and Leveling Up. You can get a copy of this issue for your very own directly from the php[architect] site or pick up a yearly subscription while you're there.

tagged: phparchitect magazine april2016 drupal island drupal8

Link: https://www.phparch.com/2016/04/april-2016-off-the-island-drupal/

Symfony Finland:
Angular 2 Universal Rendering Coming to Symfony and Twig
Mar 29, 2016 @ 09:20:07

As is mentioned in this new post on the Symfony Finland site, the functionality allowing the Twig templating engine to perform Angular 2 Universal Rendering.

Angular is a household name when it comes to JavaScript frameworks. They've been going through a major transition since the announcement of Angular 2. In the latest development Angular 2 will be getting PHP / Twig support for isomorphic rendering.

[...] So the Angular and the Drupal development teams have started working together to bring Universal Rendering to PHP and Twig. The details remain murky on how exactly this will be implemented (using a Node.js server or a PHP library), but a PHP library (not an extension written in C) would be the easiest option for developers.

He points out that there's also a chance that the result could be coupled to Drupal (at least at first) but hopes are that it will end up as a generic component usable in any system using Twig. The post also includes links where you can find out more information about the topic of "Isomorphic Rendering" too.

tagged: angular2 rendering universal isomorphic drupal collaboration twig symfony

Link: https://www.symfony.fi/entry/angular-2-universal-rendering-coming-to-symfony-twig

Sound of Symfony Podcast:
Episode 11 - Looking forward to Symfony 4
Feb 04, 2016 @ 09:46:01

The Sound of Symfony podcast has come back and posted their latest episode with hosts Magnus Nordlander and Tobias Nyholm. In this latest episode (#11) they talk about Symfony 4 and look forward to some of the things they'd like to see in this future release.

Having recovered from SymfonyCon and had happy holidays, Sound of Symfony is back on the ether(net). This week we talk about what we'd like to see in upcoming versions of PHP and Symfony.

Other topics mentioned include:

  • Various Drupal initiatives
  • Sub-requests (a request to render just a partial page, not the whole thing through the HttpKernel)
  • Object-oriented CSS

You can listen to this latest episode either through the in-page audio player or by downloading the audio directly. If you enjoy the episode be sure to subscribe on iTunes to get the latest episodes as they're released.

tagged: soundofsymfony podcast ep11 symfony4 drupal subrequest, oop, css

Link: http://www.soundofsymfony.com/episode/episode-11/

Kinsta Blog:
The Definitive PHP 7.0 & HHVM Benchmark
Dec 09, 2015 @ 09:07:44

On the Kinsta blog Mark Gavalda has shared their latest PHP 7 versus HHVM benchmarks now that the first official stable release of PHP 7 has been unleashed for public consumption. They opted for testing with a large variety of tools and software rather than simple benchmarking scripts to give a more "real world" look at the difference between the two.

To see how much of an improvement we can expect from this new PHP interpreter we put the public release version of PHP 7.0 to test and compared a couple of popular software suites’ performance using PHP 5.6.16, PHP 7.0 and HHVM 3.10.1 on a bare metal server (so virtualization doesn’t interfere with the results). Tested software includes WordPress 4.3.1, Drupal 8, Magento 2.0 CE, OctoberCMS build 309, PyroCMS v3 beta2, and Flarum v0.1.0-beta.4.

The basic tl;dr of the post is that HHVM still performs better for all of the software tested but PHP 7 is not too far off on some of them. They share the specifications of the machine (bare metal) they used for testing and get into the results for each of the seven pieces of software tested. Their results are in transactions per second and both graphed and numeric results are shown. Unfortunately, though, the Flarum software had to be kept on a "pending" list as it doesn't run on either PHP 7 or HHVM properly.

tagged: hhvm php7 benchmark popular software wordpress drupal magento octobercms pyrocms flarum

Link: https://kinsta.com/blog/the-definitive-php-7-final-version-hhvm-benchmark/

Thijs Feryn:
The Drupal 8 origin story with Larry Garfield
Nov 23, 2015 @ 12:28:57

Thijs Feryn has posted the latest episode in his series of video interviews with members of the PHP community he's caught up with at conferences. In his latest show he talks with Larry Garfield, one of the more well-known members in the Drupal community about the latest milestone in Drupal, the release of Drupal 8.

Today, November 19th 2015, marks the release date of Drupal 8. To celebrate this release, I decided to publish my interview with Larry Garfield today.

Larry is a key member of the Drupal community and a core contributor to the project. Throughout the conversation, Larry tells us the origin story of Drupal 8 and how the technical challenges lead to the adoption of technology from the broader PHP community such as Composer, Twig and a set of Symfony Components.

I hope you like the interview, it gives a nice behind the scenes look at the history of Drupal 8 and how Drupal reached out to the PHP community to create a more modern code base.

You can watch the video either through the in-page video player or directly on YouTube. You can also check out his previous interviews in this archive section on his site.

tagged: thijsferyn interview larrygarfield drupal drupal8 community

Link: http://blog.feryn.eu/2015/11/19/the-drupal-8-origin-story-with-larry-garfield/

Thijs Feryn:
Interviewing Christian Wenz, talking about PHP, .NET & Las Vegas
Oct 28, 2015 @ 12:14:40

Thijs Feryn has posted his latest interview video he recoded while at the Zendcon conference in Las Vegas recently. In this new episode he talks with Christian Wenz about PHP, .NET and Las Vegas in general.

Last week I was in Las Vegas for Zendcon. I had the pleasure of catching up with my buddy Christian Wenz.

Christian lives in Munich and he co-owns Arrabiata Solutions. He’s also a consultant and focuses mainly on the web in general. The thing with Christian is that he is both a Microsoft MVP and an established PHP community member.In the interview we talk about the difference between PHP & .NET for web projects and also about both communities.

The second part of the interview is about Las Vegas. Sin City is a place you can love and hate at the same time. We talk about hotels, shows and more.

You can catch this latest episode either through the in-page video player or just the audio over on Soundcloud. If you enjoy the interview, be sure to check out the others he's done so far with other members of the PHP (and other) community.

tagged: thijsferyn interview christianwenz dotnet drupal drupalcon video

Link: http://blog.feryn.eu/2015/10/26/interviewing-christian-wenz-talking-about-php-net-las-vegas/

php[architect]:
Exporting Drupal Nodes with PHP and Drush
Oct 06, 2015 @ 11:09:11

The php[architect] site has posted a tutorial showing you how to export Drupal nodes with Drush and a bit of regular PHP. Drush is a command line tool that makes working with Drupal outside of the interface simpler and easier to automate.

Drupal 8 development has shown that PHP itself, and the wider PHP community, already provides ways to solve common tasks. In this post, I’ll show you some core PHP functionality that you may not be aware of; pulling in packages and libraries via Composer is a topic for another day.

The tutorial walks through a more real-world situation of needing to export a CSV file that shows a list of nodes added to the site after a specific date. He points out some of the benefits of doing it the Drush way and starts in on the code/configuration you need to set the system up. He shows how to create the Drush command itself and update it with a method to export the newest nodes (after validating the date provided). He makes use of a SplFileObject to output the results from the EntityFieldQuery query out into to the CSV file. He makes use of PHP's generators functionality to only fetch the records a few at a time. Finally he includes the command to execute the export, defining the date to query the node set and how to push that output to a file.

tagged: export drupal node drush commmandline csv output query generator

Link: https://www.phparch.com/2015/10/exporting-drupal-nodes-with-php-and-drush/

SitePoint PHP Blog:
Building Custom cTools Plugins in Drupal 7
Oct 05, 2015 @ 12:46:27

The SitePoint PHP blog has a tutorial posted showing you how to build custom cTools in Drupal that will integrate with the widely used cTools tool set.

cTools is one of those critical Drupal 7 modules many others depend on. It provides a lot of APIs and functionality that makes life easier when developing modules. Views and Panels are just two examples of such powerhouses that depend on it. [...] In this article, we are going to take a look at cTools plugins, especially how we can create our very own. After a brief introduction, we will immediately go hands on with a custom module that will use the cTools plugins to make defining Drupal blocks nicer (more in tune to how we define them in Drupal 8).

He starts by briefly introducing the cTools functionality and different types of plugins included in common use. He then moves on to the "block_plugin" handling and the custom functionality you'll be walked through - a plugin encapsulating a block and its related logic. He starts by defining the plugin type with a function the cTools can locate and the code it should contain. From there the code needed to turn a block plugin into a "Drupal block" is added including a prefix to "namespace" them out. Finally the view handling is implemented and a helper function is created to load the plugin. He then shows how to define one of the block plugins complete with a title, markup and type.

tagged: custom ctool plugins drupal block tutorial

Link: http://www.sitepoint.com/building-custom-ctools-plugins-in-drupal-7/

SitePoint PHP Blog:
How to Build Multi-step Forms in Drupal 8
Jul 07, 2015 @ 12:25:06

The SitePoint PHP blog has a post for the Drupal users out there showing you how to create multi-step forms in your application.

In this article, we are going to look at building a multistep form in Drupal 8. For brevity, the form will have only two steps in the shape of two completely separate forms. To persist values across these steps, we will use functionality provided by Drupal’s core for storing temporary and private data across multiple requests. In Drupal 7, a similar approach can be achieved using the cTools object cache. Alternatively, there is the option of persisting data through the $form_state array as illustrated in this tutorial.

They start by setting out what the end result will be - a simple two-page form with two fields each, allowing for navigation back and forth between the pages. They start with a base class defining requirements needed for both pages and setting up the necessary form structure. They walk through each part of this base class, explaining the functionality going along. With that in place they extend it with a "MultistepOneForm" and "MultistepTwoForm" classes extending the base and defining two fields on each.

tagged: tutorial drupal drupal8 multistep form

Link: http://www.sitepoint.com/how-to-build-multi-step-forms-in-drupal-8/

SitePoint PHP Blog:
Multiple Editors per Node in Drupal 7
Jun 11, 2015 @ 09:57:49

The SitePoint PHP blog has posted a new Drupal tutorial about allowing multiple editors to work on the same node of content.

have encountered a practical use case where the default configuration options are not enough. Namely, if you need to have multiple users with access to edit a particular node of a given type but without them necessarily having access to edit others of the same type. In other words, the next great article should be editable by Laura and Glenn but not by their colleagues. However, out of the box, users of a particular role can be masters either of their own content or of all content of a certain type. So this is not immediately possible. In this article I am going to show you my solution to this problem in the form of a simple custom module called editor_list.

He walks you through the process, first creating the .info file needed to define the module and the changes needed for the .module file. He creates a few helper functions to get the editor listing for a node and its matching access rules. With the module created he then gets into building the fields, again making helper methods to get the editors for the fields. Finally he "tidies up" and adds an "Authored on" section to the node editor with a helper function to receive and handle the results of this field when the form is submitted.

tagged: multiple editor drupal node field tutorial

Link: http://www.sitepoint.com/multiple-editors-per-node-drupal-7/