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

Cees-Jan Kiewiet:
Extending ReactPHP's Child Processes
Jul 05, 2017 @ 11:49:59

In a new post to his site Cees-Jan Kiewiet walks you through the process to extend the ReactPHP project's child process handling (the first part of a series of posts).

react/child-process is very flexible and can work a lot of ways but sometimes you don't want to be bothered with the details of how it works and just want a simpler API to do that.

He then covers two packages where he used this "simpler is better" mentality and wrapped the current ReactPHP handling in a simpler API: one for defining "promises" on the child process and the other handles the messaging between the child and parent processes. He includes code examples for each of these, showing them in use to create simple operations.

tagged: reactpph child process extend custom api simple tutorial

Link: https://blog.wyrihaximus.net/2017/06/extending-react-child-process-part-one/

Symfony Finland:
Porting a Symfony 3 application to Flex
Jun 26, 2017 @ 11:42:12

On the Symfony Finland site they've posted a retrospective about moving an application from Symfony 3 to Flex including the work that was done in the switch and the performance of the result.

Earlier this year I did some experimenting with a Hybrid state object between Symfony Twig templates and front end JavaScript frameworks. Since that time I did that experiment, the Symfony Flex project has progressed. I thought I would try how to port the state prototype to Symfony Flex.

[...] In my case the application was rather simple and all built in the AppBundle, which is best-practise in Symfony3 for many applications. I mostly had to move files and configurations around and change namespaces.

He starts by spending some time talking about the difference between a Symfony 3 environment and the environment Flex provides. He then goes through the eight or so steps to move from one to the other including file/directory changes and configuration updates. Next comes the look at performance differences between the two. Unsurprisingly Flex came out on top in every measurement he threw at it.

In addition to the new structure, the apparent improvement in performance is obviously welcome. This would likely be even more evident where I could leave more dependencies out, for example in API workloads. This obviously won't magically push Symfony/PHP into Golang or Node.js territory for raw API throughput, but for existing large code bases it could provide a low-effort boost.
tagged: symfony symfony3 symfonyflex migration performance benchmark process tutorial

Link: https://symfony.fi/entry/porting-a-symfony-3-application-to-flex

Phillip Shipley:
How to automatically deploy static single-page-apps to Amazon S3 and Cloudfront or
Jun 02, 2017 @ 10:39:26

Phillip Shipley has a post to his site for the AWS and Cloudflare users out there (or those that want to use these together) about an easy way to automatically deploy static sites.

Managing web servers can be a lot of work. Especially when it comes to configuring and maintaining SSL certs, server and software updates, etc. Let’s Encrypt has made the SSL part a lot easier, but it is still work and to me feels like overkill for something as simple as a static single-page-application. Especially when there are dead simple solutions like Amazon S3 that can be used to host and scale a static website without any server configuration or maintenance. Adding CloudFront with a free SSL certificate from Amazon’s Certificate Manager service make SSL painless too.

[...] In this article I’ll cover how to use Codeship’s continuous integration and deployment service to build/test your app, deploy it to S3, and then clear cached versions of it from CloudFront and Cloudflare.

He then shows how to use the Codeship service to do the actual deployment, broken down into a few steps:

  • Step 1: Setting up project in Codeship
  • Step 2: Configure Tests
  • Step 3: Configure Environment Variables
  • Step 4: Configure Deployment

Each step includes both screenshots and configuration examples you'll need to get the workflow set up and running for your site.

tagged: deploy tutorial singlepage amazon s3 cloudfront cloudflare codeship process

Link: http://www.phillipshipley.com/2017/05/how-to-automatically-deploy-single-page-apps-to-amazon-s3-and-cloudfront-or-cloudflare-using-codeship/

Hackermoon.com:
Debugging a PHP application with strace
Mar 28, 2017 @ 11:24:43

On the Hackernoon.com site there's a recent post from Paolo Agostinetto showing you how to debug your PHP application with a different tool that most might use: strace.

Every once in a while it happens that you have a tricky bug, and when it does you risk to lose hours or even days fixing it.

[...] Yet, sometimes there is that one bug that makes you lose your shit after a whole afternoon spent looking for the root cause. In my experience, bugs that I introduce are generally very quick and easy to spot and fix. But the real challenge is finding bugs in other people’s code like third party libraries, PHP extensions or even PHP itself.

He then talks about a time when his situation was a bit different - he was getting 500 errors from his code that weren't being caught correctly by error handling. He found that Apache was out-of-memory-ing but debugging the exact cause (a suspect Doctrine query) would take more time. Instead he turned to strace and, with a bit of hunting in the resulting output, he tracked the issue down to XDebug being enabled (and a setting that was generating a memory leak).

tagged: debug application strace memory error xdebug process

Link: https://hackernoon.com/debugging-a-php-application-with-strace-4d0ae59f880b

Alejandro Celaya:
My thoughts after migrating some projects to Zend Expressive 2
Mar 28, 2017 @ 10:15:20

Alejandro Celaya has a new post to his site sharing some of his thoughts after migration applications to Zend Expressive 2 and some of his experiences along the way upgrading to this latest version.

The day Zend Expressive 2 was released I was super excited. I have been using it a lot for both professional and personal projects, so I'm quite used to it.

Since I've been using it in many projects, being able to update all of them to version 2 was a challenge, but I can say, I have succeed.

He talks about the projects themselves first, his own site at alejandrocelaya.com and shlink.io, and what kind of functionality they have. He then briefly covers the process to get them migrated and some of the changes he needed to make including:

  • adding an error hander
  • moving to the new error handling middleware strategy
  • using the support for interop middleware (single-pass)
  • small router changes due to using a custom router

He ends the post looking at the shift in programmatic approach Zend Expressive 2 uses (versus v1 handling) and changes he made to his middleware handling to reflect it.

tagged: zendexpressive2 zendexpressive upgrade application process changes

Link: https://blog.alejandrocelaya.com/2017/03/27/my-thoughts-after-migrating-some-projects-to-zend-expressive-2/

Thijs Feryn:
My Varnish book is now available (O'Reilly)
Feb 16, 2017 @ 12:43:25

If you've ever been interested in using Varnish as a caching layer for your application but weren't sure where to start, you're in luck. In a post to his site Thijs Feryn has announced the release of his book covering Varnish and helping you get started integrating it into your infrastructure.

I’m proud to announce that my Varnish book is out now. It’s called “Getting Started With Varnish Cache” and it’s available for download through Varnish Software. For the next 30 days, Varnish Software has the exclusive rights to distribute the book. After that, O’Reilly will also be distributing physical copies and the digital version of the book, while Varnish Software will continue to distribute the book on their website.

Varnish Software is currently offering the book for free (well, "free" after you give your personal info). Thijs gets into a bit of detail around the book, the process he followed creating it and what kinds of things Varnish can help with. He points out that it was "one hell of a ride" writing the book and getting it published but notes that it was a "fun experience" and probably won't be the last book he writes.

tagged: varnish caching book oreilly process contents benefits

Link: https://blog.feryn.eu/my-varnish-book-is-now-available/

MyBuilder Tech Blog:
Managing Background Processes within Symfony
Dec 02, 2016 @ 11:19:47

Edd Mann has written up a tutorial for the MyBuilder.com Tech blog about managing background processes in a Symfony application with the help of Supervisor.

When a web application reaches a sufficiently large size, it can become infeasible to perform all actions required within a single web request/response life-cycle. You may find yourself wishing to for example - batch up and send queued emails at particular intervals, or process payments asynchronous to the point in-time the user made the initial request. In this post I would like to discuss our changing use of background processes (both time-dependent and continuous) due to increasing throughput demands.

He starts out with the first approach most applications take when needing to run automated, asynchronous processes - cron. Using it and a custom bundle they created for it, Edd shows how to directly integrate the cron timing of commands into the class attributes. However, after a while the system grew and it needed something a bit more powerful than cron, something that could correctly handle long running processes. Ultimately they decided on Supervisor, a processes manager and control system that makes managing these processes simpler. He talks about the transition they made from cron over to Supervisor (safely) and how they integrated the signaling functionality Supervisor allows into their application.

tagged: symfony background process manage cron supervisor tutorial bundle

Link: http://tech.mybuilder.com/managing-background-processes-within-symfony/

Intracto Blog:
How to save a kitten by writing clean code
Jun 03, 2016 @ 12:52:50

On the Intracto blog there's a new post from Joeri Timmermans talking about writing clean code with some good suggestions you can easily incorporate into your current processes.

So you came here to save a kitten? That's wonderful, but the real reason we're both here is to talk about clean code. In this blog post I'll be sharing some of my personal experiences and tips. But before we dive into the tips and tricks part, let's talk about what we, as developers, do and why we do it.

He touches on several topics including:

  • Best vs Fastest
  • Reading vs Writing
  • File and Folder Organization
  • Naming [conventions and clarity]

He also makes the recommendation to "return often", keep things DRY and makes a few recommendations of PHP-specific tools that can help.

tagged: clean code recommendation process development opinion

Link: http://blog.intracto.com/how-to-save-a-kitten-by-writing-clean-code

Scotch.io:
How To Process Tweets in Real-Time with Laravel
Apr 29, 2016 @ 09:10:16

The Scotch.io site has a tutorial posted showing you how to combine Laravel and the Twitter Streaming API to process tweets in real time inside your application.

This tutorial will show how to use the Twitter Streaming APIs to process tweets in real-time from a Laravel application. There are a variety of use cases for this: perhaps you want to auto-respond to mentions of your company, run a contest via Twitter, or create support tickets when users complain about your product. For this tutorial, we'll build a "featured tweets" widget to display approved tweets on our app's home page.

He starts with an overview of the tools and terms you'll need to know about for the tutorial and a few notes of things to watch out for. He then describes the overall structure of the application (an app just to show the tweets) and links to a repository for the impatient. He then breaks up the rest of the tutorial into several steps:

  • Creating a new Laravel application and installing the Phirehose library
  • Building a "process tweet" job and matching TwitterStream class to use Phirehose and dispatch the job
  • Make the artisan command to connect to the API and the application you created
  • Configure your queue driver and run the processing command
  • Set up a "Tweet" model to connect the application and database table

He finishes the post showing how to make the ProcessTweet Job useful, set up some basic authentication and pass the currently processed tweets into the default "Welcome" view.

tagged: realtime tweet twitter process stream api laravel job queue tutorial

Link: https://scotch.io/tutorials/how-to-process-tweets-in-real-time-with-laravel#step-11-make-the-processtweet-job-useful

Matthew Weier O'Phinney:
Benefits of multiple repositories (Zend Framework)
Apr 26, 2016 @ 12:09:34

Matthew Weier O'Phinney, of Zend and the Zend Framework project, has put together a Storify stream of tweets he posted about some of the benefits of having multiple repositories in a project.

I've seen a number of critiques and write-ups recently about how monolithic repositories are intrinsically better for developing large projects than using a multi-repository approach. In the past year, we went the other direction, splitting our monolithic repository into individual component repositories, each with their own history, tests, and documentation. This is a summary of our experience.

He goes through a list of six different things they learned as a part of splitting up the (Zend) framework into multiple repositories instead of one monolithic one. He includes the contents of each Tweet and a paragraph or two giving it a bit more context and some examples of the changes that were involved. There's also a bit in there about changes they made to the documentation for the project as a result of these repository splits.

I'm quite happy with the switch from a monolithic repository to individual component repositories. I think our code quality is improving dramatically as a result, and I'm excited about the future of these various code bases.
tagged: multiple repository storify twitter zendframework learn process

Link: https://storify.com/mwop/zf-components