Maintaining a Magento code base

Magento is hard. No doubt about it. But this is not an excuse. Beside that (and a few other issues) it's still the number one e-commerce solution. It's proven.

So, i wanted to talk a little about how i maintaining my Magento projects.

1) I am keeping everything under version control

Magento's folder structure brings a lot of frustration. An extension can place it's files almost anywhere it's developer wants. It can be in base package theme either in package default theme. It can be in media folder for permanent files you want to keep under control either in /js folder for Javascript global libraries.

Keeping a .gitignore with all the Project's specific files is almost impossible.

Also, you can't carry with you your Project's modules, except using Composer with Magento which it's also complicate to work with. (Still struggling with it on Windows)

So, what i do is keep everything under version control, except temporary files like cache, logs, etc. etc.

2) Never touch core files

By never touching core files like in folders:

  • app/code/core
  • app/locale/
  • app/design/frontend/(base|default|rwd)
  • app/design/adminhtml/
  • js/ (initial folders only)
  • lib/ (initial folders only)
  • skin/frontend/(base|default|rwd)
  • includes/
you make sure that, when a feature release is out, you can just copy paste above you project and everything still works fine.

Keeping your Magento always up to date can save you from big disasters. I must make sure that feature releases wont be a pain to get.

3) Extend everything

In case you need to extend a Magento's core functionality or make it behave different, you are covered.

Magento's team had a purpose and only one. To make the most extensible e-commerce framework out there. They even sacrifice performance on this purpose. Now, some may argue that that was stupid or they didn't success after all. I will have to disagree with both.

Magento is a true PHP OOP project, powered by the most powerful framework, the Zend Framework.

As about performance, these days you have a lot of tools in order to create a fast website. You may be hosted at an AWS super server, use fast caching methods, etc, etc.

4) Keep a local Magento with stuff i use a lot

After a few projects, i realized that a lot of processes were repeated again and again. The same modules i will installed on every fresh Magento install, the same configuration i would do. So i keep a private(yet!) Magento repository were i have all of my Modules and a clean Database dump with my configuration set.

How do you deal with your Magento projects? Share your tactics and technics with me on Twitter or bellow in the comments.

Comments

Read Next

Magento 2 Roadmap : Long walk to freedom
6 September 2014
I am Kostas Bariotis, a web developer, a proud wanderer and a passionate doer. My mission is to write clean and efficient code, to solve problems on the Web and to learn something more. Read more about me or get in touch .