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

Exakat Blog:
Up and running exakat in 15 mins
Jun 01, 2017 @ 11:32:41

On the Eakat blog they've written up a post showing you how to get the scanner up and running quickly on your system and start performing scans of the code based on their ruleset.

Exakat is a smart static analysis engine for PHP. It reviews the code fast and produces reports tailored for every needs : issues and code smell for programmers, inventories and maps for architect ; compilation and configurations lists for sys admins ; dashboards for team leaders. Including over 320 analysis and spanning versions from 5.2 to currently WIP 7.2, it helps you audit your code and keep it under control. Let’s see how to get up and running exakat in 15 mins.

The post then walks you through the installation process and defines some prerequisites you'll need before getting started. The Exakat installation is basically just grabbing a phar archive from the exakat.io server. Once it's installed they show you how to run your first scans and view the resulting output. The guide also shows you how to add additional options to the reporting and the command to update Exakat itself.

tagged: exakat scanner tool setup configuration quickstart tutorial

Link: https://www.exakat.io/up-and-running-with-exakat/

How to configure PHPStorm to use PHP-CS-Fixer
Apr 25, 2017 @ 10:47:46

On the Hackernoon site there's a recent tutorial showing you how to hook the PHP-CS-Fixer tool into PhpStorm for easy execution during development rather than after.

The PHPStorm IDE by JetBrains is probably one of my favorite editors. It has its flaws (constant indexing…) but overall its a great tool for me. However, my focus today is not on PHPStorm per say but rather how to add the awesome functionality of using project page. Depending on your platform you will need to make some decisions, namely how you configure the rules of PHP-CS-Fixer. I am currently on Windows but I will try to make sure these instructions work in both *nix and Windows environments.

He then walks you through some prerequisites (both pieces of software installed basically) and the decisions to make based on your platform. He then provides screenshots and descriptions showing where to go in the PhpStorm IDE to add the PHP-CS-Fixer as a new "Tool", the working directory to use and how to set up a keymap to execute the tool. He includes an example of the output when things are correctly configured and working together.

tagged: configure phpstorm phpcs phpcsfixer tool tutorial install combine setup ide

Link: https://hackernoon.com/how-to-configure-phpstorm-to-use-php-cs-fixer-1844991e521f

SitePoint PHP Blog:
How Can I Use Laravel Envoyer or Deployer with SemaphoreCI?
Apr 04, 2017 @ 11:16:59

The SitePoint PHP blog has posted a tutorial showing you how to use Laravel Envoyer or Deployer with SemaphoreCI and popular continuous integration service.

Test automation, continuous integration, and continuous delivery are quite widespread in the community now. This brought to life multiple services trying to make the process more enjoyable and less overwhelming for developers, so they can focus on delivering software instead of building/configuring tools to do that. One of those services is SemaphoreCI.

In this article, we’re going to cover how to use our own deploy scripts and tools to continue the deployment process after a successful test.

They then show you how to create the Deployer configuration file to make the deployment to the remote Digital Ocean servers of a Laravel-based application. Most of the steps are in copying the local files up to the remote server as a "staging" environment. He then hops back over to the SemaphoreCI service to create the deployment plan for the project using the "deployer.phar" command line tool, linking it to the push of new code. They then move to the same process just defined via the Laravel Envoyer tool and a similar command line call.

tagged: laravel envoyer deployer semaphoreci tutorial setup configure plan

Link: https://www.sitepoint.com/how-can-i-use-laravel-envoyer-or-deployer-with-semaphoreci/

Robert Basic:
PHP traits to create test doubles
Apr 04, 2017 @ 10:47:15

In a new post to his site Robert Basic shows how to make use of traits to create test doubles in your unit testing practice. He sees them as a simple method for keeping tests clean and not having mocks/fakes/etc. all over.

Keeping your application or library code well organized, easy to follow, and read is important. Your test code should not be exempt from those rules, you should follow good testing conventions.

One part of my tests that I feel like that are out of control are the test doubles. Dummies, fakes, mocks… Seems like they are everywhere and that I keep writing the same ones over and over again. I do follow some good practices on how to reduce code duplication in my tests, but these mocks… Ugh.

He starts with a simple example, showing a test that evaluates the result of a transaction being executed (true or false). However, he describes the eventual "creep" of the tests as more are added and, with each, more "transaction" object instances are required. He suggests refactoring the creation of those doubles into traits where the class they're called from can inherit them and test setup is a bit cleaner. He proposes a "trait for every double" so that they can be easily included as needed and without conflict.

tagged: traits unittest double mock tutorial example setup object

Link: https://robertbasic.com/blog/php-traits-to-create-test-doubles/

Stefan Koopmanschap:
Sculpin and Docker
Mar 22, 2017 @ 12:49:05

Stefan Koopmanschap has written up a tutorial on his site introducing the use of Docker and Sculpin to create an easily reproducible and manageable blogging setup.

I've been running this blog on Sculpin for quite a while now, and I'm quite happy with how that works. We've been in a process of migrating some of our websites off a standard VPS towards a setup with Docker, Gitlab CI and Rancher. I've now migrated some websites, which is relatively easy, but most of those sites were dynamic PHP websites. Migrating a site that generates static HTML and running that is a slightly different thing. Here's how I ended up doing it.

First he covers his old setup - essentially the manual run of a shell command to generate the latest version of a the static Sculpin site. He decided to update the process and help makes things more automatic using Docker and a Gitlab pipeline flow. He then documents his attempts and configuration options as he built up the Docker configuration he wanted. This ultimately resulted in a Docker setup that installed PHP and Nginx to serve up the site, Composer to load in the required dependencies (like Sculpin) and the commands to "deploy" the latest version of the site publicly.

tagged: sculpin docker setup configuration tutorial dockerfile php7

