Hayden James has a post on his site sharing a method he's found for getting better performance out of PHP-FPM with the help of a configuration change. In this tutorial he shows how to use the pm static setting to squeeze the best performance out of your web server.

Lets take a very quick look at how best to setup PHP-FPM for high throughput, low latency and a more stable use of CPU and memory. By default, most setups have PHP-FPM’s PM (process manager) string set to dynamic and there’s also the common advice to use ondemand if you suffer from available memory issues.

He starts by defining the three "pm" settings and what they do: dynamic, ondemand and static. He then talks some about how the PHP-FPM process manager is similar to CPUFreq Governor and the settings it allows. Finally he gets into talking about the "pm static" handling, how it relates to available memory and when it makes more sense to use "dynamic" over "static".

The TutsPlus.com site has posted the third part of their "Dynamic Page Templates in WordPress" tutorial series today. In this latest article author David Gwyer finishes off the series using all that they've shared from part one and part two to create two examples.

In the first two parts of this tutorial series, we covered what dynamic page templates were and why they were needed. We also looked at the code required to implement them.

In this third and final tutorial in the series, I'll be creating two examples of fully working dynamic page templates you can use in your own projects. These were specifically chosen to be easily extendable to suit your own needs, and are intended as inspiration for any other type of dynamic page templates you can think of.

He then walks you through the creation of the two page templates: a Simple Contact Form and a Blog Post Archive. The first allows you to dynamically control the form elements for a UI interface (rather than code) and the second uses dynamic data to display the list of previous blog posts. The tutorial then finishes with a look at how, since WordPress 4.7, you can use dynamic page templates with any kind of post, not just pages.

The Star Tutorial site has a new article posted showing you how to create a system based on Glide and the Slim framework to dynamically resize images with a few simple URLs.

If you have ever used WordPress.com backend. You will notice its image resizing works by appending a dimension string at the end of the URL.

In this tutorial, we will show you how to do that for your own project. At the end of this tutorial, you will have an image resizing server that is able to give you specific dimension upon request.

The tutorial starts with a basic introduction to the Glide image manipulation tool and how to get a Slim installation up and running. They then help you install the league/glide-slim package to help link the two. With those in place, they show you how to build out the resizing code using the ServerFactory handling to grab the image, passing in the URL parameters to tell Glide how to manipulate the image.

Matthias Noback has continued his series looking at using Sculpin to create static pages for "in-project documentation" with this second post focusing more on the creation of "virtual pages". These pages allow the insertion of dynamic content into pages pulled from other sources (in this case, from the source of the project).

Previously we looked at how to use the static site generator Sculpin to generate in-project documentation. When Sculpin builds the HTML files and assets it looks at what files are in the source/ directory and processes them based on certain rules (e.g. "parse Markdown files", "format HTML files with Twig", etc.). The purpose for my "living documentation" project is to also dynamically generate documentation based on PHP and configuration files from the main project.

[...] The Sculpin documentation mentions several ways to generate dynamic content for a static site, as opposed to the standard way of adding static Markdown or HTML files. [...] So, I dug into the source code of Sculpin to find out what would be a reasonable extension point. It turned out that the best way to approach this was to create a custom data source (which is currently not documented).

He then walks you through the creation of a custom data source with "dataSourceId" and "refresh" methods the tool uses to pull in the dynamic data. He shows how to set up the script to be called at any time and have the same effect (Sculpin does this when the "server" is running) and defining the service in your Sculpin configuration.

On the SitePoint PHP blog Christopher Pitt is back with another interesting article, this time talking about two "delicious evils of PHP" - the eval and exec functionality.

I want to look at two PHP functions: eval and exec. They’re so often thrown under the sensible-developers-never-use-these bus that I sometimes wonder how many awesome applications we miss out on.

Like every other function in the standard library, these have their uses. They can be abused. Their danger lies in the amount of flexibility and power they offer even the most novice of developers. Let me show you some of the ways I’ve seen these used, and then we can talk about safety precautions and moderation.

He then talks about some of the "interesting" things you can do with these two pieces of functionality including:

Dynamic Class Creation

[Creating] Domain Specific Languages

Parallelism (with exec)

He ends the post with some advice how to avoid issues with the topics he's mentioned and how to "stay safe" while still using these two dangerous pieces of functionality.

On the TutsPlus.com site today there's a new tutorial posted for the Drupal-ers out there showing you the right way to inject dependencies in a Drupal 8 application.

As I am sure you know by now, dependency injection (DI) and the Symfony service container are important new development features of Drupal 8. However, even though they are starting to be better understood in the Drupal development community, there is still some lack of clarity about how exactly to inject services into Drupal 8 classes.

They start by talking about how most of the current examples just show the static injection of dependencies but that that's not the only way. The article shows how to inject other services into existing services via a simple change to the service definitions. They also talk about "non-service classes" and injecting values there as well (including controllers, forms and plugins).

In this new tutorialZsolt Szende talks about dependency injection and how to handle objects and related needs at runtime rather than the pre-configured method that some injection containers/systems have defined.

In this short article I would like to demonstrate a way to inject dependencies that are not known until runtime. There are many use cases for this and in essence it is about choosing between concrete implementations of some common interface. In object oriented design this is known at the Strategy pattern. The choice itself can be made in various ways, for example via a configuration option or a command line parameter in case of a console command, and I think the dynamic nature of the choice is the most interesting part of the pattern.

The article provides a practical example of an XML/JSON reader pulling information from an external source. A simple interface is defined and two implementation classes put it to use. Then the "command" pattern is used to apply it to an executable script and how injecting a reader type directly overrides the one from the provided option. This is taken a step further and refactored into a "resolver" to determine the best logic to apply based on the input argument.

In the latest episode of the Full Stack Radio podcast - episode #10, host Adam Wathan has two guests to talk about programming in a language with dynamic types versus static types.

In this episode, Adam talks with Ryan Tablada and Matt Machuga about the philosophical differences between programming in a statically typed language vs. a dynamically typed language. They talk about things like explicit interfaces vs. duck typing, function calling vs. message passing, and some of the recent RFCs around optional typing in the PHP community.

Bernhard Schussek has written up a new post to the Web Mozarts blog talking about resource discovery with Puli. Puli is a management tool for the non-PHP files in your applications (CSS, Javascript, YAML, etc). In this post he talks about the use of the discovery component and its use of resource binding.

Many libraries support configuration code, translations, HTML themes or other content in files of a specific format. The Doctrine ORM, for example, is able to load entity mappings from special XML files. When setting up Doctrine, we need to pass the location of the *.dcm.xml file to Doctrine’s XmlDriver. That’s easy as long as we do it ourselves, but what if someone else uses our package? How will they find our file? What if multiple packages provide *.dcm.xml files? How do we find all these files? We need to remove the appropriate setup code after removing a package [and] we need to adapt the setup code after installing a new package. Multiply this effort for every other library that uses user-provided files and you end up with a lot of configuration effort. Let’s see how Puli helps us to fix this.

He talks about the concept of package roles in the tool, breaking them down in resources and providers. He then shows how Puli makes it possible to discover resources by defining a type via Puli and the code for the discovery process. He then binds the XML configuration definition and executes a "find" to ensure it's configured correctly. Finally, he shows the process to use Puli in this Doctrine example allowing it to locate and use the XML mappings dynamically via a custom driver.