Zend framework coding style standard

Posted on May 16th, 2011 | Posted by admin

Hello again! Today I’ll discuss some of the basic coding rules if your’re using Zend framework (or even Magento, which is written over Zend framework). Some might think that this is an redundant topic, but I strongly disagree – if you work in a team.

Latin introduction

Well, the story about style standards is quite like goes pretty much like old Latin saying “De gustibus non est disputandum” which means “There is no disputing about tastes”. But same things apply to it as well, if you have a big corporate meeting, you won’t go dressed in diving suit, but in a regular one. If you take an parallel look at the coding styles, its pretty much the same. If you’re going to work with a team on new Zend project, some things must be applied. Otherwise you’ll end up in quite a mess.

Memory management in Zend framework

Posted on May 14th, 2011 | Posted by admin

Hello everyone! Recently I’ve noticed that some developers don’t pay much attention to memory management in Zend framework. And here I’m not talking about Zend_Cache, but rather about object sizes. And if you’re thinking that I’m writing nonsenses, let me show you how to reduce memory usage by more than 100 times .

First of all, I’m going to use PHP’s built in function memory_get_usage() to get difference. Just look at this example, and you’ll know what I’m talking about:

MySQL transactions in Zend framework

Posted on May 13th, 2011 | Posted by admin

Hi! Today I’m going to explain a part of Zend framework DB functionality. Transactions in general are quite useful, like temporary tables, but in most of situations unnecessary. Because of that, I’m going to explain when and how to use them through Zend framework.

What is transaction?

A simple answer would be – a number of individual queries that are grouped together.

An example would be something like this:

UPDATE balance SET total = total - 100 WHERE account_id=1;
UPDATE balance SET total = total + 100 WHERE account_id=2;

Zend Framework navigation with breadcrumbs

Posted on April 26th, 2011 | Posted by admin

It’s been a while since I last time played with beauty of Zend Framework.

Each time I check new features it seems to me that the things are more simplier than the last time,
I might be wrong (I wouldn’t bet on that) or I’m just getting better

Let’s check this piece of cake – how you can create navigation with breadcrumbs in Zend Framework project.
As many things in Zend Framework you can get same features in different ways,
so the same thing goes with the Zend_Navigation class.

First of all you need to decide which way you will choose:
- navigation with xml setup file or
- from application.ini file

Working with multiple PHP frameworks – The best practice

Posted on April 21st, 2011 | Posted by admin

Hi, first of all, I’d like to explain the title of this post. I won’t go into depths of complicated examples, but rather explain the logic of it.

PHP first implemented OOP (Object Orientated Programming) the right way in version 5. OOP is powerful tool in any programming language. But the next logic step was to create framework as an “abstract layer” that will help developers in both speed and quality of their work. To conclude this brief introduction, I’ll say that there are many frameworkswritten in PHP for PHP.

Now to the fun part. For example I’ll use Magentos framework, that is written over Zend framework. To make stuff just a little bit more complicated. Zend framework is written on top of PHP’s built in functions.

Now, if you are a Magento developer , you need to work by rules, or there will be problems with your Magento extensions, modul, etc. I promise. The problem is if you, lets say, use Zend framework directly in Magento module, which you can (Magento is its “extenstion”, which allows you to call parent methods). Why, you ask me? Well, to answer that, I will ask you a question. What will happen if you upgrade Magento to latest version which excluded some Zend framework functionality from its libraries?

Page 1 of 212»