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

Master Zend Framework:
How to Begin Migrating From Zend Framework 2 to Zend Expressive
Oct 04, 2016 @ 12:29:21

The Master Zend Framework site has posted a new tutorial showing you how to start the process of migrating to Zend Expressive in your current from Zend Framework 2 application.

If you are managing one or more Zend Framework 2 applications, did you know that you can already begin porting them to Zend Expressive? In this tutorial, you will learn how you can start doing so today, using the Zend/PSR-7 bridge.

He starts with a little background on Zend Expressive and how it compares to Zend Framework 2. He also shares his opinions on the "just start from scratch" idea that's so tempting when migrating from one framework to another...that almost always leads to disaster. He then breaks down the migration process (using the zend-psr7bridge) into four steps, each with related code:

  • Create The Middleware Class
  • Initialize the Middleware
  • Configure the ServiceManager
  • Configure the Routes

He concludes with a few final thoughts about the migration from ZF2 to Expressive and how, with the help of this middleware setup, it can be a much smoother and easier transition.

tagged: migrate zendframework zendexpresssive psr7bridge tutorial framework introduction

Link: http://www.masterzendframework.com/migrate-from-zendframework2-to-zendexpressive/

Matthew Weier O'Phinney:
Programmatic Expressive
May 17, 2016 @ 11:45:34

In this new post to his site Matthew Weier O'Phinney looks at a common misconception there seems to be for people using the Expressive framework from Zend - that their applications should be entirely configuration-driven.

Enrico just returned from phpDay, where he spoke about Expressive and the upcoming Zend Framework 3. One piece of feedback he brought back had to do with how people perceive they should be building Expressive applications: many think, based on our examples, that it's completely configuration driven!

As it turns out, this is far from the truth; we developed our API to mimic that of traditional microframeworks, and then built a configuration layer on top of that to allow making substitutions. However, it's not only possible, but quite fun, to mix and match the two ideas!

Matthew goes on to share an experiment he tried using his own code to "tweak" things away from being configuration-driven to a more programmatic approach. He shares a few tips to remember when trying the same with your application too. The post ends with an example of this migration and some of the benefits/issues that could come from the change.

tagged: programmatic expressive framework configuration migrate example

Link: https://mwop.net/blog/2016-05-16-programmatic-expressive.html

Liip Blog:
Using the new Drupal 8 Migration API / Module
May 06, 2016 @ 10:14:23

On the Liip blog there's a post from Jon Minder talking about the new Drupal 8 migration API/module and includes a guide to get you started using it in your Drupal application.

We at Liip AG believe, that the migration API is the best and most efficient way to import data into Drupal. [...] The Migrate 8 module in core is only an API. There is no user interface. This makes it difficult for new developer to start with Migrate 8.

I suggest you, to install the [several] extension modules right away before you start developing if you want to realize the full potential of migrate.

The post starts with a list of reasons they see to use the migration module over other methods including the fact that it's sponsored and supported by Acquia. He provides a list of modules to install before getting started with Migrate and links to a GitHub repository if you'd like a "quickstart" environment to follow his examples. He then compares the previous version (from Drupal 7) of the migration handling with the newer Drupal 8 functionality, most notably the change over to YAML configuration rather than PHP code. He helps you understand the structure of these files and gives an example. He shows how to run the migration, gives a more advanced JSON source example and mentions the included process plugin.

tagged: drupal8 migrate module api drupal7 example yaml configuration

Link: https://blog.liip.ch/archive/2016/05/04/using-the-new-drupal-8-migration-api-module.html

Migrating to ZF2:
Integrating Composer and DoctrineORMModule
Nov 14, 2013 @ 12:23:52

Zend Framework v2 has been out for a good while now, but there's still applications out there running on the v1 of the popular framework. Since there was such a fundamental change in structure and functionality between v1 and v2, simply upgrading isn't possible - you have to migrate. Fortunately, there's guides like this one from Chris Strosser that shows you how to get there gradually.

Due to the vast nuances of Zend Framework 2, migrating an application from Zend Framework 1 can be very tedious. To make this process a little less painful, there is a way to slowly implement modules from ZF2 without making the application unusable. The methodology illustrated, which implements DoctrineModule and DoctrineORMModule into a Zend Framework 1 project, can be applied to a variety of ZF2 modules, making it an invaluable technique in the migration process.

Using these two ZF1 modules, they show how to integrate them into a typical ZF2 structure. There's a few steps in the process:

  • Add init_autoloader.php to application root directory
  • Update ZF1′s index.php for Composer compatibility
  • Setup ZF2 configuration files
  • Setup ZF2 "Application" module
  • Relocate existing entities and repositories to ZF2
  • Make ZendMvcApplication available in ZF1

It's not an overly complex process, it just requires the right configuration settings and component placement to get the ZF1 module to cooperate in the world of ZF2.

tagged: zendframework1 zendframework2 module migrate gradual composer

Link: http://webjawns.com/2013/11/migrating-to-zf2-integrating-composer-and-doctrineormmodule/

From Java to PHP
Mar 15, 2013 @ 11:55:29

On DZone.com today there's a new post that welcomes those coming from Java over to PHP with a few recommendations and suggestions about what's different and some things they might find familiar in the transition.

We are welcoming some new colleagues that come from a Java background in the Onebip team, both from the development and operations field. Here's a primer on learning PHP in this situation, that you may find useful when introducing similar people in your PHP-based projects.

