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

Theo Tzaferis:
Let CodeSniffer inspect your code in PhpStorm
Sep 15, 2016 @ 10:56:32

In a quick new post to his site Theo Tzaferis shows you how to set up PHPStorm and PHP_CodeSniffer to perform automatic inspection of your PHP code's syntax.

Some time ago I wrote an article on how to format your code automatically in PhpStorm to be conform the PSR standards. In this article I want to show you how you can enable inspections in PhpStorm which throws a warning if you have code which is not PSR, e.g.
  • Whitespace at the end of line
  • No newline at the end of file
  • No newline between namespace and use statements
  • etc…
This is pretty easy. We will use squizlabs/PHP_CodeSniffer from Github.

I’m doing this on an Ubuntu machine, but it should work the same in OS X (no idea about Windows).

He then provides the (*nix-centric) instructions on getting the two tools up and playing happily together. Fortunately PHPStorm comes with handy built-in support for PHP_CodeSniffer, basically only requiring you to install phpcs and point it to the right location. The rest is handled by the IDE when you enable the automatic evaluation.

tagged: phpstorm codesniffer tutorial setup configure automatic inspection

Link: http://tzfrs.de/2016/09/let-codesniffer-inspect-your-code-in-phpstorm/

SitePoint PHP Blog:
Up and Running with the Fastest PHP Framework on PHP7 in 5 Mins
Aug 24, 2016 @ 11:22:46

On the SitePoint PHP blog editor Bruno Skvorc has posted a tutorial helping you get up and running with PHP 7 and Phalcon in five minutes on a Homestead Improved virtual machine.

You may remember our past infatuation with Phalcon, the fastest PHP framework.

In this post, we’ll go through the process of getting it up and running in 5 minutes on one of our <a href="http://www.sitepoint.com/quick-tip-get-homestead-vagrant-vm-running/>Homestead Improved instances. If you’re not interested in why or what Phalcon is, just skip ahead to “Setting it up”.

He starts with a brief recap of what the Phalcon framework is (including Zephir), some history behind it and the latest advancement around the framework: LTS support for v3.0. The tutorial then gets into the setup and configuration of the VM along with PHP 7 and the latest stable version of Phalcon. He then uses the sample application provided by Phalcon and getting it boostrapped and running.

tagged: phalcon php7 tutorial demo homesteadimproved vm setup configure extension

Link: https://www.sitepoint.com/up-and-running-with-the-fastest-php-framework-on-php7-in-5-mins/

Symfony Finland:
Consider Docker for your Symfony projects
Aug 15, 2016 @ 11:24:35

On the Symfony Finland site there's a post that makes a recommendation for your Symfony framework based projects: give Docker a try to make setup and maintenance simpler.

During the first half of 2016 the web development community has talked about Docker quite a bit. The technology has been around since 2013, but during the last few months it has matured and started being adopted for mainstream web development. Docker is a great fit for Symfony projects too.

[...] Docker takes an approach where it wraps a piece of software into something known as a container. These containers are shipped complete with the application code, a runtime, system tools and libraries. Containers are thus guaranteed to always run the same, but can share files and networking with the host and other containers.

They then talk about how this "containerized" setup can be used to your advantage, making it simpler to get a Symfony application up and running with a few commands. The post then gets into an example setup of a Symfony Docker environment complete with Nginx, Varnish and PHP-FPM installed and linked. There's also setup for MySQL and Redis rounding out the data storage side. A quick "docker-composer up" command and, if all goes as expected, the environment is set up and waiting for your application.

tagged: symfony finland docker project tutorial setup configure

Link: https://www.symfony.fi/entry/consider-docker-for-your-symfony-projects

Matt Stauffer:
Introducing Laravel Echo: An In-Depth Walk-Through
Jun 17, 2016 @ 12:11:02

Matt Stauffer has a new post to his site where he's put together an in-depth look at Laravel Echo, a feature included in newer versions of the framework that makes it easy to integrate websockets into your Laravel-based application.

