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

Zend Framework Blog:
Announcement: ZF repository rename 2016-05-03
Apr 28, 2016 @ 13:08:27

An announcement has been made on the Zend Framework blog today about a massive repository rename that will be happening May 3rd, 2016 to move away from the "zf2" naming.

In contrast to Zend Framework 2, which was a complete rewrite and break with the architecture of Zend Framework 1, the Zend Framework 3 initiative is more of an evolutionary change. [...] Another way of putting it: changes to the main repository are happening incrementally, and version 3 will just be a new major version update within the existing repository. However, such evolutionary change poses a slight logistical problem: the repository is currently named "zf2".

In order to make the change to Zend Framework 3 (and beyond) simpler, the repository will be renamed to "zendframework" instead. In the current configurations this namespace already exists and points to the correct locations so, ideally, no changes will need to be made on the Composer installations of current users - just updates to git remote entries to point to the new locations.

tagged: zendframework zendframework2 zendframework3 repository rename

Link: http://framework.zend.com/blog/2016-04-27-zf2-repo-rename.html

Matthew Weier O'Phinney:
On Deprecating ServiceLocatorAware
Apr 27, 2016 @ 11:16:51

In this post to his site Matthew Weier O'Phinney talks about a change in the Zend Framework ZendMVC package to deprecate the ServiceLocatorAware interface and some of the unexpected backlash of it.

A month or two ago, we pushed a new release of zend-mvc that provides a number of forwards-compatibility features to help users prepare their applications for the upcoming v3 release.

One of those was, evidently, quite controversial: in v3, zend-servicemanager no longer defines the ServiceLocatorAwareInterface, and this particular release of zend-mvc raises deprecation notices when you attempt to inject a service locator into application services, or pull a service locator within your controllers.

He shares some of the "constructive" feedback they received when they made the change, most importantly asking for a justification for the change. He then goes through their thinking behind the change, some of its original intent and how it allowed for "dependency hiding" in its use. He gets into some detailed code examples for this last point, some of the errors that could happen as a result and other issues (like no type safety and the brittleness of using a service locator).

tagged: deprecation servicelocatoraware interface zendframework zendframework3

Link: https://mwop.net/blog/2016-04-26-on-locators.html

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

Abdul Malik Ikhsan:
Start Using Middleware Approach with new zend-mvc
Mar 02, 2016 @ 12:54:37

Abdul Malik Ikhsan has a post to his site showing how you can integrate the concept of middleware in to the Zend MVC Component of the Zend Framework. Middleware has come into its own with the acceptance of of the PSR-7 standard and several frameworks adopting its structure for request/response handling.

zend-mvc 2.7.0 is coming, beside of the forward compatibility with V3 components, there is new middleware listener that allow us to do Dispatching PSR-7 middleware. The middleware can be an invokable class with __invoke() method.

He shows how, starting with a new project, to create the middleware class (in this case HomeAction) and the __invoke function. He then adds in the "home" route to the module configuration and points it at this HomeAction class. He registers it in the service manager as an InvokableFactory and it magically works. From there he refactors to allow the middleware to work with the ViewModel and change things like templates and variable values.

tagged: middlware zendframework zendmvc component psr7 tutorial invoke

Link: https://samsonasik.wordpress.com/2016/03/01/start-using-middleware-approach-with-new-zend-mvc/

Alejandro Celaya:
Improve DI in PHP apps with Zend Framework plugin managers
Jan 04, 2016 @ 11:40:39

In this new post to his site Alejandro Celaya offers some advice on improving the dependency injection of your application with the help of the Zend Framework plugin managers. More specifically he talks about the AbstractPluginManager, a part of the ZendServiceManager package.

Generally it is a very bad practice to inject a service container into any object, but there are some situations where it could be even good, when certain conditions are met.

In one of the ZF2 mailing lists somebody asked which were these situations. I couldn't find the email, but the answers said that you can do it when the service container manages resources of the same type, and your object virtually depends on all of them. [...] If you have another object that needs to perform database connections, you don't want to inject all of the connection objects into it, you should rather inject the connection pool. That will reduce the number of dependencies of your object.

In this situation, the connection pool is some kind of service container, but injecting it has more benefits than disadvantages.

He shows how to use the AbstractPluginManager to achieve this goal, noting the existence of a validatePlugin method that can be used to ensure all necessary dependencies are available. He includes a real example of it in use, creating a simple "social plugin manager" that verifies that the plugin provided is either a closure or instance of FilterInterface.

tagged: dependency injection di zendframework plugin manager tutorial abstractpluginmanager

Link: http://blog.alejandrocelaya.com/2015/12/31/improve-dependency-injection-in-php-apps-with-zend-framework-plugin-managers/

BitExpert Blog:
Prophiler PSR-7 Middleware
Oct 27, 2015 @ 10:42:54

On the BitExpert blog Stephan Hochdörfer shares a new tool, a PSR-7 compliant middleware, that allow easy integration with your current application of the Prophiler debugging/profiling tool.

Prophiler is a PHP Profiler & Developer Toolbar which is part of the Phalcon project but can also be used as a stand-alone component, kind of like the Symfony Web Debug Toolbar or Z-Ray. What I like about Prophiler is that on the one hand hand it is super easy to install and on the other hand offers a few nice adapters (e.g. PSR-3 logging or Doctrine integration) out-of-the-box.

