A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Why I hate Code Igniter (and why is ZF FTW!)

Here is a snippet from my code…

public function transaction($company_var='', $company_value='', $parent_var = '', $parent_value='', $current_page='1', $offset_value='')
	{
	    $data = array();
	    //GET VARIABLES PASSED THRU FUNCTION
	    //I hate code igniter for this.
	    //I found out that you can have query strings later on :-(
	    //UPDATE:
	    //But then again, Code Igniter sux at handling queries in the URL
	    //I especially hate that you have to pass "variables" to the Method and not
	    //being to get the variables directly from the URL using $_GET
	    //WTF?!?! I have to enable query strings in the config file?
	    //Did they just DISABLE a feature in PHP?
	    //I never had this problem in ZF! 
	    $data['RTCO']      = $company_value?$company_value:$_GET['RTCO'];  //Code Igniter is bullshit! I had to add this due to CI unable to $_GET properly!
	    $data['RTPA8']     = $parent_value?$parent_value:$_GET['RTPA8'];   //Code Igniter is bullshit! I had to add this due to CI unable to $_GET properly!

While in my other method, i have this…

redirect('?c=customer&m=transaction&RTCO='.$company_value.'&RTPA8='.$parent_value.'&col_manager_selected='.$data['page']['col_manager_selected']);
This entry was posted in General and tagged , . Bookmark the permalink.

25 Responses to Why I hate Code Igniter (and why is ZF FTW!)

  1. I don’t share your point of view. It is said at the beginning that CI doesn’t has GET method by default. A lot of people are using it the wrong way. The GET method shouldn’t be used for destructive or changing state requests. The POST method should be used for that. Anyway I think you are prejudiced about CI.

  2. Wenbert says:

    Hi Todor, i apologize for my ramblings… really, these are just frustrations :)

    im my sample code – i used it for SELECTS in the SQL queries only…

    thanks for sharing your point of view Todor :)

  3. TaeWoo says:

    Damn buddy. No one put a gun to ur head and told u to use CI. Relax man.

    CI is dope. It saves me shitload of time b/c they take care of all that mindless stuff for you. The trade-off? You have to learn their stuff…

    My 2 cents.

  4. Wenbert says:

    ^_^
    It’s cool. I’m relaxed. ;-)
    I’m not regretting that I used Code Igniter though. It is always good to learn something new. Still for the next project, I have my eyes on the Zend Framework instead of CI :-|

  5. Brian says:

    Hehe.. I’m learning CI now, after becoming a symfony refugee. Somehow this sounds ominous…

    I think I can work with CI’s default segmented URI in lieu of query strings though. We’ll see.

  6. Wenbert says:

    Brian, maybe you’d like to check this out: http://kohanaphp.com/
    Kohana is a fork of Code Igniter. Check out video tutorials. You’ll see that Kohana handles “views” better. They have:
    $view->variable_a = “This is a variable”;
    instead of CI’s
    $data['variable_a'] = “This is a variable”;

    The thing with not having $_GET by default is that you’ll never know when you need another variable passed to the function.

  7. Brian says:

    hey wenbert thanks for the heads up. Some plugin developers are moving to Kohana pala so I’m sure it’s worth a look.

  8. Wenbert says:

    hehe! pinoy! no prob, i also want to test out Kohana but i’m going to concentrate with Zend Framework as of the moment. i am currently in-love with it and i want to marry ZF. ;)

  9. Dude McFresh says:

    Arguing over this is dumb. Code igniter sucks, it’s not being maintained, if you like it, move to Kohana, it’s the best MVC framework and is php5 only using it’s magic functions such as __autoload, which benchmarks super fast against all rival class factories. If you like Zend cuz it has libs pre built cool. MVC is better for me, easier to maintain, but if you like a different way, sweet. Use it, nobody cares, and nobody is right. Just like arguing about chocolate vs vanilla, it doesn’t matter.

  10. Rajeev says:

    Hey Buddy,
    CodeIgniter is indeed Cool. If you are worried about _GET issue, try this workaround.
    http://codeigniter.com/forums/viewthread/56389/#277621

  11. Wenbert says:

    Is it just me or is there something wrong with the CodeIgniter forums? I can’t seem to post and properly search items :/

    Rajeev, that is exactly what I do not like about Code Igniter. All the workarounds and stuff that I am not supposed to think about. I never had problems like these with Zend Framework. Also for a very important project, I would not want to use a “workaround”. Just my two cents.

    Also for long term solutions, I doubt the future of Code Igniter. Already, it has a fork: http://kohanaphp.com/

  12. JOKERz says:

    problem with _GET in CI??
    use $this->uri->segment(n) n your done. ;)

  13. Wenbert says:

    Thanks JOKERz. But what I do not get is that it is easier and it makes sense to do a $_GET['x'] than doing $this->uri->segment(n). And I do not have to manually count the ‘n’.

  14. Mike says:

    How about the uri_to_assoc function which makes an array out of all the tokens in the query string?

    To me, it’s much simpler and much more elegant than using the GET array and dealing with “?” and “=” and “&” in the query string.

  15. Tomas Kramar says:

    $data['RTPA8'] = $this->input->get(‘RTPA8′);

    Documentation FTW!

  16. Nilesh says:

    ZF is much better than CI. Irrespective of the URL and Request Method used, you can use the request object’s getParam() method to get the value of the specified parameter either by GET or POST!

    Forget about URL handling in ZF. Just use these functions and design your app!

  17. So make a custom function like
    function ciGet($i_want = ‘uri_value_i_want’) {
    $key_vals = $this->uri->uri_to_assoc();
    return $key_vals[$i_want];
    }

    http://codeigniter.com/user_guide/libraries/uri.html

  18. Matt says:

    I have used both Zend and CI. While I prefer CI, I don’t see a huge difference between the two.

    You can use mixed segments and get by using this method:

    http://www.askaboutphp.com/tutorials/58/codeigniter-mixing-segment-based-url-with-querystrings.html

    Lots of emotion on here. CI doesn’t suck though, that’s for sure. It’s another tool to choose from, and I am grateful to its authors for building a framework that is elegant, easy to customize, well documented, etc. All for free. Sure, it’s not perfect, but that’s the nature of software, or anything built by humans for that matter.

  19. Wenbert says:

    Hi Matt,

    The post was more of a rant than a valid review between the two frameworks :D I also use Code Igniter and ZF. In fact, my current project uses CI.

    Thanks for the link above! ;-)

  20. Darkredz says:

    DooPHP supports $_GET as well as parameterized routes and is too great to be used with ZF. Have a look at it if you have the time :)

  21. Aside from opinion, one thing that absolutely is a problem is when your application needs to interoperate with other web applications or accept requests from legacy applications that use a classic GET and Query String approach. We’re not all building isolated, greenfield applications.

    I’m having issues using CI to work with Twitter OAuth right now since their response during the OAuth dance sends a critical token using a GET and a Query String. It is just plain arrogant on the part of CI’s maintainers to make this simple, conventional and perfectly acceptable technique hard to do and then act as if developers just don’t get it, and need to “drink the Kool-Aid” and “see the light”.

  22. Wenbert says:

    @Thomas Lukasik I agree with you. In my experience a while back, I spent hours debugging what I did wrong instead of concentrating on building the application.

    It must have been hard debugging your app to work with Twitter OAuth — especially that you needed to interact with another application that does not belong to you.

    FYI, ZF has OAuth support. Last time a checked, it was still in the incubator. I’m not sure if it made it to the 1.9.3 release. It’s in the incubator but it worked for me.

  23. Twitter? Just wait till that startup fails. It’s only around because of internet marketers and mlm’ers pushing it. Just what I want? 3000 followers sending me spam comments all day long. RIGHT!!! I could care less if a framework is easy to adapt to Twitter.

  24. Everyone should just make their lives easier and adopt Zend Framework, these backyard frameworks like codeigniter really don’t have a reason for existing anymore.
    Zend framework is endorsed by big companies like IBM, is used by many big brands and we know the Zend Company is behind it which gives us a better guarantee on code quality and programming standards.
    Plus Zend Framework comes with an arsenal of quality tested libraries and unlike the other ones, solid documentation!
    Don’t waste your time learning things like Codeigniter or Cakephp etc. when you know if you apply for a job chances are great they will insist on ZF as a skillset and not other mediocre frameworks.

  25. b_dubb says:

    i tried going the ZF route and just gave up. a framework is supposed to make your life easier. i found ZF to complicate the most rudimentary of things. CI is effortless to set up and painless to learn by comparison. i might go back to ZF when they go to version 2.0 (currently at 1.11.7) but they will have to provide better documentation. the documentation at ZF is just god awful. CI is so simple. and that’s why i will be using CI

Leave a Reply to TaeWoo Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>