Modern web development - a tutorial series

I have been considering writing up a tutorial series on modern web development.

[ul][li]using vagrant as a simple way to get a “real” server environment in a virtual machine[/li]
[li]setting up vhosts (domains) on the server[/li]
[li]installing and using xdebug - no more print_r/var_dump![/li]
[li]installing and using composer - package manager with auto loading of libraries - no more include/require![/li]
[li]using Doctrine2 ORM to work with a database - auto generate/edit tables[/li]
[li]building a simple api that output json[/li]
[li]Angular JS - front end![/li]
[li]SASS - stylesheets (css) with functions, variables, loops, nesting, etc[/li]
[li]Gulp - build tool that automates tasks (concat files, minify, etc)[/li]
[li]Tying together frontend and backend[/li][/ul]

Anything of this that sound interesting?

It all sounds good to me, but I think those subjects are too advanced for most users of this forum. On another note, the old tutorials on this forum need to be replaced with something current.

Sure, they are not directly “beginning php” style tutorials, but we need tutorials for “step 2” as well, after you’ve learned about variables, functions and other basics.

Using vagrant is actually easier/better than xampp/wampp/whatever.
Using xdebug could make it much more clear where your errors are as you can step through the entire application line by line.
Composer, makes it easier as you can just include whatever library you want and it’s auto loaded and available.
Doctrine should probably not be used if you don’t know the sql under it, but after setting it up (which you do only once) then it’s very easy to use, it even auto generates the db schema for you.
Angular, just an intro, doesn’t have to be that advanced :slight_smile:
SASS - not advanced
Gulp - not advanced
Tying together frontend and backend - not advanced :slight_smile:

I actually like using var_dump myself, but anything that helps people learn debugging skills is a good thing!

I wrote a little function many moons ago that I still use to this day.
It defaults to using print_r if passed in a single value - or an optional arg (true|false) and you can get a backtrace also.

Now, here’s the juicy bit, pass in an array and i can switch between var_dump|print_r. Show a backtrace (or not), add a label (handy for loops!) and pass in the last param as true and i can halt the script using exit.

Probably not the greatest debugging script ever written however it serves a purpose.
Feel free to use it as you wish - or not as the case may be :stuck_out_tongue:

Red :wink:

[php]
/*

  • my debugging function, accepts a single value or array.

  • If $debug is a single value, will print_r the thing and

  • a backtrace. If $debug is an array, the structure is:

  • $debug[0] = thing to debug.

  • $debug[1] = name of thing to debug.

  • $debug[2] = if true use var_dump() instead of print_r

  • $debug[3] = if true will print_r a backtrace.

  • $debug[4] = if true will halt the script. (exit())

  • Example:

  • debugging(array( , , <vardump|print_r>, , ));

  • debugging(array($object, ‘Object Structure’, true|false, true|false, true|false));
    */
    function debugging($debug, $backtrace=false) {

    echo ‘
    ------------------------------------------------------------’;
    echo ‘

    ’;
    if(is_array($debug)) {
    isset($debug[1]) && $debug[1] !== false
    ? print 'Debugging: ’ . $debug[1] . ‘

    : NULL;
    isset($debug[2]) && $debug[2] !== false
    ? var_dump($debug[0])
    : print_r($debug[0]);
    isset($debug[3]) && $debug[3] !== false
    ? print_r(debug_backtrace())
    : NULL;
    isset($debug[4]) && $debug[4] !== false
    ? exit()
    : NULL;
    }
    else {
    print_r($debug);
    if($backtrace !== false) {
    print ‘
    ’;
    print_r(debug_backtrace()
    );
    }
    echo ‘
    ’;
    echo ‘------------------------------------------------------------’;
    }
    [/php]

Very easy to understand Very useful

Sponsor our Newsletter | Privacy Policy | Terms of Service