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

MaltBlue.com:
Zend Form Mastery with Zend Config - Part 4 Configuring Zend Validators
June 05, 2012 @ 11:25:45

On the MaltBlue blog Matt has posted the latest part of the "Zend_Form with Zend_Config" series, part four looking at using and configuring some form validators.

Welcome to the fourth and final part in the Zend Form Mastery with Zend Config series. Previously we looked at the basic form options, element and form wide prefixes, filters and element options. In this installment, we're going to look at configuring Zend Validators via our XML config. [...] To go in to all of them will take more time than is allowed in the confines of this article. So we're going to work through 5 of the more interesting and likely used ones.

He covers the validation for: email addresses, postal codes, seeing if a record exists in the database, IBAN validation and checking to see if a value is in an array. He gives XML examples for each of these validation methods including the definitions of options and error/feedback messages.

0 comments voice your opinion now!
zendform zendconfig configure validator tutorial xml


MaltBlue.com:
Zend Form Mastery with Zend_Config - Part 3, Standard Form & Element Options
May 22, 2012 @ 09:16:31

On the MaltBlue.com blog they've posted the latest part of their series on using Zend_Config configuration files to create Zend_Form elements. In this latest article, they show how to set some of the other properties on the elements (like "readonly" or "required").

We've looked at custom form filters and we've looked at the core form configuration. But what about the other form properties? What about: setting an element as readonly, an element as required, ignoring an element and love them or hate them, what about decorators.

He shows how to update the XML file to add these new attributes into the structure and the resulting form. Also included are a few examples of using decorators to configure the look, feel and modify the attributes.

0 comments voice your opinion now!
tutorial zendconfig zendform xml configuration


MaltBlue.com:
Zend Form Mastery with Zend_Config - Part 2, Core Form Configuration
May 15, 2012 @ 11:04:01

In his previous post to the MaltBlue.com blog Matt introduced the concept of configuration-driven Zend_Form instances. He's back with a second part to the series, enhancing his original examples by covering some of the base-level form configuration settings.

Ok, this should have been part one, but irrespective, here's the second installment in zend form mastery with zend config - core form configuration. As the W3c Form spec says, there are 8 attributes applicable to forms.

These attributes, including "action", "name" and "onsubmit", can all be set easily in the XML-based configuration file. He includes an example of the full XML file to show how they all fit together (updated from part 1). You can see an example of the output here and can grab the source for the example from github.

0 comments voice your opinion now!
zendframework zendconfig zendform generation xml tutorial


MaltBlue.com:
Zend Form Mastery with Zend Config - Part 1, Custom Filter Paths
April 30, 2012 @ 08:16:22

From MaltBlue.com there's a new post (the first in a series) about mastering Zend_Form. In this first part of the series, they look at creating custom filter paths with the help of the Zend_Config component.

When you're working with Zend Framework, and code in general, you keep your configuration as much out of code as you can - right? Well, if you want to write maintainable and flexible code you do. Well, if you've been working with Zend Framework and Zend Form for more than a little while, you know that it really makes that pretty simple via Zend_Config - well, some of the time.

The article shows introduces you to some of the common configuration settings of Zend_Form and how those can be set in a configuration to make building the forms simpler. They talk about pre-element and form-wide filters in this first part of the series, including some code/configuration examples.

0 comments voice your opinion now!
zendframework zendform zendconfig configuration tutorial


Konr Ness' Blog:
Zend_Config Benchmark - JSON, Array, INI, XML, YAML
March 08, 2012 @ 11:51:32

In this recent post to his blog, Konr Ness has benchmarked the components that the Zend Framework uses to read in different types of configuration files - JSON, native PHP arrays, INI, XML and YAML files.

If you application relies on parsing one or several config files each time it is bootstrapped it is important that you select a file format that is fast to parse. But you also want to select a config file format that is easy for a human to read and edit. In a recent application I am building I also had the need to write modifications to config files, so I also benchmarked the Zend_Config_Writer components.

He includes both the sample configuration INI file and the benchmarking script he used to measure the results (all configurations were read from external files, even the native PHP option). His results were pretty predictable (with the exception of YAML reading) with the standard INI file coming in second to the native PHP arrays, but having the advantage of being more readable.

0 comments voice your opinion now!
zendconfig zendframework benchmark json array ini xml yaml


Matt Knight's Blog:
Optimising Zend_Config
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.

1 comment voice your opinion now!
zendframework zendconfig optimize performance arrayreplacerecursive


Rob Allen's Blog:
Local config files and Zend_Application
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".

0 comments voice your opinion now!
zendframework zendapplication configuration file zendconfig


Zend Developer Zone:
Manipulating Configuration Data with Zend_Config
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.

0 comments voice your opinion now!
zendconfig zendframework configuration data tutorial


Muhammad Hussein Fattahizadeh's Blog:
Zend Config tree solution
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.

0 comments voice your opinion now!
zendconfig configuration zendframework tutorial


Ben Scholzen's Blog:
Writing powerful and easy config files with PHP-arrays
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.

0 comments voice your opinion now!
configuration file array zendframework zendconfig smart base config



Community Events





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


release list opinion install api threedevsandamaybe community laravel series introduction language interview unittest refactor developer symfony2 code podcast testing framework

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