Try Tuts+ Premium, Get Cash Back!
CodeIgniter from Scratch: Profiling, Benchmarking & Hooks
videos

CodeIgniter from Scratch: Profiling, Benchmarking & Hooks

Tutorial Details
  • Topic: CodeIgniter
  • Difficulty: Moderate
  • Tut Format: Video
This entry is part 15 of 17 in the CodeIgniter From Scratch Session
« PreviousNext »

In this 15th episode of the series, we are going to learn about three subjects: Profiling, Benchmarking and Hooks. You can use these tools to analyze your CodeIgniter applications performance, and figure out what part of the code you need to optimize. We are also going to make even further improvements to the Profiler library to suit our needs.


Catch Up


Day 15: Profiling, Benchmarking & Hooks

Day 15

Thanks for watching! Any questions/thoughts?

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.twitter.com/mamunabms Abdullah Al Mamun

    Thanks a lot for this post.
    Definitely this is the best series on Nettuts.
    CI RULZZZZ……… :-)

  • http://www.themexpert.com/ Parvez

    This is the best serise i ever seen on nettuts. and i also started learning CI from this series…Thanks for this post ;)

  • http://laroouse.com piyanistll

    very very good working thanks a lot

  • http://www.twitter.com/mamunabms Abdullah Al Mamun

    The next part of this series should cover ORM.

  • http://www.serhat.gen.tr Serhat Çulhalık

    Firstly thank you very much for this gr8 tutorials.
    But i have some requests if possible.
    1. Can you create more important video tutorials ? Because most people won’t use benchmarking tools. It’s not a common thing to use .
    2. Instead of this lets say “non-popular” topics , can you explain for example writing a membership system , writing template system, doctrine on codeigniter(2.0) or other ORMs on codeigniter , backend pro etc.
    They are more useful i think.
    Thank you for tutorials. I will be looking for more tutorials.
    Kolay gelsin hocam.

  • eric

    Thanks for the Red Meat Burak!!!!!!

    I was starting to get skinny on all of the Tofu for the last few days…..

  • http://www.jsxtech.com Jaspal Singh

    Thanks Burak,
    Nice post on CodeIgniter – profiling, benchmarking & Hooks.

  • Kyle

    Great explanation on how to use hooks. Thanks, Burak!

  • David

    Could somebody make a tutorial like this for Zend Framework?

  • http://www.engram.nu Niklas

    Wonderful! Thanks for this!

  • http://www.thedevelopertuts.com Bratu Sebastian

    Cool article, and the series is great, even if I used CI before. It shows you a style of programming.

  • Marcin

    This series is excellent. I sometimes wonder how much it helped CodeIgniter grow in popularity – I am pretty sure that such fantastic resources as provided here may encourage a lot of people to try this particular framework as opposed to the other ones which do not have such well-explained tutorials.

    • w1sh

      I’m studying CI now and starting to fall for it just because of this series.

  • erminio ottone

    GREAT :) thanks!

    you know would be so great? a full lesson about debug triks.

  • Aryan

    WOW! Greatttttttttttttttttttt!

  • Paul du Long

    Can’t find the video in the Plus section, the link under the video links to the 14th episode :(

  • awake

    Baruk,

    According to PHP.NET, Methods with the same name as the last element of a namespaced class name will no longer be treated as constructor. This change doesn’t affect non-namespaced classes.

    Just FYI

  • http://odadia.com Matthew V

    Excellent!

    I’m writing a CI application now and have looked into benchmarking on the documentation site, but could not make any sense of it.

    This video helped me alot.

    Any chance of video on all of CI’s debugging methods?

    Thanks

  • Khalil

    The next part of this series should cover CI Web Page Caching and CI output class. (Cache)
    What do you say guys? Please request…

    • http://www.jsxtech.com Jaspal Singh

      Caching,
      That will be great Khalil.
      waiting for your next ci tutorial.

    • Paul Du Long

      Agree!

  • http://datasplash.co.uk Darren Lunn

    This is extremely valuable. I always prefer to build-test-build-test. That way I can refactor stuff as I go. This helps me do that. Very good article, Burak – thanks.

    When you build-build-build-test – it leaves you a mountain to climb when you finally start testing and something needs reworking, which is horrifically unproductive and a frequent deadline killer.

  • http://vkusnotiiki.net Lubaka

    Very great video, specially for extending Profiler.php
    I still can’t download this video. Why?

  • http://www.niklasdahlquist.se Niklas

    Thank you Burak. Good tutorial!
    In the next tutorial I would like to request a small piece of URI-thinking while using CI. Tips for mixing the URI and the regular querystring. With all segments and stuff. I think it´s annoying to feel dependent of knowing where a specific filter is positioned in the URL (segment position).

  • http://www.copperconferencing.com Tim

    Profiling and benchmarks are hugely important. For anyone who is already building apps or has apps in the wild it is a great tool to help you find bottlenecks in your service.

    And I don’t understand why all of you are asking for ORMs? Use active record in your models and stay away from the overhead.

  • nadeem

    can’t find the video download in the plus section

    • http://www.99points.info/ Zeeshan Rasool

      I am working in CI from last 2 years, I just wanna say that If a beginner read these tutorials once then he can get much knowledge about CI. Codeigniter tutorials on net-tuts focus on useful and effective functions on CI. Keep Rocking CI.

      • http://mimrankhan.com Imran Khan

        even your site too rocking. so many useful information zeeshan rasool. Net-tuts made me to focus on a a best PHP framework easy and lighter.

        Thanks for net-tuts.

      • http://luciano.longo.me Lucho

        I second that, I’ve been working with (and on) CI for about the same time, and I have never looked back since, it’s simple, easily extensible and powerful, it’s like the jQuery of php ;P

  • ibura

    attn: jeff way – what’s wrong with the download? even though i have logged in and tried to download the episode it ain’t working.

  • Brad

    Thanks Burak! As usual very well done!

  • the one

    plz any link to download this tut

  • http://luciano.longo.me Luciano

    Great tutorial! Just can’t live without CI, I love that framework!
    I should point out that there’s no need to literally copy and paste the CI_Profiler::run() function when overriding it if you are not changing the code of the function itself but just adding code after it, since CI_Profiler::run just returns the output. Here’s a simpler way:

    class MY_Profiler extends CI_Profiler
    {
    public function run()
    {
    $output = parent::run();

    // here you can save $output to file and whatnot

    return “”;
    }
    }

    About xdebug, I’ve been using that for several months now and it’s just great, it’s a tool a developer just cannot miss.

    • http://brettic.us Brett Millett

      Excellent tip! Thanks.

  • http://www.radiart.pl Radi

    Great Work! Thx =)

  • http://brettic.us Brett Millett

    Great tut Burak. Your tuts keep getting better and better. This one is a very insightful post. Particularly from the the standpoint of proper use of hooks and extending the core through “MY_” variants. Both of which are easy solutions to allow you to change the basic functionality of the framework without hacking any core code whatsoever.

    Again, good stuff!

  • Diana

    Just wanted to say thanks. You’re doing a great job.

  • http://gravityfx.org/ emcgfx
    • nadeem

      thanks for the help

  • http://bibekpokharel.com.np Bibek Pokharel

    Thanks a lot for this post…I’ve always been hesitant to start CI though have always thought of doing so. This share have made it so easy for me to do it now.

  • http://macodev.com Marco Cervellin

    Thanks a lot for this amazing tutorials!!
    I’ve been learning CodeIgniter and love it!!

    A question: public access to the system folder from the browser doesn’t cause a little security risk? Aside from the fact that each file is protected from direct reading, I wonder if it would be better to deny any access to the system folder (with .htaccess for example).

  • http://www.metknow.com chhivsob

    Great article, i like your post, want to say thank u for your post

  • http://www.lexperts.nl Lexperts

    I want to download the screencast. But the download link is nog working. I have a premium account!

  • http://gravityfx.org/ emcgfx

    I’ve created new resources page on my blog, where I have included all the CodeIgniter links to videos and source code. So people can easier find it, instead of reading all the comments :-) I’ll be updated when new articles comes out. http://gravityfx.org/resources/ I hope you guys find it useful. Thanks to NetTuts+ of course for all they hard work. I don’t take any credit for the videos/links. I simply link to direct links for people who want to download the videos and watch on other devices instead of just streaming.

  • http://www.flaviozantut.com Flavio Zantut

    nice article!
    I will be very useful
    CI use in my projects.
    Desenvolvedor web

  • siryu

    Dear Jeffrey Way and Burak, is there any tutorial to integrated WYSIWYG TinyMCE with CodeIgniter??

    Becoz I already following step by step from another tutorial but still I can’t see this Tiny MCE in my view.

    Thx btw for your Awesome tutorial..

  • Kaniadona

    How to make localization using codeigniter
    i would make website contain 2 languages :D

    very nice tutorial Burak, keep writing :)

  • vaff

    What about a implementation of a authentication for production use ? … im thinking about implementing ion_auth or even zend_auth into codeigniter

  • http://goio.net/ TuxLyn

    Day 15 zip file with all the files in this video would be helpful :)

  • Tate

    In CodeIgniter 2.0.2, the logs file is now only in the application folder and I cannot access it by “http://localhost/ci_series/CI_15/logs/profiler.php”.

    Also, all the methods in the Profiler.php file are now protected (except for the constructor and run methods), so how do you get the peak benchmarks?

  • http://khalilyabi.com yabi90

    Hi Burak,
    I used the hook to check login session, and I got a Redirect error 310,
    this is my code :
    ============== hook declaration ================
    $hook['post_controller_constructor'] = array(
    ‘class’ => ‘MySession’,
    ‘function’ => ‘check’,
    ‘filename’ => ‘mysession.php’,
    ‘filepath’ => ‘hooks’
    );

    ============================================
    ============= hook class =====================
    class MySession {
    function check(){
    $CI=& get_instance();
    $CI->load->helper(‘url’);
    session_start();
    (isset($_SESSION['isactive']))? redirect(‘welcome’): redirect(‘login’);
    }
    }
    ===========================================

    Thanks :)

  • http://www.rsbr.net Lázaro

    The video if Offline. :(

  • Jonathan

    To follow up on Luciano’s comment, and to answer Tate’s question:

    (FYI: I’m running CI 2.1.3)

    1. Profiler::run has a protected method “_compile_{$section}”, so just do parent::run();
    2. The logs folder is now under the application folder., so you need APPPATH.

    So do this:

    class MY_Profiler extends CI_Profiler {

    public function run()
    {
    $output = parent::run();
    file_put_contents(APPPATH . “logs/profiler.php”, $output);
    //return $output;
    return ”;
    }
    }