Jump to content


Photo

Comparison of PW and CodeIgniter

codeigniter

  • Please log in to reply
30 replies to this topic

#1 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 804 posts
  • 211

  • LocationMidlands, UK

Posted 18 May 2012 - 07:29 AM

Am very happy that I have found PW for building my general client websites. It really suits the way I work perfectly.

I have started learning Codeigniter recently also with a view to creating my first web 'application' (if I have grasped the correct meaning...)
The idea being that it will take the form of a community website with users and that content will be created on the fly rather than through a "back-end".

Now I am pretty sure that PW can manage something on these lines, I was just looking for some good, experienced, honest input from the great community here on the differences between building this with PW or CI.

Differences that I can see from the start -

PW provides an admin side
CI provides several helper classes for things like email and forms

#2 ryan

ryan

    Hero Member

  • Administrators
  • 5,780 posts
  • 3124

  • LocationAtlanta, GA

Posted 18 May 2012 - 11:00 AM

I haven't used CI enough to comment, but know that others here have and hopefully they will give a better response. I generally like building apps in PW and haven't felt the need to look further for the type of apps I build. But I wanted to mention that some others are apparently using PW and CI together as well. If it's the helper classes that interest you, you might also want to take a look at one that Netcarver introduced us to: Flourish. Seems like it's built around the idea of helper classes rather than a strict framework. I'm pretty impressed with what I see there, and it also seems to play well with PW.

#3 netcarver

netcarver

    Sr. Member

  • Members
  • PipPipPipPip
  • 428 posts
  • 341

  • LocationUK

Posted 18 May 2012 - 11:21 AM

Ryan, actually, I think Pete was the first person in here to mention using Flourish with PW, but I didn't know that when I started posting about it.
Steve ☧

#4 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 804 posts
  • 211

  • LocationMidlands, UK

Posted 18 May 2012 - 01:52 PM

Thanks for your replies.

Perhaps I should ask more for your views on PW vs PHP Frameworks in general?

When would you stop using PW and say "a framework makes sense here?"

Also do you see having an MVC approach as better for applications?

Thanks again for your views.

#5 Pete

Pete

    Administrator

  • Administrators
  • 1,756 posts
  • 658

  • LocationChester, England

Posted 18 May 2012 - 04:06 PM

Ryan, actually, I think Pete was the first person in here to mention using Flourish with PW, but I didn't know that when I started posting about it.


Cheers - I'd be nowhere without your wrapper though ;)

To be honest I can't envisage many scenarios where I wouldn't use PW, unless it was for something very specific like forum software (and even then apeisa has made a forums module).

I personally never got into MVC as I found it too rigid for my liking, though that does potentially lend itself to a cleaner workflow when you're part of a team (it still depends on how well documented and presented each team members' code is though ;)). I suppose I don't mind mixing my code up a bit as it's only generally going to be me working on a site and I know my way around PHP, HTML and JavaScript so it doesn't bother me that they sometimes get mingled in a bit.

I would say that the answer to your question depends greatly upon what sort of application you are looking to build. Can you give us any examples?

Using some real world apps as examples:
  • If I was building something like Freshbooks I'd use custom tables for the invoice data, but I'd be tempted to use PW for user accounts, and store additional user data with that account data. The bulk emails could easily be handled by Flourish.
  • If I were doing something more specific like creating a project management system like ActiveCollab I reckon I could do it in PW despite the complexities of what you can do in AC, but why reinvent the wheel?
  • If I was building a portal for estate agents like RightMove (and the thought has crossed my mind) then that would be ideal for PW (and a bit of Flourish) and I'd just need to create a front-end interface for the estate agents to log into and manage their own property's which, again, is relatively easy with PW. The front-end of the site would then be pretty similar to something like this site ryan created: http://www.villarental.com/


#6 teppo

teppo

    Sr. Member

  • Members
  • PipPipPipPip
  • 388 posts
  • 385

  • LocationFinland

Posted 18 May 2012 - 04:08 PM

@onjegolders, as a rough answer I'd say that ProcessWire provides very good foundation for an app by making content management, access control etc. trivial. Frameworks, on the other hand, offer flexibility and powerful tools if you're building something that doesn't really need / use typical CMS/CMF features and for some reason requires very highly customized access control, URL manipulation / routing, data structures etc.

MVC approach has clear benefits, but don't sweat it too much; separation of concerns is what's important -- when implemented properly, you don't need to make changes to multiple places every time your UI or DB (or business logic for that matter) changes slightly. I'd recommend reading this (old but still good) post about Rails development, which (imho) summarizes benefits of MVC / separation of concerns pretty well: http://weblog.jamisb...oller-fat-model.

For the record, I've never tried Codeigniter myself and don't really know much about it. I've used Zend Framework for various projects -- and will definitely keep using it whenever it's the best tool for getting the job done -- but I've heard it has somewhat steep learning curve compared to some other frameworks. I'd still recommend checking it out though: http://framework.zen...n/learning.html.

#7 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,526 posts
  • 855

  • LocationVihti, Finland

Posted 18 May 2012 - 04:37 PM

If I had to put it shortly:

PW gives you (that are missing from many more traditional frameworks):
  • Admin, users and access management
  • UI for building your data schema (clicking on admin instead of coding)
  • Url mapping to pages (no need to define routes)
Something pretty similar to most (with a twist of course):
  • PW API == GOOD ORM
  • Controllers == template files can be easily used as a controllers
What is missing (what some frameworks have):
  • Crazy amount of helpers (as others have noted, using zend classes or flourish can be good help in that kind of situation)
  • Routing (I hate doing routes... mostly repetition)
  • Custom template languages
  • Strict rules how to construct your code

What pw "requires" that you might not like in your app:
  • Unique database schema: you don't have single "posts" table, instead you end up with field_title, field_body, field_author, field_date etc.. tables
  • MySQL, MyISAM


#8 slkwrm

slkwrm

    Sr. Member

  • Members
  • PipPipPipPip
  • 248 posts
  • 66

Posted 18 May 2012 - 06:17 PM

I heard a lot of good things about Yii Framework. Its learning curve's considered not as steep as of Zend Framework and it's much more compact and lightweight (Zend Framework components can be incorporated if needed). At the same time it's more powerful and feature rich then CI. Not sure if it will play well along with PW as it's full stack framework so its components can't be used separately. Symfony 2 looks like a totally new and fresh approach to frameworks, it's full stack but also based on decoupled components (so they can be easily entegrated into Processwire). I haven't have enough time to fiddle with it and, honestly, I think my expertise is not enough to fully appreciate its possibilities. It resembles me a modular synthesizer: if you don't know where each cord leads, what's the purpose of each slot and what knob tunes which sound parameter, all you get is noise at best or more often just silence :) It's easier to use semi-modular synth or even hard-wired one that suits your needs unless you need something truly unique and exlusive.

#9 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 804 posts
  • 211

  • LocationMidlands, UK

Posted 19 May 2012 - 04:36 AM

Thanks Pete, Apeisa, Teppo and Slkwrm all really helpful answers.
The app in this instance would be a community type.
But I must stress I'm using this as much as a means to learning as anything else.

I think right now my thinking is:

I love PW's API - if I want to display the last 10 comments from all users on the home page, is it really easier to create a function in a model called "get_last_10_entries" then to call it in the controller? Or is it not just simpler to call it in place in the home page template? My thinking is the latter though that could be my inexperience and lack of best practices.

Having said that, as much as I love getting content from the API, forms, emails and validations leave me shuddering.

I guess a mix of the two does sound exciting but is it reasonably easy to implement that with PW? Is it even desirable?

Thanks again!

By the way that VillaRental website of Ryan's is very impressive!

#10 Pete

Pete

    Administrator

  • Administrators
  • 1,756 posts
  • 658

  • LocationChester, England

Posted 19 May 2012 - 05:05 AM

The app in this instance would be a community type.
But I must stress I'm using this as much as a means to learning as anything else.


I'm glad you stressed that as depending on what you were after I might have suggested other ways of doing a community site (the easiest being using something like the community suite - forums, CMS etc - here: http://www.invisionpower.com/ since they're pre-built and function together well. But then you'd be at the other end of the scale from PW in terms of customisability and ease of use if you wanted to do anything outside of what the core package handles).

To learn PW, my aim was to rebuild StrategyCore in PW as I could see how to do everything in my head and it was just a case of working it all out. It really helps to have a project in mind that you've got no set deadline for when you're learning something new, as long as you've got the time to do it. I ended up spending about 3 months' of evenings on that site, but I'll stress that easily half of that was just trying to get the forum software integrated in terms of article comments and user logins, so PW was the easy bit, including importing all the content from the previous system.