Link: https://leftontheweb.com/blog/2017/03/18/sculpin-and-docker/

SitePoint PHP Blog:
Crash Course: Continuous Deployment with Semaphore CI
Mar 13, 2017 @ 12:42:23

On the SitePoint PHP blog there's a new post that gives you a crash course in using Semaphore, a "continuous delivery pipeline" service, and how to use it to deploy your PHP applications.

Understanding continuous delivery, a now already long-standing buzzword, is not a problem, but implementing it in the right way has been a challenge for quite a few of us, and one we’ll discuss in this post.

[...] In this article, we will cover the process of deploying a Laravel application on a Digital Ocean server through a continuous delivery pipeline using Semaphore. The source code for the application is present on Github.

They walk you through each step of the way (complete with screenshots) to:

  • Create a Semaphore account, linking it to GitHub
  • Creating a new Project
  • Setting up the plan for the deployment
  • Performing the first build
  • Parallelizing the builds

With the project all set up the tutorial then starts on the continuous deployment changes, adding in a "Deployment" step and making a first push.

tagged: crashcourse continuous deployment semaphoreci tutorial setup configuration

Link: https://www.sitepoint.com/crash-course-continuous-deployment-semaphore-ci/

Laravel News:
Laravel Forge API
Feb 28, 2017 @ 14:36:37

The Laravel News site has posted an official announcement about the Forge API being released for public use. Forge is a service that makes it easier to set up and configuration servers by taking care of a lot of the details for you.

Laravel Forge just announced it’s first official API that allows you to create and interact with your servers and sites.

This was a highly requested feature and the API includes support for all the features Forge provides including Servers, Services, Daemons, Firewall Rules, Sites, SSL, and more.

The post includes how to get started with the API, where to get your API token and how to send it over for authorization handling. You can find more information about the Forge API in the documentation on the Forge site.

tagged: laravel forge api release announcement server setup configure

Link: https://laravel-news.com/laravel-forge-api

Manage custom VM with Laravel Forge
Feb 15, 2017 @ 10:22:14

On the DotDev.co blog today there's a post from Jordon Brill showing you how to manage custom VMs with Laravel Forge. In his particular setup, the VMs he was working with weren't ones created by Forge so he needed to do some custom work to integrate the two.

I had a legacy php application that I wanted to move to a newer version of php. This application is not built on Laravel but rather is a conglomerate of a bunch of different php scripts and pieces of different frameworks. We recently deployed a Laravel-based application to a server running on AWS via Laravel Forge and Laravel Envoyer and fell in love with the service. We were completely up and running in about 10 minutes and it was great.

This case, however, was a bit outside of the typical scenario since it was not a Laravel application and Forge wasn’t going to be creating the server on one of the built-in services that Forge has an integration with (Linode, DigitalOcean, and AWS).

He starts by creating a new VM instance of a Ubuntu-based Linux system. He then shows how to connect it up to Laravel Forge via the "Custom VPS" option. This provides you with a custom command and token to use to make the connection to manage the server via Forge from then on. He does point out a few "gotchas": that it all needs to be run as the "root" account and that you'll need to open SSH ports in your firewall (if you have one) to allow the Forge service access.

tagged: laravel forge envoyer vm custom setup ubuntu tutorial

Link: https://dotdev.co/manage-custom-vm-with-laravel-forge-dc4c3218e415#.sehaglgkh

Robert Basic:
Current Vim setup for PHP development
Feb 10, 2017 @ 11:46:10

For those out there always interested in how other developers have their development environment, Robert Basic has some info on his own setup that might interest you. In this new post to his site he shares his configuration using the Vim editor when writing PHP code.

I made some changes to my Vim setup for PHP development recently, so it’s time to write it all down. I’m more than sure that I’ll break it soon and won’t be able to remember all the things I did to have the current setup.

Some new plugins popped up on my radar, I tweaked some older plugins and I even wrote one for PHPStan!

He starts with the improvements in tag support he's found recently using the Gutentags plugin. He also covers other tools and functionality like:

  • Jump to definition
  • (Getting the ) current PHP class and method
  • PHP namespaces
  • Linting
  • A promising completion engine for PHP
  • PHPStan in Vim
  • Debugging

He finishes up the post with a few other helpful supporting plugins for indenting, searching and argument swapping.

tagged: vim editor setup development plugin programming

Link: https://robertbasic.com/blog/current-vim-setup-for-php-development/

Delicious Brains Blog:
Scaling Laravel Using AWS Elastic Beanstalk Part 3: Setting up Elastic Beanst
Feb 07, 2017 @ 10:29:41

The Delicious Brains blog has posted the third part of their series covering the scaling of Laravel with AWS Beanstalk. In this latest article the walk through the setup of the Elastic Beanstalk application.

In my last article we set up the supporting services we would require for our Laravel app once we deploy it to the Elastic Beanstalk architecture. We created a VPC to keep our infrastructure secure, we created a MySQL database in RDS, and we set up ElastiCache for our Redis cache. So now that our Laravel app is decoupled and our supporting services are in place, it’s finally time to deploy our app to Elastic Beanstalk.

They start by talking about the Elastic Beanstalk environments and helping you get the application set up via the command line tool. Next up is the creation of the ebextensions directory and the matching YAML configurations for the EB settings. They provide an example of the contents` and explain what some of the configuration sets up. Finally they use the command line tool to issue the "create" command and build out the environment based on the configuration. The post wraps up with a bit about some configuration tweaks that could be made and optionally enabling HTTPS.

tagged: tutorial elastic beanstalk tutorial series part3 setup environment commandline

Link: https://deliciousbrains.com/scaling-laravel-using-aws-elastic-beanstalk-part-3-setting-elastic-beanstalk/