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

Marc Morera:
Namespaces in Traits
Oct 16, 2015 @ 18:53:14

In this post to his site Marc Morera talks about traits, namespaces and how they fit together (or don't).

Some projects using PHP 5.4 are actually using Traits. If you don’t know yet what a trait is, there are some interesting links for you. [...] This post is about the usage of "use statements" in Traits.

He starts with an overall picture of what he's trying to accomplish in a contribution to an open source project (with a word of caution). He talks about how you can make traits and classes more "friendly" with a refactoring example of his initial code snippet. In the end, though, he recommends basically avoiding namespaces if possible in traits, reducing headaches that could be caused either by conflicts or missing dependencies.

tagged: traits namespace difficulty dependency interaction

Link: http://mmoreram.com/blog/2015/10/16/namespaces-in-traits/

MaltBlue.com:
Are TableGateways Worth it in Zend Framework 2?
Nov 27, 2013 @ 17:34:28

On his MaltBlue.com blog Matthew Setter shares his opinion on TableGateways in Zend Framework v2 and wonders if they're "worth it" (as they're not the easiest thing to implement).

Are TableGateways too hard to implement in Zend Framework 2? Are they too hard to justify the effort? That’s what I was asked recently during a Twitter conversation. For me, they’re not. For me, they’re well worth the effort. So I’ve written this post to show why they’re not, and how they bring great flexibility, when implemented correctly. In [this post] I’ll set out why they can be a good solution, as well as why not.

He starts from the origins of PHP scripts, back when they were "a collection of files" and not structured under much of a framework. Complexity added the need for this structure, though, including things like design patterns for common tasks. The TableGateway was one of these. He talks briefly about implementing them in Zend Framework v2 (with some gist examples) and some questions to ask helping you determine if they're "too much" for you app.

tagged: tablegateway designpattern zendframework2 implement difficulty

Link: http://www.maltblue.com/patterns/why-tablegateways


Trending Topics: