News Feed
Sections




News Archive
feed this:

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

QaFoo.com Blog:
Struct classes in PHP
January 24, 2011 @ 09:59:22

On the QaFoo blog today there's a new post looking at building struct classes in PHP (by Kore Nordmann) as a replacement - and a step up - from storing data in structures like arrays.

In Apache Zeta Components and in several of my own projects we are using - so called - struct classes to solve this issue: The struct classes do not define any methods but just contain documented properties. They just deal as a data container, similar to a hash map.

He mentions a few benefits and drawbacks to using this approach including the fact that, while they're easier to document and can make things clearer in your IDE, they also are objects and are passed by reference by default (leading to possible unintended behavior). That being said, he includes a sample implementation so you can judge for yourself. The example defines a Location with a city and state properties that extends a base Struct class.

0 comments voice your opinion now!
struct class example array


Matthew Weier O'Phinney's Blog:
A Simple PHP Publish-Subscribe System
December 16, 2008 @ 10:23:26

In a new post to his blog Matthew Weier O'Phinney shares a simple publish-subscribe system he's created based on a feature of the Dojo toolkit using the Zend Framework to create an easy notification architecture.

The system has elements of Aspect Oriented Programming (AOP), as well as the Observer pattern. Its power, however, is in the fact that an individual object does not need to implement any specific interface in order to act as either a Subject or an Observer; the system is globally available.

The script creates an object that publishes an event. This event then sends off messages to all of the other objects subscribing to it. A code example is included. You also can check out the code from its page on github (as a part of his Phly libraries) and play with it yourself.

0 comments voice your opinion now!
phly publish subscribe system dojo object event message


Matthew Weir O'Phinney's Blog:
Phly Darcs Repository online
June 06, 2006 @ 06:19:50

Matthew Weir O'Phinney has this note for those working with the Phly PEAR channel - he's added a darcs repository to manage the contents of the channel.

If you're not familiar with darcs, it's a revision control system, similar to GNU Arch and git; changes are kept as patch sets, and repositories are branched simply by checking them out. This makes darcs repositories very flexible, and incredibly easy to implement. Static binaries are available for most systems, which makes it easy to install on systems to which you have no administrator rights.

There's also a web-based interface to it that uses Perl/XML/XSLT to create it, but he found it a bit constrictive and not customizable at all - so he ported it to PHP (using Cgiapp2), the result being Phly_Darcs.

0 comments voice your opinion now!
phly darcs repository created channel pear phly darcs repository created channel pear


Matthew Weir O'Phinney's Blog:
Introducing Phly_Struct and Phly_Config
May 20, 2006 @ 10:01:28

Matthew Weir O'Phinney has created his own modules that he shares in this post today - one to manage the config data for the application and another to act as a bridge between the scripts and that configuration store.

I often find myself needing a configuration module of some sort -- for storing application parameters, bootstrapping, template variables, what have you. The problem, however, is: once I bring them into my project, how can I access them? Better yet, would there be a way to bring in configurations of many types and still access them all in the same way?

He looked into several of the methods out there, but wasn't pleased with any of them - so he created his own, the Phly_Struct and Phly_Config modules. He talks briefly about what they are, but gets quickly into the code examples to prove their worth. It's a basic example tying the two of them together and loading some simple values into an instance of the Phly_Config. Both are available from the PHLY: PHP Library PEAR channel.

0 comments voice your opinion now!
modules configuration store struct interface library modules configuration store struct interface library


Matthew Weir O'Phinney's Blog:
PHP Library Channel
May 16, 2006 @ 06:00:08

Matthew Weir O'Phinney has posted this new item on his blog today, a look at his creation of a new PEAR channel (found here) where he's started work on a general use PHP library repository.

I've been working on Cgiapp in the past few months, in particular to introduce one possibility for a Front Controller class. To test out ideas, I've decided to port areas of my personal site to Cgiapp2 using the Front Controller. Being the programmer I am, I quickly ran into some areas where I needed some reusable code -- principally for authentication and input handling.

So what did I choose? To reinvent the wheel, of course! To that end, I've opened a new PEAR channel that I'm calling PHLY, the PHp LibrarY, named after my blog.

Some of the targets of his project include:

  • Loosely coupled; dependencies should be few, and no base class should be necessary.
  • Designed for PHP5 and up; all classes should make use of PHP5's features.
  • Tested; all classes should have unit tests accompanying them.

0 comments voice your opinion now!
library repository channel pear phly library repository channel pear phly



Community Events





Don't see your event here?
Let us know!


interview language version series security tool mvc release community symfony composer update library introduction podcast laravel package framework opinion voicesoftheelephpant

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework