Forum Moderators: coopster

Message Too Old, No Replies

Using web application frameworks with PHP.

         

nelsonm

9:56 pm on Feb 11, 2012 (gmt 0)

10+ Year Member



Hi all,

Since i'm fairly new to PHP (1 yr so far), I did not know about application frameworks that are available for making complex php based web applications easier.

While searching, i see that there are a number of frameworks available such as Cakephp, Zend, Code Igniter, etc. I thought i'd ask your opinion on:

1. what you all consider to be the better ones?

2. Are they widely used like jQuery is for javascript.

thanks.

coopster

3:32 am on Feb 15, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Depends on the programmer. I've been coding for years and use my own "framework". Just know that whichever you consider will come with a learning curve. If you search WebmasterWorld for "PHP frameworks" you will likely find quite a few discussions and not much direction. Each developer has his/her own opinion.

rocknbil

4:51 pm on Feb 15, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Define "easier." If your applications are really small (like, an email form, a small 5-100 product custom shopping cart or something,) I see no reason to pull in a framework or even a huge library. The same is true of Perl, Javascript, or any language. If I need to do a simple show/hide of a help div on one page, I'm not going to load a 90K jquery library, I'll write out 20 lines (tops) of Javascript.

The primary consideration IMO is efficiency for end users and the amount of load it's going to place on the server, but one must temper that with need for expandability. If that 100 product database may grow to 5000 and may need integration into other technologies, a framework is probably a good idea.

Another aspect is ease of portability. If you become dependent on a framework in one environment then move the site to another server, you have to deal with the potential of differences in versions or even whether or not you'll be able to install or access that framework. I just went through a whole list of sites that worked similarly with a SOAP interface on an old version of various softwares. These sites needed to be moved to a new and updated server.

It worked perfectly on the old, but used deprecated methods to do what it did, then to add to the mix the API it was connecting with was deprecated and the vendor would offer no support. Basically, we did a complete rewrite as a standalone portable application that did not rely on frameworks.

So returning to 'define easier"': the worst thing about frameworks and libraries, especially for new programmers, is that they can copy and paste code, drop in this file and that, with little knowledge of what it's actually doing or the unseen effects. An example is a recent site I saw that included **ten** Javascript libraries, all dependent on jQuery, to achieve a few simple dynamic effects that could be done in under 100 lines of code.

At the end of the day, the job is done, but eventually you'll corner yourself into a situation where you don't understand why it's broken and can't dig into file after file of libraries or includes to figure it out. It's not a good place to be. :-)

nelsonm

8:09 pm on Feb 15, 2012 (gmt 0)

10+ Year Member



Thanks coopster.

Hummmm... every interesting rocknbil - you've given me some valuable insight into the possibility of going overboard on the use of frameworks.

Currently, I'm using the following frameworks to reduce the programming time involved in; producing basic grids and forms, manipulating the DOM, and producing UI widgets.

1. jQuery and jQuery UI - to manipulate the DOM and create better UI widgets.

2. jqGrid - to quickly produce basic administrative grids and forms.

The only other framework i was considering looking for, was something to help with MySQl/PHP. Assuming some framework to provide that kind of support exists.

At this point, I think i have been smart in my use of frameworks with regard to jQuery, jQuery UI and jqGrid. They have help reduce both programming time and code.

However, I'm under no illusion about frameworks. While they can reduce development time and code, you are stuck in their framework and soon discover the limitations. A case in point is jqGrid. It's a great package for quickly setting up nice looking and well functioning grids and forms. But i soon discovered that when i needed to format a jqGrid form in a specific manner. By default i could only reposition the fields i a grid pattern with labels on the left or right side of the field - that it! That's all you can do within the framework. I could not group certain field together with a box border and position the group any where on the form - along with other things you can't do. I just hit the walls of the framework since there currently is no jqGrid form generator. I would have to use a combination of jQuery and jqGrid low level methods to modify the dynamically generated jqGrid form to make it look the way i wanted.
It would be much easier to to it the old fashion way with html. But then you get hit again. Now you have one part of your systems' grids and forms that has the look, functionality and styling that jqGrid offers and the other part that does not unless you spend more time to manually program the non jqGrid grids and forms to look and function like the jqGrid framework.

So, as long as you can live within the limits of a framework - your good, if not, then you have some decisions to make and extra programming to do.

The one exception is jQuery and jQuery UI. I really don't see too much limitation with that framework.