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

SitePoint PHP Blog:
Look, Ma! No NodeJS! – a PHP front end workflow without Node
Aug 20, 2015 @ 09:26:54

The SitePoint PHP has posted an interesting tutorial describing a Node.js frontend workflow without Node.js, instead using PHP tools to replace the Node.js functionality needed for the build.

If you’re intimidated, exhausted or irritated by Gulp, Grunt, NPM, Yeoman, and all the other NodeJS tools that aim to help but often do the opposite, a good asset management workflow is possible in PHP, and this tutorial aims to prove it. In this article, we’ll go through a NodeJS-free PHP front end asset management setup.

He uses three tools to create the build process: BowerPHP for installing assets, markstory/mini-asset for minification and Robo for automation. He sets up a Homestead virtual machine instance as a testing ground first then creates a basic Slim-based application from the slim3-skeleton package. He gets the necessary tools installed via Composer then gets into the details of the process. He adds (Twitter) Bootstrap into his assets, shows how to set up the minification and creates a Robo task to watch the CSS for any changes. This task then re-runs the minifaction on the CSS and created the condensed version automatically.

tagged: workflow nodejs bowerphp miniasset minification robo task tutorial

Link: http://www.sitepoint.com/look-ma-no-nodejs-a-php-front-end-workflow-without-node/

SitePoint PHP Blog:
Introduction to Chain of Responsibility
Jun 24, 2015 @ 10:26:17

The SitePoint PHP blog has a recent post where they dig into the details of the Chain of Responsibility design pattern, a commonly used structure that makes for easier workflow handling and encapsulation.

The Chain of Responsibility is a behavioral design pattern that processes a request through a series of processor (handlers/receivers) objects. The request is sent from one handler object to another and processed by one (pure implementation) or all of the handlers. All the handlers are part of the chain.

They get into the detail of the parts of the pattern first: the abstract handler that defines the structure and a set of concrete handler classes based on this structure. He also mentions a few other object types that could be involved including a Client, Request and Response objects. He includes an example of the base abstract handler class with "setSuccessor" and "handler" methods to provide the "chain" from one handler to another. He creates a more advanced version of the handler that does some additional checking on the handler results to see if it needs to continue. Finally, he gets down to the Client class that handles the ordering of the chain before processing. He also shows how a service container (dependency injection) could be integrated to manage creating object instances.

tagged: chainofresponsibility designpattern tutorial order workflow

Link: http://www.sitepoint.com/introduction-to-chain-of-responsibility/

Phil Sturgeon:
A Quick Note on PSR Numbering
May 06, 2015 @ 09:41:55

With a lot of talk happening around the PSR-7 HTTP request/response proposal and PSR-4 being the last "official" standard to be posted, some people are wondering what happened to PSR-5 and 6. Phil Sturgeon, a previous member of the PHP-FIG, has posted some clarification to how the PSR process works and where those seemingly missing PSR numbers are at.

The last PSR from the FIG to be sent out into the world, to be used by whoever felt like using it, was PSR-4: Autoloader. Now people are starting to hear about PSR-7, and they’re starting to “lolphp”, wondering what has happened to PSR-5 and PSR-6. [...] This is not like The Neverending Muppet Debate of PHP 6 v PHP 7, despite it being the first though to pop into many peoples heads. Instead, this is down to the Workflow Bylaw I put into place last year.

He goes on to talk about the current workflow stages and how, unlike systems in other languages, the PHP-FIG's process gives proposals a PSR number even before they're published and accepted. He also briefly talks about PSR "nicknames", naming to differentiate between similar proposals and how, despite the need for these names, they're just reference points for conversations more than anything.

tagged: psr7 psr proposal workflow process numbering naming phpfig

Link: https://philsturgeon.uk/php/2015/05/05/psr7-numeric-workflow/

NetTuts.com:
A BDD Workflow With Behat and Phpspec
Jul 04, 2014 @ 14:20:23

NetTuts.com has posted a new tutorial today showing a sample testing BDD workflow using the Behat and PHPSpec testing tools. The BDD (behavior-driven development) approach focuses on using test-driven development and domain-driven design rather than just a unit testing approach.

In this tutorial, we will have a look at two different BDD tools, Behat and phpspec, and see how they can support you in your development process. Learning BDD can be confusing. New methodology, new tools and many questions, such as "what to test?" and "which tools to use?". I hope that this rather simple example will give you ideas to how you can incorporate BDD into your own workflow.

The article isn't a "getting started with BDD" guide, so you'll need to know a bit about the ideas and process before getting into it. He starts with a look at the workflow Taylor Otwell (his inspiration for this) uses and how to install Behat and get to work on a first feature file. He describes the thought process behind the steps and some of the PHP code required to make them work. He then gets to the use of phpspec to mock out a needed "Config" dependency. He works though the rest of the tests and includes the output when all tests are passing.

tagged: bdd workflow phpspec behat taylorotwell tutorial

Link: http://code.tutsplus.com/tutorials/a-bdd-workflow-with-behat-and-phpspec--cms-21601

Phil Sturgeon:
Solving the PHP Internals Workflow
Sep 12, 2013 @ 10:24:56

If you're not a subscriber to the php-internals mailing list, you may not know of several discussions happening right now. On of them relates to how the PHP project is currently run and include suggestions from a wide range of folks for improvements. Phil Sturegon has shared some of his own suggestions in a new post to his site.

On Monday I posted a tale of woe, which like any good tale had a moral at the end. The moral was that while PHP internals has its troubles, the troubles are really being perpetuated by a small few, and there is a clear path to solving the problems. [The PHP-FIG had similar problems and] It soon became incredibly clear that this approach would never work. We needed a workflow, and so does PHP.

He gets into some of the details behind the "growing pains" the PHP-FIG went through before defining their own workflow approach. He points out some of the problems with the workflow on the PHP side (defined here) but suggests that some of it could be avoided with a bit of tweaking. He also points out that the php-internals list "could be awesome" and that steps are already being taken (like improving news.php.net) towards that goal.

tagged: internals workflow phpfig opinion improvement newsphpnet

Link: http://philsturgeon.co.uk/blog/2013/09/solving-the-php-internals-workflow

Jordi Boggiano:
Composer: an update on require-dev
Mar 04, 2013 @ 12:38:33

Jordi Boggiano has a new post to his site about a recent update to the Composer tool that can help make managing development-only dependencies a bit easier.

Using require-dev in Composer you can declare the dependencies you need for development/testing. It works in most simple cases, but when the dev dependencies overlap with the regular ones, it can get tricky to handle. In too many cases it also tends to just fail at resolving dependencies with quite strange error messages. Since this was quite unreliable, I set out to rework the whole feature this week-end. The patch has been merged, and it fixes six open issues which is great.

Additionally, to make it easier to work with the development dependencies, they'll by default be installed when you run an "update" in your repository. If you don't want them, you can still use "--no-dev". Also, Composer will manage them in a seperate section from the normal "require" packages. If you're not using Composer to manage your application's dependencies, look over on getcomposer.org for more details.

tagged: composer requiredev update install workflow nodev dev

Link:

NetTuts.com:
Better Workflow in PHP With Composer, Namespacing, and PHPUnit
Jan 21, 2013 @ 10:49:15

On NetTuts.com there's a new screencast posted showing you a good way to create a better workflow in your PHP development using Composer and PHPUnit.

In this video tutorial, we’ll again focus on workflow. Specifically, we’ll use Composer’s built-in autoloading capabilities, along with namespacing, to make for an elegant testing experience. We’ll also review a handful of PHPUnit best practices, as we get setup with these tools.

He shows you how to use Composer to load in the packages from other projects (as well as your own) and using PHPUnit to execute unit tests for your application. He uses test-driven development, but it's not a required part of the workflow. He helps you create a simple "Calculator" test. He also shows how to manually modify the Composer classmap to load in your own classes.

tagged: workflow screencast phpunit composer namespace tdd unittest

Link:

Adam Patterson's Blog:
DIY simple staging server.
Oct 21, 2011 @ 10:29:41

Adam Peterson has posted an interesting idea for those out there running an internal staging server they want to constantly keep up to date with the main line of code (without manual intervention) - a git pull web frontend combined with git post-receive hooks.

This [move from svn to git] left a bit of a gap in my process where I could no longer test on a remote server without updating it manually by S/FTP or opening terminal and manually calling a git pull. Open terminal and manually git pull it did break up the work flow a bit so using the Dingo framework I created a very simple Git helper and gave it its own URL something like git/pull.

He added a post-receive hook to his git server that calls this "git/pull" URL on the staging server and updates the code on the server. This provides an easy asynchronous way to update things on another server. Note, though, that this should never be done on a publicly accessible server - it's a pretty large security hole (or at the very least made secure somehow). He used Dingo to create his interface, but something like the Slim micro-framework could have worked just as well. You can view his code on github.

tagged: git pull workflow staging server postreceive hook

Link:

Smashing Magazine:
Cleaning Up The Mess: How To Keep Your Coding Workflow Organized
Jan 21, 2011 @ 10:47:10

On the Smashing Magazine site today Brian Hoyt has some suggestions for you to use to keep your workflow organized when developing your applications (code, file structure, assets, database, etc).

Perhaps in the past you've tried to build a more complex, cutting-edge website like [our example], and the project started off with great enthusiasm, but ended up in a nightmarish mess that you couldn’t maintain. Your client lost interest when new features started getting too hard to add, and you started having to work late at night, tracking down bugs that you couldn't even find the relevant file for. After a project like that, it's not hard to see the relevance of a well-organized website project.

He talks about some general principles like "don't over-organize" and "don't mix aspects of the site" as well as some more specific things like a website size to structure recommendation and parts of a site and how to handle them - assets, stylesheets, javascript, the database structure/values and, of course, the code.

tagged: organized opinion workflow website structure

Link:

Zend Developer Zone:
Zend Framework Dispatch Workflow Diagram
May 13, 2009 @ 08:47:33

In this new post to the Zend Developer Zone, they point out a workflow diagram Polley Wong has come up with showing how the Zend Framework's dispatch system works (request handling).

I've been researching Zend Framework lately and was curious about what's actually happening behind the scene of the whole dispatch process. Inspired by Thorsten Ruf's (zenddispatch_en.pdf) clear and beautifully presented workflow, I decided to go a step deeper and crawl Zend Framework's code. I came up with my own version of the flexible yet complicated workflow.

You can check out this new PDF here. It diagrams out an overall view of the request handling, a look at what happens inside the front controller including components like the Controller Dispatcher, Action Controller, Action Helper Broker and Response Object.

tagged: zendframework dispatch workflow diagram polleywong

Link: