What is the reason to use PHP frameworks when we have wide range of Content Management Systems available in the market.\

Recommended Answers

All 13 Replies

Member Avatar for diafol

Apples and pears. I tend to use frameworks (only Laravel these days) to develop bespoke sites. CMSes useful for something that have a number of commonly used features. CMSes are generally easy to use and you can build sites extremely quickly almost entirely through an admin panel. Often you won't need to touch any code. If a client wants a quick and simple site, I may suggest Wordpress. Something a little more involved, maybe Joomla (which is a pig). Well that's my experience.

But then there's October: https://octobercms.com/ a cms built on Laravel. I haven't played with it much yet, but it looks fun.

I would like to exapnd on that question ...
What can I build with a framework and what can I build with a CMS?

I usually build sites from scratch using php and other languages. Is there a big difference when using frameworks, and does it make the site slower.

When I first started learning javascript I didn't like jQuery, but when I first coded with it I got hooked, I won't start a project without it.

Is jQuery considered a framework?

Yup jquery is framework of java script, php frameworks are fun to work as compare to core php

Member Avatar for diafol

Frameworks have their haters and fanboys. For big projects, I think you'd be a bit insane to code everything by hand from the ground up. For small sites, then a framework with its models, controllers/routers, views and all the other paraphernalia may be overkill. A cms however, may be just the job - you can get a site up and running in an hour or less.

I totally agree with all of the definitions above. On the other hand, frameworks can limit the type of application that you can built. However, there is a framework like CodeIgniter that can be easily bent, molded, and hammered to your requirements.

If you will be distributing an application intended for all types of hosting, then framework may not be your best choice, because framework tend to consume more resources.

Using framework you are in control of your source codes and libraries. Meaning, you will be writing them instead of a download and intall found in CMS. If written properly, framework application are more secure, because you don't have to rely on downloadable plugins similar to the ones found on CMS.

For really serious application, I personally prefer writing it in the framework rather than cutting corners and downloading the readily available CMS with unknown plugins from unknown authors.

Since you are already proficient in using jquery, have you look into possibility of using node.js that can utilize expressjs, sails.js, and Koa frameworks?

Although your question is PHP related, node.js is perfect for big and small web application. Besides, node.js can utilize the simplicity and speed of MongoDB.

Is node.js suitable for web applications, I thought its for creating network applications ?

Member Avatar for diafol

node.js is suitable for web apps.

CMS'/frameworks have vast ability differences. We can talk about generalized pros/cons all day, but the biggest influence should be your ability. If you've written a fairly decent PHP application before, with maybe some experience in OOP, frameworks are an option. If you want to keep it simple and problem-free CMS' might be a better choice.

Content management systems can be extremely restrictive, because all you're
essentially exending a much bigger program. You have to work as part of that program, whereas a framework your application is completely indipendant. However, as mentioned already, a framework is a powerful tool - often too powerful if you're after a generic set of features. Personally I love wordpress, which is great because it provides an excellent platform to extend what they have done - and offers a massive range of plugins and themes. If you use a framework, however generic, you've got to do most of it yourself. Sometimes it's simply not worth it - most people would ask "can I do it fairly easily in a CMS?" if no, use a framework.

The thing I like about frameworks over writing everything is the security and efficiency. Often I look at bits of code and see dozens of costly mistakes (even in CMS based applications), and always worry: what if I did that in one of my projects? Imagine the damage if someone hacked one of my programs. For most levels, frameworks offer a degree of safety - if you follow the simple rules set by the framework you can't go wrong. I might as well point out: CMS' are always getting hacked (because soo many people use them), so you need to regulary keep up to date. This can be a chore for those using your application and might end up interfering with your program when the client updates. Havoc.

Everyone will no doubt have an opinion to this, but it completely lies with the nature of your project and the skills you have.

commented: good point wrt security +15
Member Avatar for diafol

It's worth mentioning now that mattster has started, that the core CMS code is usually ok - not perfect - but usually. It's all the third party plugins and addons you have to be especially wary of. Just because they may be listed on the CMS own site does not mean that they are safe. Likewise, I've seen some pretty ropey tutorials on frameworks. It doesn't help that the majority of framework documentation I've come across is a bit lacking to say the least. Documenting classes is one thing, but they really do need to realise that real people outside the framework development team are going to use their "product". Shame they don't give documentation the same love as they do to their coding. Sorry, rambling... feel another rant brewing under the surface.

@diafol: have you seen the documentation for CakePHP?

I never really have to search much up because the team have written a nice "book" that takes you through getting started right up to caching, localisation and onsole/shell scripting with nifty little examples. I quite like it (generally I really link the framework), what do you think?

Member Avatar for diafol

CakePHP isn't one I've invested any time in I have to admit. Thanks for link - I had a quick scan and it seems ok. I quite like the simplicity of it too.

I've dumped CI and Yii (which I loved btw) and I'll be using Laravel 4 until I find something that suits me better - I'm fickle like that :) I have major gripes about Laravel documentation - although loads of people rave about about. Can't understand why. The blade templating documentation on the site is OK though - not brilliant - just adequate.

commented: I love Laravel so far +8
Member Avatar for iamthwee

At first I was dead against frameworks... I figured why not just create your own custom PHP classes, but then I dived into codeigniter and fell in love with the MVC pattern.

When Codeigniter effectively stopped their dev, although some other company has taken over now, I looked to other frameworks like laravel... I looked really hard but honestly couldn't see any benefit to switching, plus I have my editor primed to the brim with custom codeigniter snippets which makes my workflow really smooth.

Have you ever tried writing your own CMS , I have (ignitedcms) and trust me it is a huge huge task, which you don't quite appreciate at the start.

At the moment I'm seriously considering using a codeigniter with wordpress bolt on.

So codeigniter drives all the views and links but the back is handled with wordpress, so you can use all of wordpress's handy functions to render the view and query 'the_loop.'

I'll document my progress shortly as IMO it is pretty useful.

There are other alternatives such as expressionengine which sits on codeigniter but has all the handy features of quickly adding content in a wordpress style manner.

It also gives you the flexibility to write your own view files using a simple template engine. I've still got to get my teeth into template engines and I'm learning towards 'twig.'

But all this is miles away if you've just started to get to grips with PHP.

Master the basics then move on from there.

commented: Big thumbs up for twig - but documentation is rubbish! +15

Check out ProcessWire CMS/CMF (Content Management Framework isn't something you hear often). It's like what most people coming from WP-as-a-CMS development, with Joomla and Drupal as the leading alternatives, dream about. I think I've mentioned it in response to someone else before only because it's so awesome and intuitive, even for non-devs, which there seem to be plenty of on this forum as well, looking to get results fast. Well, PW is a great solution. The learning curve is cake, from what I've found, and I'm not very experienced at all myself in programming or server-side development, just dabbled some. The community is also incredibly responsive, helpful and encouraging. Of course, the platform you choose to build on depends heavily on what you intend to build; but I'd give PW a look-see for either this or future projects.

commented: Excellent link. Thank you. PW looks really nice. Will investigate when I get time +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.