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

Brandon Savage:
Avoiding Setter Injection
Oct 15, 2018 @ 16:11:38

Brandon Savage has a tutorial posted to his site covering the use of setter injection, some of the issues that can come with using it and how to avoid it.

PHP more or less has two kinds of dependency injection available: constructor injection, and setter injection. Constructor injection is the process of injecting dependencies through the constructor arguments. The dependencies are injected via the constructor, on object creation, and the object has them from the very beginning.

Setter injection is different; instead of providing the dependencies at construction time, the dependencies are provided via setter methods, once the object has been constructed. This allows the flexibility to configure the object during the runtime, rather than at construction.

He goes on to point out two flaws with setter injection: "half-baked" objects and the injection of potentially unused objects/resources. He spends the remainder of the post covering each of these topics more specifically and wraps it up with a recommendation to avoid it if possible and opt for useful, "fully baked" objects injected via the constructor instead.

tagged: tutorial avoid setter injection object halfbaked extra object resource

Link: https://www.brandonsavage.net/avoiding-setter-injection/

Matthew Weier O'Phinney:
Using Composer to Autoload ZF Modules
Aug 18, 2016 @ 14:50:11

Matthew Weier O'Phinney has a new post to his site showing you how to can use Composer to autoload Zend Framework modules right along with the rest of the ZF components.

One aspect of Zend Framework 3, we paid particular focus on was leveraging the Composer ecosystem. We now provide a number of Composer plugins for handling things such as initial project installation, registering installed modules with the application, and more. It's the "more" I particularly want to talk about.

With ZF2, we were able to realize the ability to install third-party modules into existing applications, enabling a module ecosystem. [...] For the v3 release, we wanted to solve this if we could. We were able to do so via a Composer plugin, zend-component-installer.

This allows ZF module authors to add details into the "extra" section of their Composer configuration, making it so the plugin understands how to load the module automatically. They've also created a package to help do the same for Apigility applications and lets you remove any calls to "getAutoloaderConfig" in your modules.

tagged: zendframework autoload composer zf3 apigility configuration extra package

Link: https://mwop.net/blog/2016-08-17-zf-composer-autoloading.html

SitePoint PHP Blog:
Enable PhpMyAdmin’s Extra Features
Jun 13, 2014 @ 18:53:48

On the SitePoint PHP blog there's a new post introducing you to some of the extra features in the popular phpMyAdmin tool, how to enable them and their use.

PhpMyAdmin is one of the most used tools when it comes to managing your databases. By default, PhpMyAdmin does a great job. However, it comes with a lot of handy extra extensions which can be easily activated. In this article, we will activate these extensions and see what they can do for us.

Among the extra features he talks about are things like:

  • Bookmarking
  • Clickable links for relations
  • Exporting relation information to PDF
  • Adding comments to column names
  • Viewing a history of queries run through the tool
  • Working with users and groups

There's lots more he covers too, so be sure to check out the rest of the post for more details and screenshots of the UI changes that come with them.

tagged: phpmyadmin extra features enable tutorial summary

Link: http://www.sitepoint.com/enable-phpmyadmins-extra-features/

David Coallier's Blog:
Quick Tip - PHP, SimpleXML and CDATA
Nov 06, 2007 @ 17:16:00

David Coallier has shared a quick tip today about the PHP/SimpleXML/CDATA combination and the creation of auto-generated classes.

I thought, hey I wonder how long it'd take in php.. so I was working on it and I actually couldn't remember all those funny extra parameters in simplexml_* so if you are googling and cannot find something that says exactly what you want well here it is.

His example includes two additional parameters in his simplexml_load_string call to handle the CDATA section correctly and make accessing the data inside the block just like getting at anything else in the object.

Note that Rob Richards has also commented on the post that this issue was corrected a while back and it shouldn't be needed anymore, but could effect older versions of the SimpleXML functionality.

tagged: simplexml cdata parameter extra simplexmlelement libxmlnocdata simplexml cdata parameter extra simplexmlelement libxmlnocdata

Link:

David Coallier's Blog:
Quick Tip - PHP, SimpleXML and CDATA
Nov 06, 2007 @ 17:16:00

David Coallier has shared a quick tip today about the PHP/SimpleXML/CDATA combination and the creation of auto-generated classes.

I thought, hey I wonder how long it'd take in php.. so I was working on it and I actually couldn't remember all those funny extra parameters in simplexml_* so if you are googling and cannot find something that says exactly what you want well here it is.

His example includes two additional parameters in his simplexml_load_string call to handle the CDATA section correctly and make accessing the data inside the block just like getting at anything else in the object.

Note that Rob Richards has also commented on the post that this issue was corrected a while back and it shouldn't be needed anymore, but could effect older versions of the SimpleXML functionality.

tagged: simplexml cdata parameter extra simplexmlelement libxmlnocdata simplexml cdata parameter extra simplexmlelement libxmlnocdata

Link:

Mikko Koppanen's Blog:
Trimming an image
Nov 02, 2007 @ 17:58:00

Mikko Koppanen shows how, in his latest blog post, to take an image and trim it down with Imagick to get rid of extra surrounding background information.

Especially product images usually "suffer" from this issue; the product itself is composited on a white background and there are large areas of white around the object.

This is a simple example to demonstrate how to easily trim the areas off the image and only display the parts where the object lies.

His example code, a quick 16 line affair, takes in the test image, looks for a RGB value given and uses the built-in trimImage function to reduce its size.

tagged: trim image extra background imagick example trim image extra background imagick example

Link:

Mikko Koppanen's Blog:
Trimming an image
Nov 02, 2007 @ 17:58:00

Mikko Koppanen shows how, in his latest blog post, to take an image and trim it down with Imagick to get rid of extra surrounding background information.

Especially product images usually "suffer" from this issue; the product itself is composited on a white background and there are large areas of white around the object.

This is a simple example to demonstrate how to easily trim the areas off the image and only display the parts where the object lies.

His example code, a quick 16 line affair, takes in the test image, looks for a RGB value given and uses the built-in trimImage function to reduce its size.

tagged: trim image extra background imagick example trim image extra background imagick example

Link:

Paul Stamatiou's Blog:
5 Ways to Speed Up Your Site
Jun 22, 2006 @ 12:31:06

Paul Stamatiou shares with us today five ways to speed up your site, some quick and easy recommendations to making your site fly.

Throughout the blogosphere I'm always seeing these blogs, that while they look great, are horribly slow and overburdened. Over the past few months I have become somewhat of a website optimization specialist, bringing my own site from an over 250kB homepage to its current 34kB.

I will help you achieve some of the same success with a few, powerful tips. Most of these are common sense, but I can’t stress their importance enough. I will concentrate on the website and not the server in this article, as there are too many things to discuss when it comes to server optimization.

The five tips mentioned include "Reduce Overall Latency by Reducing HTTP Requests" and "Compression", each with a paragraph or so of explaination as to what it is and how to implement it. There's even a PHP-specific one that talks about a paring down of the bits of functionality that really aren't needed.

tagged: speed up site ways latency images compression javascript extra speed up site ways latency images compression javascript extra

Link:

Paul Stamatiou's Blog:
5 Ways to Speed Up Your Site
Jun 22, 2006 @ 12:31:06

Paul Stamatiou shares with us today five ways to speed up your site, some quick and easy recommendations to making your site fly.

Throughout the blogosphere I'm always seeing these blogs, that while they look great, are horribly slow and overburdened. Over the past few months I have become somewhat of a website optimization specialist, bringing my own site from an over 250kB homepage to its current 34kB.

I will help you achieve some of the same success with a few, powerful tips. Most of these are common sense, but I can’t stress their importance enough. I will concentrate on the website and not the server in this article, as there are too many things to discuss when it comes to server optimization.

The five tips mentioned include "Reduce Overall Latency by Reducing HTTP Requests" and "Compression", each with a paragraph or so of explaination as to what it is and how to implement it. There's even a PHP-specific one that talks about a paring down of the bits of functionality that really aren't needed.

tagged: speed up site ways latency images compression javascript extra speed up site ways latency images compression javascript extra

Link:


Trending Topics: