News Feed
Jobs Feed
Sections




News Archive
feed this:

Robert Basic's Blog:
Using the new autoloaders from Zend Framework 1.12
June 22, 2012 @ 08:17:05

Robert Basic has a new post today about the autoloaders in Zend Framework 1.12 and how to use them to create a classmap for use in your application.

The latest, and last, release of the Zend Framework 1.x series is just around the corner as ZF 1.12.0RC1 was announced this week. As I still have projects running ZF1 I thought about giving the most interesting new feature (for me) a spin - the new autoloaders which are backported from ZF2. I decided using the classmap autoloader as the main autoloader, and the good ol' standard autoloader as the fallback autoloader.

He includes the changes to the Front Controller (index.php) to have it know about these new autoloaders and has a command that will go through your code any pull out any require_once statements out and let the autoloader handle it instead.

0 comments voice your opinion now!
zendframework autoloader classmap tutorial requireonce


Stefan Koopmanschap's Blog:
Using custom namespaces with (C/S)ilex and Composer
April 12, 2012 @ 12:22:47

Stefan Koopmanschap has a quick new post to his blog with a handy tip for Composer and Cilex/Silex users when dealing with custom namespaces.

For a new proof of concept application I'm building, I need both a simple web interface as well as some commandline tools. I decided to use Silex for the web interface and Cilex for the CLI tools, and opted for using Composer for installing these dependencies into my project. I ran into some issues with the custom project libraries I was building for this application however. Registering my custom namespace into Silex and Cilex didn't result in the classes being loaded for some reason. Composer helped me out though.

His solution involves letting Composer be the default autoloader for the application via an "autoloader" configuration option in the "composer.json" (that can also take a classmap option if you're not PSR-0 compliant, see here).

0 comments voice your opinion now!
custom namespace cilex silex composer psr0 autoloader


Rob Allen's Blog:
Using ZendLoaderAutoloader
February 13, 2012 @ 09:54:43

In a new post to his blog Rob Allen introduces you to the autoloader that comes with the Zend Framework 2 and shows how to use it to load your own classes.

Autoloading is the process in PHP whereby the system attempts to load a class when it is first encountered (via new or via class_exists) if it hasn't already been loaded via a require or include. Autoload works by looking for a method called __autoload or walking through any method registered with spl_autoload_register. Zend Framework 2 provides the ZendLoaderAutoloader component for autoloading of Zend Framework and your own classes.

The PSR-0-standard tool allows you to load files, set up class mapping and allows for multiple autoloading methods to work side-by-side. He shows how to use the standard autoloading functionality to define paths to locate files (with prefixes and namespaces) in both a constructor-based setup and a more programatic approach. He also shows how to use the ClassMapAutoloader to load from a mapping of class name to class file. Wrapping it up, he shows how to combine the two methods into a single ZendLoaderAutoloaderFactory instance.

0 comments voice your opinion now!
zendframework autoloader classmap standard tutorial


Liip Blog:
Integrating Magento into Symfony2
September 22, 2011 @ 12:47:56

On the Liip blog today, there's a quick post about integrating Symfony2 and Magento, the popular PHP-based ecommerce platform.

So last week four developers sat together on a regular Hackday to see what's needed to hook up Magento into Symfony. To make this short the outcome is a Magento bundle for Symfony2. When we met in the morning we weren't even sure what exactly to try out but soon agreed on implementing a Symfony authentication which uses the Magento customer database.

The post talks about some of the issues they came across in their work - mainly a problem with incompatible autoloaders. There were also problems getting the logins to play nicely with each other and each product's session handling. You can find the current results from their hacking in this bundle posted to github.

0 comments voice your opinion now!
symfony2 magento integration login session autoloader bundle


Matthew Weier O'Phinney's Blog:
Backported ZF2 Autoloaders
May 11, 2011 @ 09:33:20

In a new post Matthew Weier O'Phinney talks about autoloaders in the Zend Framework and the changes they've made from ZF1 to ZF2. He also includes a link to a package you can try out if you'd like to backport the ZF2 autoloaders to your ZF1 application.

Interestingly, I've had quite some number of folks ask if they can use the new autoloaders in their Zend Framework 1 development. The short answer is "yes," assuming you're running PHP 5.3 already. If not, however, until today, the answer has been "no." I've recently backported the ZF2 autoloaders to PHP 5.2, and posted them on GitHub [tarball here].

His autoloader backport scripts include a class map generation tool, a PSR-0 compliant autoloader, a class map autoloader and an autoloader factory for loading multple strategies at once. He also includes a sample of how to use it with a bit of the output it might give you for your project.

0 comments voice your opinion now!
zendframework autoloader backport github


Volker Dusch's Blog:
Autoloading for legacy, non-framework projects
March 09, 2011 @ 12:02:06

In his latest post Volker looks at something he sees more and more projected implementing as a simple way to not have to manually define paths all over their applications - creating autoloaders. His post shows how to create one such autoloader for a legacy, non-framework type of project.

The first argument usually is "ease of use". It can get pretty annoying when you have to clutter your whole application with "require this file here and that file over there" statements. [...] The main motivation for autoloading usually is "getting rid of all the require statements and the problems resulting from forgetting one at one point where you don't notice it because on your machine it worked.

In some projects you're lucky enough to have class name to file name mapping to make it simpler. His project didn't have that, so he needed a way around it. His answer came in the PHP Autoload Builder tool - a handy command line script that works through your code and builds an index of sorts you can refer to for the correct class-to-file map.

0 comments voice your opinion now!
autoloader classmap phpautoloadbuilder tutorial


Rafael Dohms' Blog:
SPL a hidden gem
June 10, 2009 @ 11:19:06

Earlier this month Rafael Dohms posted a new article to his blog looking at a feature of PHP it seems not every developer knows about - the Standard PHP Library (or SPL).

By a show of hands, how many people here ever heard of SPL? How many already used it? Chances are most of you didn't raise your hands, and some might even have a confused look on their faces. Indeed that is the sad reality when it comes to SPL, but What is SPL?

He goes on to look at a few different things the SPL has to offer like autoloader overloading, iterators (with an included list of 21 of them) and the SplFixedArray that can be used to help speed up array access and manipulation.

0 comments voice your opinion now!
splfixedarray autoloader iterator spl


ServerGrove Blog:
Configuring Symfony to use Zend Framework 1.8.0 new Autoloader
May 01, 2009 @ 15:56:37

This new post on the ServerGrove blog today looks at using the updated Zend_Loader component of the Zend Framework from inside a Symfony application.

Zend Framework 1.8.0 was released yesterday and if you are using it within a Symfony project, you need to know something: Starting on 1.8.0 Zend_Load::autoload() is deprecated and will be removed on 2.0.0.

With the updated loader, if you'd like to use it inside Symfony, you need to change the function you're using to autoload via a call to spl_autoload_register. Point this at the Zend Framework code and you should be good to go.

0 comments voice your opinion now!
symfony zendframework autoloader framework splautoloadregister


PHPRiot.com:
Zend Framework 101 Zend_Loader
March 12, 2009 @ 08:44:13

PHPRiot has started up a new series looking to introduce you to the Zend Framework one piece at a time. In this first article n the series Quentin Zervaas looks at one of the first components any Zend Framework-based application hits - Zend_Loader.

In this article I will introduce you to Zend_Loader, a Zend Framework class used to automatically load other classes. Typically you would use include_once() or require_once() when you want to load a class but using Zend_Loader you don't have to.

He talks some about how it works, how to enable an disable it and how you can replace it with your own custom autoloader if you want. He gives an example of doing this, overriding the loader with a call to registerAutoload to register his autoloader class.

1 comment voice your opinion now!
zendframework autoloader zendloader component tutorial



Community Events











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


language opinion example series code composer interview functional testing database introduction community tool release zendframework2 podcast conference framework object development

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