 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 7)
by Chris Cornutt January 16, 2012 @ 08:46:22
Fabien Potencier has posted the seventh part of his series looking at how to make a custom framework on top of the components from the Symfony2 framework. In this part of the series he improves his basic framework by adding some namespacing to organize the application a bit more.
If you have a closer look at the code, front.php has one input, the Request, and one output, the Response. Our framework class will follow this simple principle: the logic is about creating the Response associated with a Request. As the Symfony2 components requires PHP 5.3, let's create our very own namespace for our framework: Simplex.
He puts the main front controller in just the "Simplex" namespace but adds in others for the controllers and models. He also updates his Composer configuration to create some PSR-0 autoloading.
voice your opinion now!
symfony2 components framework custom tutorial series namespace autoload
Anthony Ferrara's Blog: On PSR-0 Being Included In PHP's Core
by Chris Cornutt November 04, 2011 @ 08:34:50
In a new post to his blog today Anthony Ferrara looks at the (heated) discussion that's popped up around having the PSR-0 autoloader standard included as a part of the PHP core. He gives his reasons (three of them) why he's not for the decision.
Recently there has been a rather heated and intense discussion on whether the PSR-0 autoloader "standard" should be included as part of the PHP core (in ext/spl to be exact). I've tried to stay out of the discussion and have successfully done so. Until today. I feel that there's something that's been missing to the discussion. So rather then posting this to the internals list, I feel it's better served by a blog post on the subject. So here's my take on it.
As mentioned, he's not in favor of the inclusion for three different reasons:
- It's inconsistent with current PHP functionality and would bias development one way or another
- It's not an actual standard, just a loosely defined practice based on functionality already in place
- There's noting for core to gain by adopting it and could cause problems trying to make things fit a one-size-fits-all solution.
voice your opinion now!
psr0 core functionality autoload standard opinion
rooJSolutions Blog: Watch-out PHP 5.3.7+ is about.. and the is_a() / __autoload() mess.
by Chris Cornutt September 02, 2011 @ 10:43:24
New from the rooJSolutions blog there's a post pointing out an issue that PHP 5.3.7 has broken the is_a functionality in a lot of cases. The post talks some about what's broken and how you can work around it if you're effected.
The key issue was that 5.3.7 accidentally broke is_a() for a reasonably large number of users. Unfortunately the fixup release 5.3.8 did not address this 'mistake', and after a rather fruitless exchange I gave up trying to persuade the group (most people on mailing list), that reverting the change was rather critical (at least pierre supported reverting it in the 5.3.* series).
This new issue was causing some strange errors to pop up in his code because of a parameter type change in the is_a call, updating the first parameter to be an object instead of a class name. The is_a() call sends its requests to __autoload in some cases and the string->object mismatch of those parameters causes errors to be thrown. His workaround is, in your checking, just be sure to call an is_object first before passing things off to be is_a() checked and autoloaded.
voice your opinion now!
bug isa autoload parameter change string object
Elated.com: Object-Oriented PHP Autoloading, Serializing, and Querying Objects
by Chris Cornutt July 01, 2011 @ 08:29:45
On Elated.com today there's the fourth part of their series looking at object oriented programming in PHP. This time the focus is specifically on autoloading classes, making objects into strings (serialized) and introspection.
If you've read all the articles up to this point then you're already familiar with the most important concepts of object-oriented programming in PHP: classes, objects, properties, methods, and inheritance. In this final (for now, at least!) tutorial in the series, I'm going to tie up some loose ends and look at some other useful OOP-related features of PHP.
He looks at each of the three topics above and includes code for things like a simple autoloader, object serialization, using sleep/wakeup and an example of using functions like get_class, get_class_methods and get_object_vars to do introspection on your classes and objects.
voice your opinion now!
oop tutorial class object autoload serialize introspection
php|architect: Image Processing with Imagine
by Chris Cornutt March 07, 2011 @ 10:53:42
New from the php|architect blog, there's a tutorial from Mike Willbanks about using Imagine to transform images dynamically in a more object-oriented way.
Image processing in PHP is a necessary evil but is needed more often than not in just about every web application. With the various preferences in image processing libraries (think ImageMagick, GraphicsMagick and GD) it is difficult to find a library that provides a unified object oriented interface as well as implementing the general tasks in a simplistic fashion. Imagine is an open source image manipulation library built with PHP 5.3 that implements an object oriented interface to ImageMagick, GraphicsMagick and GD
Mike gives a quick sample script that uses SPL autoloading to pull in the classes as they're needed (with the "imagineLoader" method) and make a basic thumbnail from a PNG file.
voice your opinion now!
imagine image process manipulate oop autoload
Matthew Weier O'Phinney's Blog: Autoloading Benchmarks
by Chris Cornutt August 18, 2010 @ 10:14:59
Matthew Weier O'Phinney has a new post to his blog (following this post on directory iteration for autoloading) with some of the benchmarks of different methods he tried for automatically loading the libraries his scripts needed on demand.
During the past week, I've been looking at different strategies for autoloading in Zend Framework. I've suspected for some time that our class loading strategy might be one source of performance degradation, and wanted to research some different approaches, and compare performance. In this post, I'll outline the approaches I've tried, the benchmarking strategy I applied, and the results of benchmarking each approach.
His testing included a baseline of the Zend Framework 1.x series loading, a naming/class standard following the PEAR standards and class mapping with file/class name pairs. He includes his benchmarking strategy and the scripts he used to run the tests (on github here). He ran them both with and without opcode caching to give a better overall performance view.
voice your opinion now!
autoload benchmark classmap spl pear psr0
Robert Basic's Blog: Loading custom module plugins
by Chris Cornutt July 20, 2010 @ 14:04:43
Robert Basic has a quick new post to his blog today showing how to load custom module plugins in your Zend Framework application.
I was trying to load a Front Controller plugin which resides in app/modules/my_module/controllers/plugins/ and not in the 'usual' lib/My_App/Plugin/. I want this plugin to be called in every request and I want the plugin file to be under it's 'parent' module.
To solve the problem he added a path to the Zend_Application_Module_Autoloader as a resource and registered it in the front controller. He includes some code to show how it works - a simple bootstrap with two _init functions, one for the news autoloading and another for plugins.
voice your opinion now!
plugin custom module zendframework autoload bootstrap
Court Ewing's Blog: Zend Framework Modules Autoloading & Namespaces
by Chris Cornutt July 07, 2010 @ 08:39:53
Court Ewing has written up a new post about using Zend Framework modules and things you need to worry about with considering autoloading and namespacing them correctly.
Modules are natively supported in Zend Framework, but their implementation is not conducive to flexible autoloading nor the use of namespaces in PHP 5.3. There may be a few contributors out there that will defend the current implementation of module autoloading, but throughout the development lifecycle of the current Model-View-Controller implementation in the framework, poor design decisions have made working with modules less flexible and more frustrating.
Because of these poor decisions there are a few problems that you'll need to overcome when using modules, specifically in dealing with naming conventions currently in place in the framework and how that can make autoloading more difficult. He has a concept he's worked up to try to help the situation - Epixa, a system for fully namespacing out modules so a simple directory structure correctly reflects the namespacing.
voice your opinion now!
zendframework module autoload namespace expia
|
Community Events
Don't see your event here? Let us know!
|