The beauty of having done that is that I now have a decent code-base for those projects in my head that are mostly community-based sites with core functionality something along the lines of ryan's sites.

I love PW's API - if I want to display the last 10 comments from all users on the home page, is it really easier to create a function in a model called "get_last_10_entries" then to call it in the controller? Or is it not just simpler to call it in place in the home page template? My thinking is the latter though that could be my inexperience and lack of best practices.


I ended up with quite a lot of code in my head.inc file that's used on various different templates. I just pulled all of that out as it was getting quite messy and stuck it into a global.php file instead in the templates directory. If you have code specific to different templates that you don't want to clutter up the template itself the you could easily create a "controllers" subdirectory and put it in there. Theoretically the easiest way to go about it would be to create that "controllers" subdir and put in a file for each for your templates with the same name, then in head.inc do something like:

include('controllers/' . $page->template . '.php');

And you've successfully split out most of the code from your templates with minimum effort :) That's the thing about PW - you can work pretty much any way you like with it (and I honestly wish I'd thought of the above sooner - oh well, next time!).

I guess a mix of the two does sound exciting but is it reasonably easy to implement that with PW? Is it even desirable?


What I've just suggested above would be desirable on my website because I have so many templates that it would have been better to split it all out a bit and not have so many loops or selectors happening in the template itself. Instead I could have separated much of that out as I honestly scratch my head a few times when looking back through some older templates I'd made. That said, it depends quite a bit on how complex the project is and what your preferred method of working is. For a simple website I wouldn't bother doing the above, but for a site with section-specific, complex structure then it could well be worth it.

If you're working in a team of one, then it's up to you how you go about it and I often find myself falling into the bad habit of mixing and matching ways of working within a single project as I learn new things - fine for my own stuff, but crazy if someone else has to work on a project (fortunately they don't).

By the way that VillaRental website of Ryan's is very impressive!


I think that after watching the video on the PW homepage it was that site, plus tripsite.com (another of ryan's creations for a client) were the things that really drew me in to PW. I've got so many projects in my head along those lines and I just need time to work on them. Some of them might even make some money if I stop working on hobby sites :D

#11 SiNNuT

SiNNuT

    Sr. Member

  • Members
  • PipPipPipPip
  • 367 posts
  • 232

Posted 19 May 2012 - 06:11 AM

I think that it could be beneficial to do a learning project using PW as well as a framework side by side. Write down your feature set (don't make it too complex) for your community app and try do do it in PW and with the framework. Remember that it will take some time to understand your framework of choice before you become productive.

A relatively new framework that i really like and just makes sense is http://laravel.com (excellent intro tutorials at http://daylerees.com/ )

#12 diogo

diogo

    Hero Member

  • Moderators
  • 2,008 posts
  • 1089

  • LocationPorto, Portugal

Posted 19 May 2012 - 08:59 AM

I heard good things of http://fuelphp.com/. I glaced at their docs, and they seem good.
I also heard good things about http://kohanaframework.org/, but their docs and community have the reputation of not being very helpful.

Anyway, I start suspecting that you can do everything with PW :)

#13 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 804 posts
  • 211

  • LocationMidlands, UK

Posted 19 May 2012 - 10:45 AM

Thanks Pete for a very helpful answer - though I see that there is no definitive answer in this case, guess I'd just better find out through trying!

#14 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 804 posts
  • 211

  • LocationMidlands, UK

Posted 19 May 2012 - 10:49 AM

Of the PHP Frameworks, from what I can make out:

CI is the most beginner friendly, the docs are excellent, I just got a bit confused by the way they implement sessions.
Kohana - not being a snob but one look at the home page and I was out of there
Yii - seems like a totally different way of building and not sure I'm up for that right now
Laravel seems incredibly promising and the docs are pretty good, doesn't seem to have an email 'helper' though I think it can be accessed via a bundle
Cake - just checking out now.

#15 diogo

diogo

    Hero Member

  • Moderators
  • 2,008 posts
  • 1089

  • LocationPorto, Portugal

Posted 19 May 2012 - 12:11 PM

Also Lithium looks interesting. You have a lot of work to do ;)

#16 slkwrm

slkwrm

    Sr. Member

  • Members
  • PipPipPipPip
  • 248 posts
  • 66

Posted 19 May 2012 - 11:35 PM

Considering that Processwire is a framework itself, in my humble opinion the most beneficial way would be to use PW with decoupled framework that can be used as a component library as well, so one could pick and choose useful components without the need to load the whole framework. So my choice would probably be somewhere among Symfony2, Zend and Flourish (though nobody prevents from using all of them). The problem is that when different components get involved, the coding style becomes less unified and readable. What do you, guys, think? Would be really cool to get a couple of tips here.

Edit: onjegolders, also look at this article.

#17 ryan

ryan

    Hero Member

  • Administrators
  • 5,780 posts
  • 3124

  • LocationAtlanta, GA

Posted 20 May 2012 - 01:24 PM

Considering that Processwire is a framework itself, in my humble opinion the most beneficial way would be to use PW with decoupled framework that can be used as a component library as well, so one could pick and choose useful components without the need to load the whole framework.


What are the components that people find useful in these frameworks? I know email and forms were mentioned previously. E-mail is something PHP does quite easily and well just with it's mail() function (though I understand some like to use alternate sending systems). When it comes to form systems, I don't feel like I've ever come across one that didn't leave me feeling like I wished I'd just built the form from scratch... though I'm working on something in that regard. But beyond email or forms, what are the components that people use in these frameworks? The only other component I commonly include in my ProcessWire installations is the Snoopy() class, for doing http requests. Beyond that, I've rarely come across a need to have other PHP components in my applications. Still, if there are some really common needs, perhaps we should look at expanding PW's performance as a framework and including more helpers/components for common needs. I'm just not sure what the needs are yet. :)

#18 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,526 posts
  • 855

  • LocationVihti, Finland

Posted 20 May 2012 - 02:01 PM

Well.. I think one thing why people lean on frameworks (at least I do) is that when framework is strict and well documented - it is nice to code knowing "I am doing this in a way it is intended". Things like "Because I use this DB class from this framework, it does take care of this and that security issue". So when you are not that seasoned developer, it is nice to have something to guide you. I think pretty similar use case is when company uses one framework to get coding standards from framework. Since PW is pretty open and non-strict (and should be), I guess many people are looking for "best standards". Partly this is probably because we are used to "this is how you should do thing X when using framework Y" - and PW answer usually is: "Well, since we are using PHP here, you can do that in many ways."

But to answer more directly to your question Ryan: what I have used and found beneficial over the time on frameworks I have used: forms, input validation, file uploads, pagination, cache, authentication... I think pw already has pretty good balance on this and I haven't had need to use any other frameworks or helpers when using pw, so probably best answers comes from people who have used flourish and pw for example. But maybe validation class is something I would like to see in PW.

#19 jbroussia

jbroussia

    Full Member

  • Members
  • PipPipPip
  • 70 posts
  • 11

  • LocationFrance

Posted 21 May 2012 - 02:35 AM

Hmm, so I think we need some example or tutorial on building a simple app with PW ! :-[

#20 teppo

teppo

    Sr. Member

  • Members
  • PipPipPipPip
  • 388 posts
  • 385

  • LocationFinland

Posted 21 May 2012 - 02:58 AM

What are the components that people find useful in these frameworks?


Individual framework components I've used in other projects include forms, database tools, i18n and l10n, authentication / authorization / session management and filters. These are all things that PW handles itself, so I don't really see much need for them anymore.

Things that I do still find useful, coming from Zend Framework, are it's web and web services components, such as Zend_Feed, Zend_Gdata (Google API tools) and HTTP, REST and XML-RPC clients. Also I could see some use for it's server tools, though I do admit that I've never had to use them before :)

Things like "Because I use this DB class from this framework, it does take care of this and that security issue". So when you are not that seasoned developer, it is nice to have something to guide you.


@apeisa, that's a very good point, though I'd leave the "when you are not that seasoned developer" part away to keep things simple -- security experts (and common sense) have taught us that we shouldn't reinvent the wheel, even if it's fun. If we do, we're most likely going to make same mistakes that others have made (and fixed) before us. Not to mention that especially on client projects where time and money are limited a framework can lower production costs considerably and still keep quality high.

Naturally all of this mostly applies to serious stuff, client projects etc. Personal projects are very different matter :)





Also tagged with one or more of these keywords: codeigniter

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users