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

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/

HHVM Blog:
Lockdown Results and HHVM Performance
Jun 10, 2015 @ 09:02:59

The HHVM blog has a new post today sharing the results of their first open source lockdown. During this time they worked to improve not only HHVM itself but how well it supports other open source projects using it as a platform.

The HHVM team has concluded its first ever open source performance lockdown, and we’re very excited to share the results with you. During our two week lockdown, we’ve made strides optimizing builtin functions, dynamic properties, string concatenation, and the file cache. In addition to improving HHVM, we also looked for places in the open source frameworks where we could contribute patches that would benefit all engines. Our efforts centered around maximizing requests per second (RPS) with WordPress, Drupal 7, and MediaWiki, using our oss-performance benchmarking tool.

They share some of the benchmark improvements made by the updates during the session including performance boosts for WordPress & MediaWiki. They also talk about the community involvement during the event and updates made to their own tooling too. The post then spends some time talking about their methodology on development and testing during the lockdown and how the results compare pre- and post-lockdown. The remainder of the post looks at some more specific issues and covers a few technical notes about software used and how the results were reported.

tagged: hhvm lockdown opensource benchmark improvement wordpress drupal mediawiki results

Link: http://hhvm.com/blog/9293/lockdown-results-and-hhvm-performance

Kinsta Blog:
HHVM vs PHP 7 – The Competition Gets Closer!
May 26, 2015 @ 10:19:02

In this new post to thier blog Kinsta shares benchmark results comparing PHP 7 to HHVM, both in their own experience and some shared from other companies too.

A few years ago, engineers at Facebook went on a swashbuckling mission to rebuild the foundation of the world’s most populated social network struggling to sustain acceptable performance levels. PHP was all the rage a decade ago when Facebook was gaining steam and pursuing a global target audience.

As they put it the "competition is getting closer" and the performance gap between the two is growing smaller and smaller. They talk some about the performance improvements and new features that are being worked into PHP 7 and some speculations around a Just-In-Time engine and asynchronous programming features. Then comes the benchmarks. They provide the specifications of the machine they tested on and the results of tests runs of WordPress and Drupal (based on requests per second). The rest of the article talks about two stories from other companies using HHVM, Etsy and WikiMedia, and some of the lessons that have been learned along the way.

tagged: hhvm php7 performance benchmarks mediawiki etsy wordpress drupal

Link: https://kinsta.com/blog/hhvm-vs-php-7/

Mikkel Høgh:
Drupal is still a gated community
May 25, 2015 @ 10:16:42

In a recent post to his site Mikkel Høgh makes the suggestion that Drupal is still a gated community, mostly as it relates to the process around the "Project Applications" process.

One of the things the Drupal community prides itself on, is how open the community is. And that is generally true, but there's one exception. And that is the Kafkaesque horror-show we subject any newcomers that would like to publish their code on Drupal.org to. It goes by the name of “Project Applications“. I know several people who've hit this wall when trying to contribute code. It's not uncommon to wait several months to get someone to review your code. And when it does happen, people are often rejected for tiny code style issues, like not ending their comments with a period or similar.

He talks about other factors involving reviews and delays that can also cause authors to abandon their work and feel "unwelcome and unappreciated". He mentions the "review bonus" system and how it's used to encourage participation (or "more hoops" as he puts it) from other authors. He notes that this situation mostly relates to those new to the tool and community and suggests that it just doesn't work (and really is unnecessary). He ends the post with a call to "end the madness" and move to a standardized role that would allow developers to publish without pushing people away and making them feel unwelcome.

tagged: opinion drupal walledgarden project applications review delay contribution

Link: http://mikkel.hoegh.org/2015/05/14/drupal-is-still-a-gated-community/

SitePoint PHP Blog:
Integrate Elasticsearch with Silex
Apr 13, 2015 @ 08:38:55

The SitePoint PHP blog has continued their look at integrating Elasticsearch into a simple Silex-based PHP application. In this latest part of the series (part two) they move away from the full Drupal example in part one and go a bit more simple and create a basic site to show a node's detail (content and title).

In the previous article I started exploring the integration between Drupal 7 and the Elasticsearch engine. The goal was to see how we can combine these open source technologies to achieve a high performance application that uses the best of both worlds. [...] We’ll now create a small Silex application that reads data straight from Elasticsearch and returns it to the user.

Using Silex and the same Elasticsearch PHP SDK they create this simple site. The tutorial walks you through the installation of both tools, the configuration of the Elasticsearch client and creating the controllers to respond to the view requests. They also show how to use the Twig templating engine to render the results as a simple page containing the node title, any images attached to it and the body content. The tutorial ends with a brief mention of how this same data could also be rendered as JSON output with a different view handler.

tagged: silex tutorial elasticsearch simple twig template json node drupal

