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

Matt Sparks:
Building a PHP Framework: Part 7 – The Container
Jul 09, 2018 @ 12:33:16

Matt Sparks has posted the next tutorial in his "Building a PHP framework" series to his site today. In this latest article (part seven in the series) he focuses on building the container to handle dependencies.

Part 6 began our discussion of PHP containers. Today, I’ll be going into greater detail of the subject and, along with that, I’ll run down the work done so far on the Analyze container.

A huge debt of gratitude goes how to the folks behind the PHP League Container and others. I’ve learned a ton studying their code.

He then walks through the use of the container he created, Analyze/Container, to create and extract a Carbon instance. He then covers how the container is working behind the scenes to initialize the instance complete with dependencies (and optional arguments).

tagged: series part7 build framework container dependency tutorial

Link: https://developmentmatt.com/building-a-php-framework-part-7-the-container/

SitePoint PHP Blog:
How To Boost Your Server Performance With Varnish
Jul 06, 2018 @ 09:20:23

The SitePoint PHP blog has posted the latest tutorial in their series creating a simple image gallery application with a focus on performance. In this latest article they cover the use of Varnish for output and page caching.

According to Pingdom.com, a company focused on web performance, in 2012 Varnish was already famous among the world’s top websites for its capacity to speed up web delivery.

[...] Although there are other solutions that also shine, Varnish is still a go-to solution that can dramatically improve website speed, reduce the strain on the web application server’s CPU, and even serve as a protection layer from DDoS attacks. KeyCDN recommends deploying it on the origin server stack.

Varnish can sit on a dedicated machine in case of more demanding websites, and make sure that the origin servers aren’t affected by the flood of requests.

The article starts by explaining a bit about how Varnish (and caching in general) works to help improve the performance for the end user. It also goes through some of the basics feature of Varnish including threaded executions, extensibility and its domain-specific language. The tutorial then walks you through the installation of Varnish on a linux-based machine and shares some example stats showing the difference between normal requests and when Varnish is enabled for the image gallery application.

tagged: server performance varnish tutorial series imagegallery optimization

Link: https://www.sitepoint.com/how-to-boost-your-server-performance-with-varnish/

Laracasts.com:
Learn Laravel Forge (Free Video Course)
Jul 04, 2018 @ 11:51:47

On the Laravel News site there's a post announcing a course from the Laracasts.com site (a video tutorial site targeted towards Laravel) covering the use of Laravel Forge, the community's server management and deployment platform.

Learn Laravel Forge is new video course on Laracasts teaching you all things Forge, by guest instructor Marcel Pociot! The course consists of over twenty free videos walking you through configuring servers with Laravel Forge.

Topics covered in the 20+ videos include:

  • creating a first Forge project
  • provisioning a load balancer
  • customizing PHP settings
  • configuring firewalls
  • using Forge recepies
  • setting up SSL
  • using the Forge API

Each of the videos runs anywhere from 3 minutes to about 9 minutes so they're definitely "bite sized" and easy to consume when you have a few extra minutes.

tagged: laracasts video tutorial series laravelforge course free

Link: https://laracasts.com/series/learn-laravel-forge

SitePoint PHP Blog:
Improving Performance Perception: On-Demand Image Resizing
Jul 03, 2018 @ 12:08:20

The SitePoint PHP blog has continued their series covering the creation of an online image gallery application. The series has included several tutorials covering performance and optimization improvements. In this latest article they continue that trend focusing on optimizing the resizing of the images.

We’ve been building a sample application — a multi-image gallery blog — for performance benchmarking and optimizations. At this point, our application serves the same image regardless of the resolution and screen size it’s being served in. In this image resizing tutorial, we’ll modify it to serve a resized version depending on display size.

They start by listing out the requirements for the improvement: make all images responsive and the addition of the code to generate the resized image. Next it discusses the state of responsive images on the web and shows the first additions to the templates for the "srcset" value. They create some helper methods in Twig to get the image URL and "srcset" value. Next up, the tutorial helps you install the league/glide package and use it to create a script to manually "serve" the resized image information back to the user.

tagged: performance image resize tutorial series ondemand

Link: https://www.sitepoint.com/improving-performance-perception-on-demand-image-resizing/

Delicious Brains:
WordPress Deployment Part 2: Deploying WordPress Using The Command Line
Jul 03, 2018 @ 09:48:59

The Delicious Brains site has posted the second part of their "deploying WordPress using the command line" series today. In part one they talked about automated deployments and why they're important (and useful). In this latest tutorial they start in on the setup of the environment and the tools you'll need to complete the deployment.

In my last article, we looked briefly at why automated deployments are important and how to prepare a WordPress site for automated deployments.

Now that our WordPress site is ready to be deployed, in this article we’re going to look at how we can use command line (CLI) tools to deploy WordPress from our local computer to a remote server. While we’re not quite at the stage of being ready to set up automated deployments just yet, understanding how we can use CLI tools to deploy WordPress will serve as a good foundation for all of the automated deployment methods we will look at later in this series.

The article then walks through the different pieces you'll need to set up including a DigitalOcean droplet as a destination and a choice of several data transfer tools:

The post also mentions the WP-CLI tool but points out that it doesn't include functionality to actually move files, only work with local ones.

tagged: wordpress deployment part2 series commandline tutorial

Link: https://deliciousbrains.com/wordpress-deployment-workflow-command-line/

7PHP.com:
Interview with Matthew Weier O'Phinney (Principal Engineer at Zend Technologies)
Jul 02, 2018 @ 09:04:02

On the 7PHP.com site Khayrattee Wasseem has posted an interview he recently had with a member of the PHP community and lead on the Zend Framework/Zend Expressive projects: Matthew Weier O'Phinney.

This is the #39th set of PHP Interview to help aspiring PHP developers & PHP fans alike to get inspired by listening from those PHP guys who are already highly involved into the PHP Ocean and being ‘there’ taming the waves, surfing better than ever to make themselves an awesome PHP Expert both in their own eyes (for self-accomplishment) and for the PHP Community.

On the other side, this is an opportunity for new PHPers to get to know their “PHP Elders“. I hope you will derive as much fun to read my interviews as I’m having by interviewing those #PHPantastic guys.

He starts in with a brief introduction of Matthew before getting into the Q&A. Matthew answers questions about:

  • his own background
  • the "components" that make up Zend Framework
  • their PHP 7.2 compatibility goals
  • the volunteers that work with Zend on maintaining the framework
  • the release process for the framework
  • monolithic frameworks
  • Zend Expressive v3

You can check out all of Matthew's answers to these and more questions in the full post.

tagged: matthewweierophinney interview zend 7php series community zendframework

Link: https://7php.com/making-zf-components-compatible-php7/

StarTutorial.com:
Understanding Design Patterns - Composite
Jun 29, 2018 @ 13:38:10

The StarTutorial site is back with the latest installment of their series covering common design patterns and their use in PHP. In this latest tutorial they cover the Composite pattern.

[The Composite pattern] allows you to compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.

In their example, they tell a story about a Walmart worker that received comments from her manager about an issue with the number of cars per box. They define classes for each (Agnes, a Box and a Product), including basic functionality in each. They talk about possible ways to solve the "number of cars" problem in the code including conditional statements and other logic. This is pushed aside when a more sustainable solution is desired, one that makes use of common interfaces for multiple product types. The code examples for this new "composed" structure is included.

tagged: designpattern tutorial series composite

Link: https://www.startutorial.com/articles/view/understanding-design-patterns-composite

Sergey Zhuk:
Fast Web Scraping With ReactPHP. Part 3: Using Proxy
Jun 26, 2018 @ 12:27:43

Sergey Zhuk has posted the third part of his series covering the use of ReactPHP to scrape content from another source on the web. In this third part of the series he improves on his scripts from before (scraping from the IMDB site) to add in a proxy server.

n the previous article, we have created a scraper to parse movies data from used a simple in-memory queue to avoid sending hundreds or thousands of concurrent requests and thus to avoid being blocked. But what if you are already blocked? The site that you are scraping has already added your IP to its blacklist and you don’t know whether it is a temporal block or a permanent one.

Such issued can be resolved with a proxy server. Using proxies and rotating IP addresses can prevent you from being detected as a scraper.

He then shows how to use the clue/reactphp-buzz package to write an asynchronous HTTP request to google.com making use of promises rather than normal synchronous request handling. He then installs the clue/reactphp-socks package to make the connection to the proxy server(s) and modifies the Buzz client to use that as a connection. After finding a proxy server to use, he updates the scraper code created previously with the new Buzz+Socks combination and shows it in action scraping data. The post finishes with a look at adding some error handling and how to handle when the proxy requests authentication before use.

tagged: web scraping tutorial series part3 reactphp buzz socks proxy server

Link: https://sergeyzhuk.me/2018/06/20/fast-webscraping-with-reactphp-proxy/

SitePoint PHP Blog:
PHP-level Performance Optimization with Blackfire
Jun 22, 2018 @ 11:49:40

On the SitePoint PHP blog they've posted a tutorial that continues their series covering the creation of a simple image gallery blog application. In this latest part of the series the author covers the use of the Blackfire.io service for performance testing.

Throughout the past few months, we’ve introduced Blackfire and ways in which it can be used to detect application performance bottlenecks. In this post, we’ll apply it to our freshly started project to try and find the low-points and low-hanging fruit which we can pick to improve our app’s performance.

If you’re using Homestead Improved (and you should be), Blackfire is already installed.

While it’s useful to be introduced to Blackfire before diving into this, applying the steps in this post won’t require any prior knowledge; we’ll start from zero.

The tutorial walks you through some of the basics of Blackfire and what kind of information it will report back. After a small change to the Homestead YAML configuration, they show how to profile the landing page and what the resulting graph looks like. It then goes through the code, finding each of the pain points and refactoring them to improve performance.

tagged: blackfireio series performance optimize tutorial

Link: https://www.sitepoint.com/php-level-performance-optimization-blackfire/

Delicious Brains:
Hosting WordPress Yourself 2018 Update
Jun 13, 2018 @ 09:33:33

The Delicious Brains site has posted an update for the last part (10 of 10) of their series providing a guide to hosting WordPress yourself for some smaller changes for doing it in 2018.

I originally started writing Hosting WordPress Yourself back in February 2015, which makes this series over three years old! During that time a lot has changed, which is why I updated the series just over 12 months ago, to keep the content relevant. Since then, even more has changed in the WordPress hosting scene, so it’s time for another update!

I have already updated the existing articles in this series with the changes that follow. This article serves as a changelog and documents what has changed in each part of this series, where I guide you through the process of building a complete server to house your WordPress sites

This update shares changes in the virtual server setup, new software releases, suggestions of server monitoring services and web server configuration changes. Each point in the list is also linked back to the other part of the series related to the changes to give more context.

tagged: wordpress hosting guide tutorial series 2018 update

Link: https://deliciousbrains.com/hosting-wordpress-yourself-2018-update/