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

Rob Allen:
Customising Whoops in Expressive
Nov 08, 2017 @ 09:53:40

Rob Allen has a new post to his site showing how you can customize the Whoops output in a Zend Expressive application. Whoops is a package that provides more well-structured and more attractive error output when an issue comes up.

I find the Whoops error handler page in Expressive quite hard to read and particularly dislike that the error message displayed in the top left is hidden if it's more than a few words long.

To fix this, I discovered that you can provide a custom CSS file to the PrettyPrintHandler and then override to your heart's content! One way to do this is to add a delegator factory to add the additional functionality, so let's do that.

He then includes the configuration changes you'll need to make in the Expressive setup to have it recognize the factory and be able to use it as a dependency. He then includes the code to create the factory itself, adding a path to the local CSS files and pushing the custom whoops.css file into the page handler. Example CSS is included showing an update to the display of the main message, removing the need for a mouseover to view it.

tagged: zendexpressive zendframework whoops error handler css configuration factory tutorial

Link: https://akrabat.com/customising-whoops-in-expressive/

Joshua Thijssen:
Symfony's autowiring
Nov 02, 2017 @ 10:26:18

Joshua Thijssen has a new post to his site looking "under the hood" at Symfony's autowiring functionality used to locate and initialize services for the framework as needed.

When asking people if they use Symfony’s autowiring functionality, an often heard excuse why people don’t use it is because of all the magic that is happening during autowiring. But just like most impressive magic tricks, once explained, it all boils down to a few simple principles and Symfony’s autowiring is nothing different in that perspective. In this blogpost I will explain the new autowiring and autoconfiguration features, and why you should love them.

He starts off with an example of how to define services manually. He then explains how these services are used in the code and how to pass in arguments when fetching. He then moves on to the automatic generation of the services (the autowiring) and how the framework is "tricked" into using the namespace of the discovered service as the name. This is also used in dependency handling. The post then covers when the autowiring won't work, autoconfiguration and how to set defaults on service definitions (for arguments).

tagged: symfony autowiring tutorial indepth configuration framework

Link: https://adayinthelifeof.nl/2017/09/19/symfony-autowire.html

SitePoint PHP Blog:
How to Optimize MySQL: Indexes, Slow Queries, Configuration
Oct 31, 2017 @ 10:46:11

On the SitePoint PHP blog Bruno Skvorc has a post that offers some helpful advice about optimizing your MySQL database through the use of indexes, monitoring slow queries and configuration options.

MySQL is still the world’s most popular relational database, and yet, it’s still the most unoptimized – many people leave it at default values, not bothering to investigate further. In this article, we’ll look at some MySQL optimization tips we’ve covered previously, and combine them with novelties that came out since.

He starts off with the configuration changes that can be used to optimize the database, tweaking settings for Innodb pool, handling variable inspection and using a tuning tool to determine the best settings. Next up comes the look at indexes covering the different kinds first: fulltext, descending, unique/primary and regular indexes. Finally he covers some of the usual bottlenecks seen in MySQL's use in web applications, showing how to monitor for them via the slow query log.

tagged: optimize mysql database application tutorial index slowquery query configuration

Link: https://www.sitepoint.com/optimize-mysql-indexes-slow-queries-configuration/

Asmir Mustafic:
How do I deploy my Symfony API - Part 4 - Deploy
Oct 11, 2017 @ 10:23:12

Asmir Mustafic has posted the next part of his series covering the deployment of Symfony applications. In this latest article (part four) he focuses on some of the final steps of the deployment process.

This is the forth post from a series of posts that will describe the whole deploy process from development to production. The first article is available here, the second here and the third here.

After covering the steps 1-3 and having prepared our infrastructure, we can see how to deploy our application to production. Almost the same approach can be used to deploy not only to production but also to test environments.

He starts with the workflow for the deployment process, creating a flow where the "git push" should trigger other actions based on the branch pushed. Then CircleCI will fire off a series of jobs to handle environment setup tasks, connecting to a VPN and deploying the code. This includes a bit of preparation, credential handling and the Docker setup and push. Each step along the way also includes all of the YAML configurations you might need to replicate the deployment.

tagged: symfony api deployment part4 series docker configuration example

Link: https://www.goetas.com/blog/how-do-i-deploy-my-symfony-api-part-4-deploy/

Dev.to:
Deploy Laravel Application On Cloud Easily With Cloudways
Sep 21, 2017 @ 11:38:55

The Dev.to blog has a tutorial posted from author Saquib Rizwan showing an easy way to deploy a Laravel application to Cloudways via their platform and the PHP stack they offer.

Even if you know all about it, setting up and configuring a dedicated server is a time consuming multi-step process. But thanks to managed hosting solutions available in the market today, setting up servers is no longer a major action item on project task lists.

Deploying Laravel application on cloud infrastructure is never been this fast and easy before. [...] Cloudways provides an incredible platform for Laravel Community. It makes it easy to deploy and host laravel applications so that developers can focus on the development process rather than worrying about deployment and server level issues.

The post lists out some of the benefits of the Cloudways platform before starting in on the technology behind their "ThunderStack" PHP environment. With the basics covered, Saquib then moves on to deploying the server via Cloudways, linking it to your application on GitHub and providing the proper key information for them to connect. With all of this in place, the "Start Deployment" button is ready for use and the application and server can be started quickly.

tagged: deploy laravel application cloud cloudways tutorial configuration

Link: https://dev.to/rizwan_saquib/deploy-laravel-application-on-cloud-easily-with-cloudways

BitPress Blog:
My Simple Approach to using Docker and PHP
Sep 20, 2017 @ 11:55:39

Paul Redmond has written up a tutorial sharing his simple approach to using Docker and PHP to provide a more robust development environment.

Getting started with Docker and PHP can still be a steep learning curve. You might feel that you don’t need something like Docker and that Vagrant or full local development work just fine. I still use local development on some projects because the barrier to entry is small.

You will likely face scenarios where you require different versions of PHP, work with multiple developers, and seek consistency between environments. When you’re working with a team, you need a consistent way to develop. I’ve been on teams where different versions of PHP and MySQL varied between developers. I want to show you how Docker can fill the gap of providing consistent development environments, and do so without a huge amount of added complexity.

He starts with some background on why he decided to learn how to use Docker for his PHP development and how it has helped simplify his setup. He then walks you through some of his initial steps with Docker, providing the commands to create a new Laravel project and the structure he uses for his projects and the base image. He covers the contents of the Dockerfile, the Apache VirtualHost setup and how to build out the image. The post also includes instructions for:

  • running Apache
  • running "docker compose"
  • adding a volume for local development
  • adding MySQL
  • running commands
  • how to connect to the MySQL instance running in the container

Each item on the list includes configuration changes and commands that you'll need to get everything set up and running in a simple Docker container on your system.

tagged: tutorial docker setup configuration environment introduction

Link: https://bitpress.io/simple-approach-using-docker-with-php/

Laravel News:
Creating Your Own Configuration in Laravel
Sep 19, 2017 @ 12:14:16

On the Laravel News site there's a new tutorial posted showing you how to create your own custom configuration for those that are newer to the framework.

If you are new to Laravel, you might not yet know how you can create your configuration files in your projects and a few other helpful things that will help you master configuration. As always, the official documentation provides great information, and there are a few things we’ll cover here that I think will help people new to the Laravel framework.

They walk you through a complete guide to the Laravel configuration handling including:

  • what pieces are involved and where they belong
  • accessing the configuration service
  • working with configuration values
  • creating a custom configuration
  • caching the configuration for better performance

Each item on the list has a brief description helping to illustrate the point and commands/code examples where appropriate.

tagged: laravel configuration custom tutorial introduction

Link: https://laravel-news.com/creating-configuration-in-laravel

Sameer Borate:
Switching WordPress to HTTPS
Sep 14, 2017 @ 09:19:38

On his site Sameer Borate gives you a quick tutorial on how to migrate your WordPress site to HTTPS to help secure the communications between it and your users.

Finally, after much deliberation, I decided to move my blog to https. For the past few months I had encountered articles pointing that google gives a higher ranking for sites served over https. I had decided against https as I was afraid it may slow down by blog. However, the [a message about Chrome's HTTP/HTTPS support] from google forced me to take the issue seriously and finally move to https.

[...] Luckily during the same time Godaddy was offering SSL certificates at a discounted price. So taking this as a sign I bought the SSL certificate and moved my blog to HTTPS. Surprisingly installing SSL on Godaddy was a breeze. There was no configuration involved and the SSL certificate was applied within a few minutes.

He assumes that you know how to get the certificate installed, so that part isn't covered. He does cover the shift of the WordPress site over including changes that'll need to be made to web server and WordPress application configurations. He ends the post briefly talking about any speed difference he saw with the site (hint: not much).

tagged: wordpress https secure certificate settings tutorial configuration

Link: https://www.codediesel.com/wordpress/switching-wordpress-https/

Rob Allen:
Deploying a PHP application to Cloud Foundry
Aug 30, 2017 @ 10:22:03

Rob Allen has a new post to his site today showing you how to deploy your PHP application to Cloud Foundry, an open source cloud platform that helps to automate deployment onto multiple cloud infrastructures.

I recently had a requirement to deploy a Slim application somewhere. As I already have a Bluemix account, it seemed sensible to deploy it to their Application Runtimes service which is an installation of the Open Source Cloud Foundry project.

This turned out to be quite easy, but there are a number of steps involved, so I'm documenting it here.

After installing some of the command line tools he then prepares the PHP application by selecting a version, creating a manifest file, setting up buildpack options and defining rewrite rules. He then walks you through the deployment steps required to push the code out to the Bluemix host via Cloud Foundry, including the commands needed to make it all work.

tagged: deployment application tutorial cloudfoundry bluemix command configuration

Link: https://akrabat.com/deploying-a-php-application-to-cloud-foundry/

North Meets South Podcast:
Conventions, configuration, and becoming a lead developer
Aug 21, 2017 @ 10:55:53

The North Meets South podcast, hosted by Jacob Bennett and Michael Dyrynda, has posted their latest episode: Episode #32 - Conventions, configuration, and becoming a lead developer.

Topics mentioned in this show include:

You can listen to this latest episode either using the in-page audio player or by downloading the show for listening offline. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter to get the latest updates when new episodes are released.

tagged: northmeetssouth podcast ep32 jacobbennett michaeldyrynda convention configuration lead developer

Link: http://www.northmeetssouth.audio/episodes/4579b2fc/conventions-configuration-and-becoming-a-lead-developer