He breaks it up into a few sections:

  • the "absolute basics" (like the differences in variable handling)
  • things to not care about (like procedural PHP or the installation of Apache+PHP)
  • how to "write to a graph" (things like PDO, DateTime)
  • things to watch out for (like == vs === and some php.ini settings)

He also recommends doing some coding katas with TDD to give you a "crash course" in the language and help you learn from more than just reading.

tagged: java language migrate learn suggestions


Moving a large existing project onto a framework
Feb 01, 2013 @ 12:18:13

On Reddit.com a discussion has started up around a question asked about legacy application migration - things to consider when moving a large existing project onto a framework.

I am working for an online store that has a codebase which has spanned dozens of developers and has been constantly upgraded. The codebase has its problems but it is not too bad. I would love to put it onto a framework like laravel and systematically start cleaning up as I go, but I am unsure if it will work trying to shove a framework into the current site. Has anyone done something similar, it would take me months to rewrite the whole system, has anyone done something like this successfully? Any advice would be appreciated.

There's lots of good recommendations made in the comments including:

  • "If it were me, I'd take a step back before trying to build on top of a framework. I'd start by refactoring the existing codebase out into PSR-0 compliant namespace."
  • "In my experience you only rewrite an entire application if what you have has become too expensive to maintain. At this point it is actually more cost effective to rewrite it using a framework."
  • "We have recently moved our website to the Symfony2 framework at my company [...] it definitely is not a one programmer job."
  • "Whatever you do, replace one bit at a time. And always strive to de-couple code."

Read up on the rest of the responses or add your own to the post.

tagged: framework legacy application opinion advice migrate


Josh Adell:
Migrating to Dependency Injection
Nov 23, 2012 @ 11:41:41

In a new post to his blog Josh Adell talks about his voyage to implement dependency injection into a current application. His work can be found in this github repository.

Recently, I gave a lunch-and-learn to my team on the topic of Dependency Injection (DI). Instead of showing a bunch of slides explaining what DI is and what it's good for, I created a small project and demonstrated the process of migrating a codebase that does not use DI to one that does. Each stage of the project is a different tag in the repository. The code can be found on Github: http://github.com/jadell/laldi. Checkout the code, and run composer install. To see the code at each step in the process, run the git checkout command in the header of each section.

He goes through each "checkout" step (the title is the git command to run to follow along) showing how he migrated away from a simple micro-framework based site to one that defines the various objects (and repositories) inside the "application" object. He adds in a few comments to let you know a bit more about what's going on and some basic event handling. He finishes off the post with some potential issues that could come up both during the process and with the resulting application.

tagged: migrate dependency injection tutorial github


Community News:
PHP-GTK Migrates to Git/Github
Mar 21, 2012 @ 09:40:31

As a part of the move to git/github that the PHP project recently made, a reminder was posted that the PHP-GTK project has also migrated.

PHP-GTK is a PHP extension that enables you to write client-side cross-platform GUI applications. This is the first such extension of this kind and one of the goals behind it was to prove that PHP is a capable general-purpose scripting language that is suited for more than just Web applications.

The full source can be found and forked/cloned over on github and is just waiting for you to contribute!

tagged: phpgtk gtk migrate git github


Brian Swan's Blog:
Azure Real World: Migrating a Drupal Site from LAMP to Windows Azure
Mar 20, 2012 @ 08:44:04

In this new post to his blog Brian Swan shares the process that he and other Microsoft-ers went through to migrate a site off of a LAMP stack and over to one based on Windows Azure. They moved was the SAG awards website because of issues it had seen with outages and slow performance.

In many ways, the SAG Awards website was a perfect candidate for Windows Azure. The website has moderate traffic throughout most of the year, but has a sustained traffic spike shortly before, during, and after the awards show in January. [...] The main challenge that SAG Awards and Microsoft engineers faced in moving the SAG Awards website to Windows Azure was in architecting for a very high, sustained traffic spike while accommodating the need of SAG Awards administrators to frequently update media files during the awards show. Both intelligent use of Windows Azure Blob Storage and a custom module for invalidating cached pages when content was updated were key to delivering a positive user experience.

He walks you through each of the five steps (high-level, obviously) that they took in the migration:

  • Export data
  • Install Drupal on Windows
  • Import data into SQL Azure
  • Copy media files to Azure Blob Storage
  • Package and Deploy Durpal

Each step comes with some explanation and descriptions of the commands and tools used during the process.

tagged: windows azure migrate lamp stack sag awards tutorial


PHP Migrates to Git
Mar 20, 2012 @ 06:39:52

The announcement has finally come - the PHP project has officially moved to git!

The migration of the PHP source code from Subversion to Git is complete. You can clone or fork the source from our GitHub mirror, and we also now support pull requests made via GitHub. The source is also available via git.php.net, and full instructions on cloning the php-src tree can be found at php.net/git. One immediate benefit is that future PHP release tags will be signed by the PHP development team. We will be releasing GPG keys for verification purposes in the next few days. More information on the migration and the new workflow can be found at the Moving to Git FAQ on the PHP Wiki.

This move does not include the manuals yet, but that's coming soon. Be sure to follow these steps if you'd like to contribute back via the git repository. This is a great move for the project and makes it even easier for developers to contribute their fixes and ideas back to the development group!

Joshua Thijssen has also posted a guide to getting started on his blog.

tagged: git migrate subversion svn clone