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

AWS Developer Blog:
Automated Changelog in AWS SDK for PHP
Sep 01, 2017 @ 10:17:08

On the AWS Developer blog they've posted about a new update in their PHP SDK functionality: a "changelog builder" that helps with automated changelog generation.

Starting with version 3.22.10 of the AWS SDK for PHP, released February 23, 2017, the Changelog Builder automatically processes all changelog entries. Each pull request is required to have a changelog JSON blob as part of the request. The system also calculates the next version for the SDK based on the type of the changes that are defined in the given changelog JSON blob.

The update simplifies the process of adding release notes to the CHANGELOG.md file for each pull request. Each merged pull request that was part of the release results in a new entry to the CHANGELOG.md file. The entry describes the change and provides the TAG number and release date.

This changelog is generated from a required JSON document for each pull request that provides information about the type of change, category and a brief description. They explain each of these items to give a little more context as to what they should contain along with a few examples.

This is something that could definitely help to improve other libraries as well, gathering the required change information from the contributor rather than having a project administrator have to sift through the PR to locate all changes.

tagged: aws sdk automated changelog generation json requirement pullrequest

Link: https://aws.amazon.com/blogs/developer/automated-changelog-in-php-sdk-for-aws/

TeachersPayTeachers Engineering Blog:
Challenges faced while scaling to serve millions of views per
Jun 15, 2017 @ 12:49:33

On the TeachersPayTeachers.com Engineering blog they've posted a retrospective of what they went through to scale to millions of views per day on AWS using Kubernetes, React, PHP, and Elixir.

Here at Teachers Pay Teachers (or TpT, as we call it) we’ve been in the process of migrating our website from a PHP monolith to a microservice based architecture utilizing React, Phoenix and GraphQL. To date, this migration has delighted our community of educators with it’s myriad of UX improvements. We’re able to objectively measure these improvements with our A/B testing infrastructure which also enables us to gradually expose functionality to broader and broader levels of traffic.

Our product page receives ~2 million pages views per day making it the most heavily trafficked page on TpT (here’s an example page). We decided to use a simple UI refresh as an opportunity to migrate the page to our new tech stack. This post dives deeply into the challenges we overcame while scaling the product page on our new infrastructure!

The post then shows an infographic of their migration and the major steps in the process along a timeline. They also include an overview of their updated architecture, specific technical issues found during the migration and handling server load. They also cover error spikes they saw just after scaling and how they were either able to resolve or just dismiss them as "red herrings".

tagged: teacherspayteachers scaling microservice aws kubernetes react elixir casestudy

Link: http://engineering.teacherspayteachers.com/2017/06/05/challenges-faced-while-scaling-to-serve-millions-of-views-per-day.html

Delicious Brains Blog:
Building a Command Line Daemon in PHP to Emulate AWS SQSD
May 30, 2017 @ 09:45:39

On the Delicious Brains site they've posted a tutorial showing how to create a command line daemon that will emulate the Amazon Web Services SQSD handling. The SQSD is a worker daemon service that Amazon offers as a part of its Elastic Beanstalk support.

Sometimes when you’re building a project there are parts of the architecture that exist on production that don’t exist on your development machine. Those missing parts (like proprietary software that’s specific to your hosting provider) can sometimes mean unwelcome surprises when you deploy to production.

Recently as part of my work on Mergebot, I decided to address this. My local machine was missing the AWS Elastic Beanstalk Worker Environment SQS daemon (known as SQSD). AWS isn’t open source so there’s, unfortunately, no official way to replicate it. So I decided to build a small PHP command line (CLI) app to attempt to replicate its functionality. In this article, I’m going to cover some of the aspects of creating a command line app in PHP and explain how I implemented them for my replica SQSD CLI.

He starts off with a brief overview of the Laravel queue worker and how it compares to the SQSD functionality. He then starts in on the code to create the daemon (outside of a framework) and adding in the while loop to keep it running as a daemon making use of the SQSD Worker class as a base. The post ends with some instructions on packaging up the command line tool using the phar functionality already included in the PHP language.

tagged: aws amazon sqsd queue elasticbeanstalk tutorial daemon worker

Link: https://deliciousbrains.com/building-command-line-daemon-php-emulate-aws-sqsd/

SitePoint PHP Blog:
The Ultimate Guide to Deploying PHP Apps in the Cloud
May 12, 2017 @ 12:18:59

On the SitePoint PHP blog author Prosper Otemuyiwa shares what they call the ultimate guide to deploying PHP apps in the cloud with examples for Heroku, Google Cloud, IBM BlueMix, Microsoft Azure, Amazon Web Services and Laravel Forge.

There is a popular mantra amongst developers that goes like this write, test and deploy. In this tutorial, I’ll show you how to deploy your PHP apps to different cloud server platforms such as Google Cloud, Microsoft Azure, Heroku, IBM Bluemix, and others.

Cloud servers are basically virtual servers that run within a cloud computing environment. There are various benefits to hosting and deploying your applications in the cloud. [...] In fact, many companies have moved their infrastructure to the cloud in order to reduce cost and complexity. It’s a great option for small, mid-sized, and enterprise scale businesses. If you write a lot of tutorials and do POCs (Proof-of-concepts) like me, it’s also a great choice for you!

He starts off by covering the technologies that will be involved in each deploy: Linux, Apache, MySQL and of course PHP. Then, for each of the platforms previously mentioned, he goes through the setup and configuration of the same functionality. Most include screenshots of the UI in the service setting up the account and application. He also links to two tools that can make it easier to deploy your actual application to these newly configured cloud instances: Envoyer and Deployer.

tagged: guide deploy application cloud google bluemix azure aws forge

Link: https://www.sitepoint.com/ultimate-guide-deploying-php-apps-cloud/

Amazon Web Services:
PHP application logging with Amazon CloudWatch Logs and Monolog
Apr 24, 2017 @ 09:46:47

On the Amazon Web Services blog there's a new post showing you how to use the Monolog logging library and a custom AWS extension to ship your logs to Amazon CloudWatch quickly and easily.