The middleware is a simple Composer install away. He includes the code you'll need to make the Prophiler instance and how to hook in the middleware for use. His example uses the Zend Framework Stratigility structure but because it's a PSR-7 compliant package, it can integrate just as easily with any PSR-7 framework/library. He also includes a sample of running a request and mentions the automatic addition of the toolbar to the output.

tagged: prohpiler profiling psr7 middleware integration zendframework stratigility tutorial composer

Link: https://blog.bitexpert.de/blog/prophiler-psr-7-middleware/

Matthew Weier O'Phinney:
On 10 Years at Zend
Sep 21, 2015 @ 17:53:36

Matthew Weier O'Phinney has spent the last ten years of his career working for Zend as a part of their Zend Framework team. In this post to his site he looks back over the years, how it all started and where he is today.

10 years ago, as I write this, I was on a plane from Burlington, VT, to San Jose, CA, where I'd be starting work at Zend Technologies the next day as a PHP Developer.

He talks about where he started out at Zend (the eBiz team) and the kind of work he was given. It was early on that he started working with an internal, new project at the time: Zend Framework. He looks at some of his early contributions to the project and his "trial by fire" when he was asked to help give a tutorial about it at that year's ZendCon. He also mentions some of the people he's worked with along the way and gives thanks to the founding Zend team. Zend Framework was one of the first major frameworks out there and paved the way for the framework-driven environment we find ourselves in now. With Zend Framework v2 it encouraged a component-based system that spread quickly across the entire PHP community. Thank you Matthew for all of your hard work over the years, not just in the Zend Framework ecosystem but in the PHP community as a whole.

tagged: matthewweierophinney zend decade zendframework team development

Link: https://mwop.net/blog/2015-09-19-zend-10-year-anniversary.html

Zend Framework Blog:
Announcing the Zend Framework 3 Roadmap
Jan 23, 2015 @ 11:57:10

The Zend Framework project has a new post to their blog today officially announcing the roadmap for version three of the popular PHP framework.

The most often-asked questions we get around the Zend Framework project include: Where is Zend Framework heading? When will Zend Framework 3 be released? What changes and enhancements should we expect? Since inception, our goal for Zend Framework has been to further the art of PHP and ensure our users concentrate on the business logic of their application rather than wasting time reinventing the plumbing. The plumbing is Zend Framework’s job.

We have built an incredibly powerful framework with Zend Framework 2 that met its key goals of flexibility, consistency and testability. However, the world has changed since ZF2 was released, and the project needs to move with the times. With that in mind, we have gathered feedback from our users and core contributors to map the path forward. Zend Framework 3 will be an evolution from ZF2, concentrating on simplicity, reusability, and performance.

The post lists out a few of the things involved in this roadmap including separating components into individual, versioned projects and embracing the concept and functionality of middleware. If you'd like to get involved or just find out about the latest on this upcoming version, be sure you either join the zf-contributors mailing list or come to the #zftalk.dev channel on the Freenode IRC network.

tagged: zendframework zendframework3 release roadmap

Link: http://framework.zend.com/blog/announcing-the-zend-framework-3-roadmap.html

SitePoint PHP Blog:
Essentials of LDAP with PHP
Sep 26, 2014 @ 09:07:37

On the SitePoint PHP blog today Matthew Setter has written up a tutorial sharing the essentials of PHP with LDAP. He shows how to connect PHP to this industry standard technology and effectively query, update and delete information.

Ever wanted a simple way to store address book style information and network information actually next to any kind of ordered information? If so, then there’s a technology which has been around since 1993, one which despite not having the cool factor of such technologies as Node.js and Go, allows you to do exactly this. It’s called LDAP!

He starts off the tutorial by explaining a bit about what LDAP is (and isn't) for those not familiar with it. He covers some of the basic terminology, pointing you other articles if you need more than just his brief overview. Then he helps you get an LDAP server installed locally (using a package manager, apt-get) and how to verify the install is working correctly. From there he shows how to populate a few records and verify they exist. Following this, he gets to the PHP part of things, showing how to use the Zend Framework v2 Zend/Ldap component to access the server, query records and update/delete them easily.

tagged: tutorial ldap introduction query crud essentials zendframework zendldap

Link: http://www.sitepoint.com/essentials-ldap-php/

Rob Allen:
Using ZF2 Forms with Twig
Sep 23, 2014 @ 09:28:53

Rob Allen has a new post today showing how to integrate Zend Framework 2 forms into a Slim framework based application. He started the topic in a previous post and continues, this time using the Twig templating framework to handle the rendering.

The ZF2 view helpers, formRow and formElement now look like Twig functions, however we don't want to have to rewrite all our ZF2 view helpers into Twig. Fortunately, Twig supports the concept of a undefined function callback is called whenever Twig encounters a function that it doesn't know how to call. We can use this to proxy through to the ZendView system and get it to render the ZF2 view helpers.

He shows how to use this callback functionality and a custom view layer with the Slim-Views component to render the output. He includes a simple Slim example, setting up the custom View class as a parser extension and how to register the callback to invoke Twig.

tagged: zendframework twig render slimframework integration tutorial view

Link: http://akrabat.com/zend-framework-2/using-zf2-forms-with-twig/