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

Drupalize.me:
Learning Drupal 8 from Boilerplate Code
Jul 30, 2015 @ 11:48:06

On the Drupalize.me site they've posted a guide to getting started with Drupal 8 based on the boilerplate code that already comes with the release.

Drupal 8 represents a lot of changes and a steep learning curve for many Drupal developers and themers. While many of these changes are exciting, there are many things to learn just to get started. One way to learn about the code involved with Drupal 8 modules and themes is to take a look at core's modules and themes for examples to follow. Another is to use a code-scaffolding tool like Drupal Console to generate boilerplate code and comments that you can learn from and then customize.

He makes the assumption that you already have a development environment set up and working then helps you install the Drupal Console for use in the rest of the tutorial. You can then use this command line tool to create a new Drupal 8 installation and generate the boilerplate code for a new theme. Finally, they show the creation of the two other related components: a new module and a block plugin instance. These are generate generic code you can use as a reference point for either updating your current Drupal projects or create new ones.

tagged: drupal8 commandline console instance theme plugin block installation

Link: https://drupalize.me/blog/201507/learning-drupal-8-boilerplate-code

X-Team Blog:
Automated Deployment in 90 minutes with Docker, AWS and Codeship
Jul 08, 2015 @ 10:22:27

In the X-Team blog they've posted about deployment, specifically combining Docker and Codeship to push an application (in this case a Symfony2 one) out to an Amazon Web Services instance.

Just imagine. It’s Friday afternoon, the team has just finished a new feature which should be deployed to the servers before the weekend. And you are the lucky guy who is responsible for completing the task. Generally, it shouldn’t take more than five minutes. Well, what could possibly go wrong. [...] In the attached video, you’ll find an introduction on how to setup and automate deployment with Docker, AWS Elastic BeansTalk and Codeship in 90 minutes. Don’t miss a Friday night party ever again!

The tutorial comes in the form of a video screencasting the whole process, all the way from setting up the AWS instance and Codeship account out to the configuration and software you'll need to use Docker to build the containers and make the deploy.

tagged: automation docker codeship aws instance tutorial screencast elasticbeanstalk

Link: http://x-team.com/2015/07/automated-deployment-90-minutes-docker-aws-codeship/

NetTuts.com:
Using the Digital Ocean API to Manage Cloud Instances
Jun 05, 2015 @ 11:14:10

In a new tutorial on the NetTuts.com site they show you how to use a Digital Ocean PHP SDK to manage your cloud instances from a PHP-based application.

The Digital Ocean API allows you to manage Droplets and resources in a simple, programmatic way using HTTP requests. All of the functionality that you are familiar with in the Digital Ocean control panel is also available through the API, allowing you to script the complex actions that your situation requires. For this tutorial, we'll integrate developer Antoine Corcy's Digital Ocean V2 PHP API Library into a Yii-based console application.

They walk you through the full process of the setup - getting your access keys, getting the PHP SDK and setting up a component as an interface for the rest of the Yii2 application to use. From there, he shows three examples of the types of commands to can issue:

  • Fetching Droplets
  • Fetching Images
  • Automating Snapshots

Each example comes with the code to implement it and screenshots of both how the same functionality looks in the Digital Ocean control panel and the output of their script.

tagged: digitalocean manage cloud instance sdk tutorial yii2

Link: http://code.tutsplus.com/tutorials/using-the-digital-ocean-api-to-manage-cloud-instances--cms-22864

7PHP.com:
Installing Magento version 2 on an AWS (Amazon) Free Tier EC2 Instance On LEMP
May 28, 2015 @ 08:58:05

The 7PHP.com site has a tutorial they've recently posted showing you how to get Magnto 2 installed on an AWS instance running LEMP (Linux, Nginx, MySQL and PHP).

This article tries to demonstrate how to setup an AWS (EC2) instance, installing a LEMP stack, preparing the server environment to meet Magento’s requirements and then to finally install Magento v2 using command line approach. [...] I’m presenting in this article something which might otherwise seem to be a daunting approach – but I also see it as an approach which you can later automate by using Docker/Dockerfile for example or even using a Vagrant appliance.

He takes you through the entire process, including the setup of the account and instance on the AWS side, with screenshots along the way:

  • Creating a Free Tier AWS Account
  • Preparing & Configuring your AWS EC2 Instance
  • Creating A Security Group For Our AWS EC2 Instance
  • Creating a PEM file – Key Pairs
  • Creating our AWS EC2 Instance
  • Creating an Elastic IP & Assigning to our EC2 Instance
  • Preparing & Configuring our AWS EC2 Instance
  • Installing Our LEMP Stack
  • The Magento 2 Project Installation Walkthrough
  • Configuring nginx conf file to serve our magento site
  • Creating a database & running The Magento Setup From Commandline

You'll find all the commands, screenshots and output examples you'll need to follow along with the tutorial easily. There's also links to other resources if you're interested in finding out more about the setup.

tagged: commandline magento2 aws ec2 instance install tutorial stepbystep

Link: http://7php.com/installing-magento-v2-aws-ec2-commandline/

Semaphore CI Blog:
Deploying PHP Applications with Rocketeer and Docker
Apr 10, 2015 @ 11:52:08

The Semaphore CI blog has a new tutorial showing you how to use Rocketeer and Docker to deploy PHP applications, pushing the resulting application out into a Docker container.

Deploying web applications is an integral part of modern web development. From this need, many tools have emerged to make the process as easy as possible. Rocketeer is heavily influenced by Capistrano and Laravel's principle of elegant code. It strives to make the deployment process accessible for everyone. [...] We'll deploy a fresh Laravel installation to a running Docker instance. This enables us to focus on setting up and using Rocketeer while the Docker instance will act as an application server requiring zero configuration and a great environment to experiment with.

They start with a list of requirements you'll need before getting started including Docker running on the server and Composer. They help you get Rocketeer installed and using the Docker command line too to set up and configure the server. Next up they show you how to use the "rocketeer" command to configure the Laravel application to be deployed. Once configured, they show you what updates you'll need to make and, finally, how to run the deployment. They also "dig deeper" and look at the file system setup on the server, stages of deployment, tasks, strategies and plugins.

tagged: tutorial deploy laravel application rocketeer docker instance

Link: https://semaphoreci.com/community/tutorials/deploying-php-applications-with-rocketeer-and-docker

Robert Basic:
Mocking hard dependencies with Mockery
Dec 26, 2014 @ 11:14:51

Robert Basic has a post today showing how you can mock hard dependencies with Mockery, a mocking library for use in unit testing. In this case, "hard" refers to work around the use of "new" creating objects in hard to test places.

One problem with unit testing legacy applications is that the code has new statements all over the place, instantiating new objects in a way that doesn't really makes it easier to test the code. Of course, the easy answer to this is "Just refactor your application!", but that's almost always easier said than done. If refactoring is an option, do it. If not, one option is to use Mockery to mock the hard dependencies.

He makes use of instance mocks to show the overloading of the service without the need for a refactor. This overrides it on a more global scale, so it could have an effect on other tests. He shows how autoloading and PHPUnit's own process isolation handling can fix tis problem (though it takes more time to run the tests this way). He includes sample code of the whole process so you can easily follow along too.

tagged: mockery dependency hard new instance phpunit unittest

Link: http://robertbasic.com/blog/mocking-hard-dependencies-with-mockery

Samuel Stenton:
Install Node.Js and Ghost on a Laravel Forge Server
Dec 10, 2014 @ 09:18:08

In this recent post to his site Samuel Stenton shows you how to get Ghost (a recent player in the blogging space) and Node.js installed on a Laravel Forge server. The Laravel Forge service makes it quick and easy to create and launch virtual machines on the cloud service of your choosing.

He's broken it down into five steps (not including signing up for Forge if you haven't already):

  • Step 1: Install Node.js
  • Step 2: Download and Configure Ghost
  • Step 3: Install and Run
  • Step 3: Configure NGINX to Serve our Ghost Blog Correctly
  • Step 5: Not finished quite yet!

That final step includes the instructions to restart the needed software when/if the server happens to be rebooted.

tagged: ghost laravel forge instance cloud tutorial nodejs install configure

Link: http://samuelstenton.com/install-ghost-laravel-forge-server/

Ben Ramsey:
Setting Up Jenkins on Amazon Linux for PHP Testing
Aug 08, 2014 @ 09:36:33

Ben Ramsey has posted a complete walk-through of setting up and configuring Jenkins on an AWS instance for testing your PHP applications.

One of my first tasks at ShootProof was to set up a Jenkins server for continuous integration and get it ready to run unit tests for PHP and JavaScript code. There are plenty of tutorials around the web to help you do just that. This is yet another one, but it’s primarily my cleaned-up notes -and less of a tutorial - placed here for my future self to find and provided publicly for all to benefit. These instructions are specifically tailored for setting up Jenkins on an Amazon Linux EC2 instance.

While he doesn't call it a "tutorial" it's still a great step-by-step guide to the things you'll need and the process to follow including commands, installing and starting Jenkins and configuring the environment to execute your tests. The main goal was to set it up for PHP-based applications, but he also throws in the setup of some Javascript testing via Node.js and the PhantomJS/CasperJS combo.

tagged: jenkins tutorial amazon aws instance setup configure linux unittest

Link: http://benramsey.com/blog/2014/08/setting-up-jenkins-on-amazon-linux-for-php-testing/

SitePoint PHP Blog:
HHVM and Hack on Heroku
Apr 30, 2014 @ 12:38:23

In a recent announcement Heroku, a popular platform as a service provider, announced that they now fully support native HHVM support to their platform offerings. In this new post to the SitePoint PHP blog Bruno Skvorc shares some of his own thoughts on the announcement.

In a move that surprised most but displeased none, Heroku, the Cloud Application Platform, has added native HHVM support to their cloud. PHP has long been a viable solution for high traffic production apps, and has had one of the best package managers for a while, not to mention the fact that it’s evolved significantly since the days of “simple hacks for small projects”. The PHP “development model” has been anything but “hackish” in the professional circles for a while now. The unfortunate ignorance of Adam Gross aside, this really is some big news.

Heroku apparently saw an opportunity to engage a whole new area with the integration of HHVM (and Hack) support on their PHP instance offerings. They even offer a method for switching between the normal PHP instances and an HHVM one to make the transition as easy as possible.

tagged: hhvm heroku support release instance paas

Link: http://www.sitepoint.com/hhvm-hack-heroku/

VG Tech:
Comparing Your Privates in PHP
Mar 19, 2014 @ 09:56:33

In a new post to their blog, the VG Tech folks talk about "comparing your privates" with a "hidden" feature of PHP. Don't worry, they're referring to private class properties on object instances here...

I was going to compare several private properties between to objects and started making a piece of code to perform the actual comparison using getters for the properties. I felt the approach sucked, and started looking into alternatives way to do this.

He shares what the current PHP documentation shares about comparing objects, but neither of them take private properties into account. He remembers, however, that object visibility is at the class level not instance level, allowing two object instances of the same class to have access to all properties of the other, regardless of exposure level. He includes a code snippet showing how to use this to compare those private properties.

tagged: private comparison object instance class

Link: http://tech.vg.no/2014/03/14/comparing-your-privates-in-php/