 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Matt Knight's Blog: Optimising Zend_Config
by Chris Cornutt July 06, 2011 @ 10:39:01
Matt Knight has a recent post looking at a specific part of the Zend Framework, the Zend_Config component, and how it's overhead can be reduced (and somewhat replaced) using a few lines of PHP 5.3-specific code.
One such limitation that I've recently seen is the performance of Zend_Config. This class underpins the mechanism by which developers provide configuration to the application, and all this config is passed around in the form of Zend_Config objects. [...] For the purposes of this article, I'm referring specifically to config INI files, using Zend_Config_Ini to parse. This is a very common format for Zend applications to use - it is familiar to developers and infrastructure support teams - and is the case where the performance issues become apparent
He talks about parsing ini files and the complications that can come with the Zend Framework method of parsing them - conversion to objects via a recursive method, merging data from different sections and the overhead toArray can cause. He shows an alternative that uses array_replace_recursive to handle the parsing and a class version that offers backwards compatibility with the Zend_Config structure. He claims to have seen a sixty percent jump in performance using these methods over the Zend Framework's defaults.
voice your opinion now!
zendframework zendconfig optimize performance arrayreplacerecursive
Rob Allen's Blog: Local config files and Zend_Application
by Chris Cornutt November 29, 2010 @ 10:50:14
Rob Allen has a new post today showing you how to load in your own local configuration files into a Zend_Application Zend Framework app.
A friend of mine recently had a requirement where she wanted to have two config files loaded into Zend_Application, so that the specific settings for the server were not stored in the version control system. Hence she has two config files: application.ini and local.ini where local.ini is different on each server. The easiest way to approach this problem is to load the two files within index.php, merge them and then pass the merged config file to Zend_Application.
He includes the code to handle the import - pulling in both configuration files with Zend_Config and merging them with a "merge" call and setting their access back with a "setReadOnly".
voice your opinion now!
zendframework zendapplication configuration file zendconfig
Zend Developer Zone: Manipulating Configuration Data with Zend_Config
by Chris Cornutt September 29, 2010 @ 09:51:21
On the Zend Developer Zone there's a new tutorial from Vikram Vaswasi about working with the configuration data from your files (in multiple formats like XML and the more traditional INI) with the help of the Zend_Config component of the Zend Framework.
Thus far, I'd been using a hand-rolled library for this task; however, this library was now fairly dated and didn't take advantage of many of the newer PHP 5.x features and so, I'd been looking for a more modern replacement. Zend_Config seemed to meet my needs, so I played with it a little and then deployed it in a couple of projects. It did everything I needed it to, and was easy to integrate with both framework and non-framework PHP projects. It also has a couple of neat features, such as the ability to merge multiple configurations together.
His "crash course" starts with an example of pulling in the contents of an XML-based configuration file with dialer information (like for a modem). He talks about setting up rules, formatting the results, working with more complex nested data and much, much more. The Zend_Config component allows you to be hugely flexible with how you handle - and translate - the data that comes out of your config files.
voice your opinion now!
zendconfig zendframework configuration data tutorial
Muhammad Hussein Fattahizadeh's Blog: Zend Config tree solution
by Chris Cornutt June 22, 2010 @ 08:42:58
In a new post to his blog Muhammad Hussein Fattahizadeh talks about defining a system that's a bit more handy than the usual one configuration file to one Zend_Config object relationship most projects use. His alternative uses a class to load multiple config files all at once.
The best part of my favorite PHP framework, Zend framework is Zend_Config. With Zend Config you can run you web application with more power full configuration that any one can change your application setting for use. [...] But in most web application you may have many configuration file with special format such as INI, XML or PHP. Also some of configuration is for one part of your application and may you put in special folders.
He includes the code for his class that allows you to start with a base folder and search through it to find ini, xml and php files with configuration information inside. There's also a snippet of code showing how to use it and pull configuration objects from the data it fetches.
voice your opinion now!
zendconfig configuration zendframework tutorial
Ben Scholzen's Blog: Writing powerful and easy config files with PHP-arrays
by Chris Cornutt May 11, 2009 @ 12:05:45
Ben Scholzen has written up a post about how regular PHP arrays can be used as a native configuration option for your applications.
I was asked many times how I organize my config files, and my response was always the same, until some time ago when I switched began refactoring the codebase of my blog. [...] Looking at [the advantages of PHP config files], you may ask now why not everbody is using them. Well the problem mostly is that you cannot create extend-sections (when working with Zend_Config for example).
He compares an example of a method that, using a base config file with some "smarts", you can have it automatically pull in certain files and overwrite settings from the array inside. A sample "other config" file is also included, showing the definition of some PHP settings, resources and database information.
voice your opinion now!
configuration file array zendframework zendconfig smart base config
Knut Urdalen's Blog: The return value of include
by Chris Cornutt November 28, 2008 @ 10:33:57
In a new entry Knut Urdalen looks at something that some PHP developers might have forgotten about - the return value of the include statement.
PHP never stops surprising me. I just found out that you're able to return values from the inclusion statements (require, require_once, include and include_once) through an example of Zend_Config.
His example puts an array of values inside the include file with a return statement. This script is included from another and, because of the return, the array data is passed back out into a waiting variable set equal to the include statement.
voice your opinion now!
include return value array zendconfig example
|
Community Events
Don't see your event here? Let us know!
|