PHPDeveloper.orghttp://www.phpdeveloper.org
Up-to-the Minute PHP News, views and communityen-usTue, 31 Mar 2015 17:03:45 -050030http://www.phpdeveloper.org/news/20053http://www.phpdeveloper.org/news/20053
On the VG Tech blog they show how, instead of copy and pasting configuration settings all across their Zend Framework v2 application, they used inheritance to specify just the differences.

When working on Zend Framework 2 applications you might come across situations where you need to differentiate the application configuration for the different application environments, be it development, staging, testing and/or production. This can be cache TTL's, Memcached hosts, Redis hosts, debugging levels and more. Instead of copy/pasting the complete configuration across multiple "environment"-configuration files or having switches in the code. [...] We wanted to use inheritance so that for instance the staging environment would inherit the complete production environment, with the exception of some caching configuration which we want to override in the staging configuration.

They show how to set up the default configuration files for the application and models as well as how to pull in the environment-specific values and overwrite them in the "$config" set. He also links to another post showing how to cache all of this configuration (involving a lot of files) to help with performance.

Link: http://tech.vg.no/2013/08/29/inheriting-configuration-in-zend-framework-2-applications/]]>Fri, 30 Aug 2013 12:46:47 -0500http://www.phpdeveloper.org/news/11429http://www.phpdeveloper.org/news/11429
Jani Hartikainen has followed up on a post from David Otten about standard classes in PHP and how they provide the base for much of what the language does.

David Otton posted a short but thought-provoking post about stdClass, which many think is the "base class" all PHP classes automatically inherit from. I have to admit that I had this misconception as well. [...] This [difference in PHP from other OOP languages] presents some room for analysis in how things are handled in dynamic and static languages, and how those differences affect things...

Janitalks about dynamic and static typing in languages and how that effects the base types things are extended from as well as some of the benefits that having a standard base class affords developers.