A few weeks ago, Taylor Otwell introduced another branded product within the Laravel line: Laravel Echo. So far, the only coverage it's gotten has been his Laracasts video intro, but I recently wrote it up for my book and wanted to share that with you. What follows is an excerpt from Laravel: Up and Running, heavily modified to make sense in a blog format.

He then gets into what Echo is and the different pieces that make it up: updates to the Laravel broadcast system and a new Javascript package. He suggests some places where using Echo makes sense and how to set up a simple broadcast event in your application (non-Echo to start). This makes use of the Pusher service for real-time event broadcasting. With that in place, he helps you install the Echo dependencies and integrating messages from both public and private channels. He also includes a bit of code at the end to exclude the message from broadcasting to the current user if you ever find a need for it.

tagged: laravel echo indepth tutorial setup configure pusher javascript

Link: https://mattstauffer.co/blog/introducing-laravel-echo

Scotch.io:
Understanding Laravel Middleware
Jun 16, 2016 @ 13:20:48

The Scotch.io site has posted a tutorial that aims to help you understand middleware in Laravel applications - how they work and how to create ones based on your custom needs.

HTTP Middlewares provide a convenient mechanism for filtering HTTP requests entering your application. Laravel, for example, has a middleware for verifying a user's authentication.

These are some cases where I have had to resort to using middleware. There are many more cases where you would like to use a middleware. [...] By the end of this article, you should be able to create a middleware, registers it and use it in your projects. We will be illustrating the creation till usage of middlewares by creating one of our own. Our middleware will enable maintenance either site-wide or on some routes.

They start by creating a middleware (theirs is DownForMaintenance) and how to register it with Laravel as a valid middleware option. By default they will execute with every request but you can narrow them down to only happening on certain routes (examples included). There's also mentions of middleware parameters, grouping middleware and deferring the response return until after other code is executed.

tagged: laravel middleware introduction tutorial create execute configure

Link: https://scotch.io/tutorials/understanding-laravel-middleware

TutsPlus.com:
Using Let's Encrypt SSL With Your WordPress Project
May 24, 2016 @ 12:53:11

The TutsPlus.com site has posted a tutorial for the WordPress users out there about using Let's Encrypt and SSL certificates to easily secure your installation.

For years, purchasing, renewing, installing and managing SSL certificates overwhelmed me with expense and complexity. Now, Let's Encrypt makes it fairly simple and free.

Let’s Encrypt is an emerging, free, automated, and open certificate authority brought to you by a California public benefit corporation called the Internet Security Research Group—it also has nonprofit status. [...] In this tutorial, I'll walk you through installing Let's Encrypt on a few of my websites, including my WordPress consulting website, http://lookahead.io, soon to be https://.

You'll need a be a bit comfortable working at the command line to use the Let's Encrypt client, but they walk you through each step of the process explaining everything along the way. They start with a basic list of features the Let's Encrypt service provides and the requirements you'll need to get started. Screenshots of the setup wizard are included and the "one small difference" you'll need to make when using it with WordPress. They link to the SSL Labs site to help you verify the certificate is working as expected and finish with setting up the auto-renewal of the certificate via a simple cron job.

tagged: wordpress letsencrypt install setup configure ssl certificate free

Link: http://code.tutsplus.com/tutorials/using-lets-encrypt-ssl-with-your-wordpress-project--cms-22303

SitePoint PHP Blog:
How Can the ELK Stack Be Used to Monitor PHP Apps?
May 12, 2016 @ 10:42:36

The SitePoint blog has posted a new tutorial from author Daniel Berman about using the ELK stack to monitor PHP applications. The ELK stack is made up of Elasticsearch, Logstash and Kibana to make for effective log storage and searching.

A modern web application environment consists of multiple log sources, which collectively output thousands of log lines written in unintelligible machine language. If you, for example, have a LAMP stack set up, then you have PHP, Apache, and MySQL logs to go through. Add system and environment logs into the fray — together with framework-specific logs such as Laravel logs — and you end up with an endless pile of machine data.

Talk about a needle in a haystack. [...] The ELK Stack (Elasticsearch, Logstash, and Kibana) is quickly becoming the most popular way to handle this challenge. Already the most popular open-source log analysis platform — with 500,000 downloads a month, according to Elastic — ELK is a great way to centralize logs from multiple sources, identify correlations, and perform deep-data analysis.

They walk you through the full installation of all three tools starting with Java (they all require it) followed by instructions for each piece. Once they're all up and running (and playing nice together) they help you configure it to pull in Apache access logs and search on the results. They then populate it with quite a bit more sample data and share some basic tips on searching using the custom searching "language". Finally they talk about the visualizations Kibana offers complete with an example showing browser percentages from users of the site.

tagged: elk stack tutorial monitor elasticsearch logstash kibana setup configure apache log

Link: http://www.sitepoint.com/how-can-the-elk-stack-be-used-to-monitor-php-apps/

James Wade:
Getting started with Docker and Wordpress
May 06, 2016 @ 11:57:31

James Wade has posted a tutorial to his site showing you how to combine Docker and WordPress after some experimentation of his own.

I’ve been meaning to get started with Docker since hearing about it in 2014. Having really enjoyed working with Vagrant, I’ve struggled to make a leap into the Docker realm. [...] My understanding at the moment is that docker takes up less resources, which for me is becoming more and more of an issue as I attempt to expand my development environments. Also, I’ve recently inherited a number of Vagrants that I discovered have varying operating systems and application versions, that vary from production.

This has unravelled a dependency hell when I came to build a continuous integration process. In light of this, at this stage, a complete rewrite of the architecture seems to be emerging as the most sensible way to being all the services in to line. I’ll be looking whether I can solve these problems (amongst others) with Docker.

He starts by helping you get all the tools you'll need installed with examples for multiple platforms (OSX, Windows, Unix-based). With those in place he helps you set up a VM as a Docker machine then get WordPress installed (complete with its database). He also shows how to use Docker Compose, using an existing WordPress instance and creating a custom image from the results (including database, environmental settings and hostname configuration).

tagged: docker wordpres tutorial example compose setup configure vm virtualmachine

Link: http://wade.be/development/2016/05/02/docker.html

Laravel News:
Announcing Laravel Valet
May 06, 2016 @ 09:46:28

The Laravel News site Eric Barnes has a post about the latest addition to the Laravel ecosystem (that includes the framework, Envoyer and Homestead) - Laravel Valet.

Laravel Valet is the next generation development environment for Mac minimalists. No Vagrant, No Apache, No Nginx, No /etc/hosts file. “I wanted to have the convenience of php artisan serve without ever having to run php artisan serve“, Taylor said when asked why he created it.

Valet works by hooking into your Mac’s built-in PHP server then it utilizes DnsMasq to proxy all requests to the .dev TLD to sites on your local machine.

The post links to the official documentation and an article he's written up with a "first look" at the new tool.

tagged: laravel valet tool setup configure website simple opinionated

Link: https://laravel-news.com/2016/05/announcing-laravel-valet/

Adam Culp:
Using an SSH tunnel to step debug through a firewall
Apr 19, 2016 @ 10:54:28

Adam Culp has followed up some of his previous posts about the setup and configuration of remote debugging in PHP applications (more specifically in Zend Studio) with this new post. In it he shows how to use a SSH tunnel to allow debugging to happen through a firewall for those cases when direct access isn't possible.

In a previous post I covered how to set up step debugging in Zend Studio. But if that doesn’t work there may be a firewall in between the server and the debugging client, or IDE, preventing the connection. Here is a possible way to get around that.

He assumes that you already have the SSH server and connection available to you (he doesn't cover the install of that part). He then steps you through the setup of Zend Studio to add a new server, configure the SSH tunneling and remote/local ports to use. In his case he was using Zend Server so switching on debugging was as easy as turning in debugging via the toolbar. It's also worth noting that another popular PHP IDE can handle SSH-based debugging as well - PHPStorm - as seen here.

tagged: remote debugging ssh zendstudio setup configure tutorial phpstorm

Link: http://www.geekyboy.com/archives/1242