Link: http://www.sitepoint.com/integrate-elasticsearch-silex/

SitePoint PHP Blog:
Install and Integrate Elasticsearch with Drupal
Apr 10, 2015 @ 10:37:55

The SitePoint PHP blog has a recent tutorial posted showing you how to integrate Drupal and Elasticsearch to make for more effective searching of your content. This is the second part of this series.

In this tutorial I am going to look at the possibility of using Drupal 7 as a content management system that powers another high performance application. To illustrate the latter, I will use the Silex PHP microframework and Elasticsearch as the data source. The goal is to create a proof of concept, demonstrating using these three technologies together. [...] The tutorial will be split into two pieces, because there is quite a lot of ground to cover. In this part, we’ll set up Elasticsearch on the server and integrate it with Drupal by creating a small, custom module that will insert, update, and delete Drupal nodes into Elasticsearch.

They assume you already have an Elasticsearch install set up and ready to go but do offer some suggestions on how to configure it to be a little bit more secure. Then, in your Drupal application (again, already installed) they show you how to use the Elasticsearch module to connect to the ES instance and, once connected, insert, update and delete data for the data in your nodes.

tagged: tutorial elasticsearch drupal integrate node storage

Link: http://www.sitepoint.com/install-integrate-elasticsearch-drupal/

SitePoint PHP Blog:
First Look at Platform.sh – a Development and Deployment SaaS
Mar 23, 2015 @ 11:24:36

In this latest post to the SitePoint PHP blog Chris Ward takes a "first look" at the Platform.sh development and deployment service.

Not so long ago, many of us were satisfied handling deployment of our projects by uploading files via FTP to a web server. [...] The old methods for deploying became unstable, unreliable and (generally) untrusted. [...] So was born a new wave of tools, services and workflows designed to simplify the process of deploying complex web applications, along with a plethora of accompanying commercial services. Generally, they offer an integrated toolset for version control, hosting, performance and security at a competitive price. Platform.sh is a newer player on the market, built by the team at Commerce Guys, who are better known for their Drupal eCommerce solutions.

He talks about some of the requirements for using the service (including Drush, the Drupal command line tool) and how to get started with a new project. He shows how to get the codebase with their CLI tool, pushing SQL data up to the instance, and starting in on some development work. He shows how to configure the modules you want to use and adding some additional content to the data. He also covers some of the other features of Platform.sh including: performance and profiling tools and integration with Redis, Solr and the EntityCache/AuthCache tools.

tagged: platformsh drupal deployment development platform saas introduction

Link: http://www.sitepoint.com/first-look-platform-sh-development-deployment-saas/

SitePoint PHP Blog:
Exploring the Cache API in Drupal 8
Feb 26, 2015 @ 11:41:45

On the SitePoint PHP blog today there's a new tutorial (by Daniel Sipos) talking about the Drupal 8 cache and showing how to use it in an example, caching the latest post data pulled from the Drupal content.

Drupal 8 comes with many improvements over its predecessor we have grown to both love and hate. Next to prominent systems such as Views in core, configuration management or a useful translation service, there are also less known changes but that are equally important to know and use. One such improvement has been the cache API that solves many performance problems we have in Drupal 7.

They start with a basic introduction to the new cache handing and how the caches are separated out into different "bins" rather than all stored in one place. He includes sample code showing how to: save data to the cache, getting information back out and invalidating the cache to be handled by garbage collection. He also covers the cache tags, a feature that allows you to "tag" items across multiple caches and remove/invalidate them all at the same time. He wraps up the post getting into the more practical example showing the caching at work in a controller caching the contents of the posts to the Drupal site.

tagged: drupal cache drupal8 tutorial introduction improvement

Link: http://www.sitepoint.com/exploring-cache-api-drupal-8/

SitePoint PHP Blog:
Push your Drupal Site’s Events to your Phone with Pushover
Feb 12, 2015 @ 12:54:12

The SitePoint PHP blog has a new tutorial posted (by Daniel Sipos) about pushing notifications from your Drupal-based application via the Pushover service.

In this article I am going to show you how you can integrate Pushover with your Drupal site. I will illustrate a couple of examples of how you can use Pushover to notify yourself as soon as something happens on your site. The code I write in this article is also available in this repository so you can just clone that if you want to follow along.

He starts with an introduction to Pushover and what kinds of features it offers for the handling of push messages (with the app being not free, but "very affordable"). He help you get everything you need set up including a Pushover account and the Pushover class to use in a custom Drupal module. He includes the code you'll need to configure the module to use the library and a method to create the Pushover class instance. He then shows how to send messages for things like the addition of a new comment and user login via hooks, sending a message when an administrator logs in.

tagged: drupal tutorial pushover push message service mobile application

Link: http://www.sitepoint.com/push-drupal-sites-events-phone-pushover/