Logging and information debugging can be approached from a multitude of different angles. Whether you use an application framework or coding from scratch it’s always comforting to have familiar components and tools across different projects. In our examples today, I am going to enable Amazon CloudWatch Logs logging with a PHP application. To accomplish this, I wanted to use an existing solution that is both already popular and well used, and that is standards compliant. For these reasons, we are going to use the open source log library, PHP Monolog (https://github.com/Seldaek/monolog).

They start by introducing the Monolog library for those not familiar with it and how it relates to the PSR-3 standard. The ultimate goal with their implementation is to allow for the logs to be shipped to CloudWatch and implement some alerting around them. The tutorial then kicks in and they show you how to use Composer to install Monolog and an add-on to interface with CloudWatch. Code is provided to set up the initial logger and how to have it to log messages to different places. They then move over to CloudWatch and define a filter for the JSON data to find successful logins to your application. They also show how to use this same functionality in a Laravel application, contained in a test route.

tagged: aws amazon logging cloudwatch monolog tutorial install usage filter

Link: https://aws.amazon.com/blogs/developer/php-application-logging-with-amazon-cloudwatch-logs-and-monolog/

AWS Developer Blog:
Automating the Deployment of Encrypted Web Services with the AWS SDK for PHP (Pa
Feb 17, 2017 @ 12:25:48

The Amazon Web Services blog has posted the second part of their series covering the automated deployment of encrypted web services with the AWS SDK. In this new tutorial (part two, part one is here) they continue with the deployment of services: AWS Elastic Beanstalk, Amazon Route 53 and Amazon CloudFront.

In the first post of this series, we focused on how to use Amazon Route 53 for domain registration and use Amazon Certificate Manager (ACM) to create SSL certificates. With our newly registered domain available for use, we can proceed to deploy and configure the services we need to host the www.dev-null.link website across an encrypted connection. Once complete, the infrastructure configuration will reflect the diagrams [included in the post].

The tutorial then walks you through each of the services you need to deploy and shares the code (using the AWS PHP SDK) to show how to automate the process. There's also a few screenshots included of various page results and admin UIs to help you be sure you're in the right place.

tagged: aws amazon deployment encrypted webservice sdk tutorial series part2

Link: https://aws.amazon.com/blogs/developer/automating-the-deployment-of-encrypted-web-services-with-the-aws-sdk-for-php-part-2/

Scaling Laravel Using AWS Elastic Beanstalk Part 2: Setting up VPC, RDS and Ela
Dec 15, 2016 @ 10:56:06

On the DeliciousBrains.com site they've posted the second part of a series covering the scaling of a Laravel-based application using Elastic Beanstalk (part one is here).

In my last article we decoupled Laravel and got it ready for deployment to the Elastic Beanstalk architecture. However, before we race ahead to actually deploying our code to Elastic Beanstalk we need to do some preparation first. Specifically we need to set up some other AWS services that will be used by our Laravel app. These include: Virtual Private Cloud (VPC) to keep our infrastructure secure, Relational Database Service (RDS) for our MySQL database and ElastiCache for our Redis cache

With these “supporting” services up and running we can finally move on to deploying our Laravel app to Elastic Beanstalk.

They start off by walking you through the creation of the VPC on the AWS services using both public and private subnets. With that in place they move on to the RDS setup, configuring it to host their MySQL database and making a test connection. Finally they set up the ElastiCache instance for the Redis handling finishing out their "supporting services" setup in AWS.

tagged: laravel aws elasticbeanstalk series part2 vpc rds elasticache tutorial

Link: https://deliciousbrains.com/scaling-laravel-using-aws-elastic-beanstalk-part-2-setting-up-vpc-rds-elasticache/

Sending Email with SES in CakePHP 3
Dec 08, 2016 @ 09:31:21

The StarTutorial site has a new article posted showing you how to send email via SES in a CakePHP 3 application. SES is a service from Amazon Web Services that makes it simpler to send emails, the Simple Email Service (SES).

In this tutorial, we will show you how to set up CakePHP 3 to send email with AWS SES via SMTP. In our opinion, integrating AWS SES with CakePHP 3 by SMTP is more straightforward comparing to API.

They start off with the creation of the "EmailTransport" profile configuration dropped into the main application configuration file (defining connection and credential information). They then show how to create an "email profile" telling the framework to use the SES service definition. Finally they offer some advice about using the SES service on a Google Cloud instance and how to work around some of their port restrictions. CakePHP takes care of the rest, automatically understanding how to work with SES and using it transparently as the mailing service when you send your emails.

tagged: cakephp3 tutorial email aws ses send email configuration googlecloud

Link: https://www.startutorial.com/articles/view/sending-email-with-ses-in-cakephp-3

Ben Ramsey:
Building PHP Projects on AWS CodeBuild
Dec 05, 2016 @ 10:54:48

Ben Ramsey has a post to his site sharing the process he's worked up to deploy PHP applications on AWS Codebuild, a new service from Amazon Web Services that fills the niche for an easy to spin up and use build server.

The main highlight of re:Invent is always the keynotes and the new services and features announcements they make during the keynotes. One of the new services caught my attention, and I decided to give it a try. That service is AWS CodeBuild.

CodeBuild is designed to be used as part of the AWS CodePipeline, but it may also be used by itself. [...] Out of the box, CodeBuild provides some managed images that you may use to build your projects. These include environments for Android, Java, Python, Ruby, Golang, and Node.js. PHP is missing from this list, but since you’re able to use other images, I decided to see how easy it is to get up and running on CodeBuild with a PHP project. I chose to try out my ramsey/uuid library for a simple test.

He walks you through the creation of a new CodeBuild instance (complete with screenshots of the UI) and how to configure your project, explaining each of the settings as he goes. He includes the full build command he's using for the library running tests, a lint check and codesniffer checks for formatting. He shows how to get the project to build and what the UI will show when the build is successful (all green).

tagged: project aws codebuild pipeline library tutorial setup build server amazon

Link: https://benramsey.com/blog/2016/12/aws-codebuild-php/

Cees-Jan Kiewiet:
Deploying Sculpin to S3 with CircleCI
Jun 16, 2016 @ 11:56:12

Cees-Jan Kiewiet has written up a post showing how he combines S3 and CircleCI to deploy a Sculpin site for his blog. Sculpin is a popular PHP-based static site generator.

Until 10 minutes before the start of this month I had a VPS at Digital Ocean running with Jenkins and Gitolite on it for privately hosted repositories. With Github's recent move to unlimited repositories I really didn't have a need to host them myself anymore, and after playing with CircleCI's free tier it didn't make any sense anymore to keep that VPS up.

Since porting git over to another remote is as more Github's domain we're focusing on deploying Sculpin to S3 using CircleCI in this post.

He starts by outlining some of the prerequisites to get in place before trying to set up the process on your own application. He shows you how to set up an IAM user for the S3 bucket and configure CircleCI though a simple YAML file. He also mentions the set up for tests, loading in other dependencies needed (Composer) and finally the deployment that executes Sculpin's "generate" command to build the site.

tagged: sculpin circleci s3 aws deployment tutorial configuration setup

Link: https://blog.wyrihaximus.net/2016/06/deploying-sculpin-to-s3-with-circleci/