If you were starting today in PHP?

I’m kicking around the idea of developing an introduction to PHP series along the lines of the Ruby  on Rails and Python classes being held over at Kauffman Labs.  This would likely be outside of our normal User Group schedule, so don’t think we still couldn’t touch on any of these in our group sometime.

The point of the series would be get new developers up to speed by writing something useful.  I could see it even being used to show off PHP as the perfect platform for any level of developer to get something out their quickly, but leave them with enough foundation they could build for the long haul as well.

I’d love to hear some of your thoughts on technology choices in PHP for such a series.  I haven’t taught a formal intro PHP class since Smarty was the hot new thing, so I could really use your help.  There are just so many really great options to choose from.  I’d love to hear of first-hand experiences, but any ideas will be appreciated.

Read on if you are interested in helping.

Some of the options that are initially appealing to me:

Laravel 4

Lots of buzz, but I really don’t know that much about using it first hand.  I’m also not a HUGE fan of all those static methods, but can probably warm up to it.  Still may have too high a learning curve for an intro class.

FuelPHP

Fuel won my heart a year or so ago.  Good CLI support, namespaces, seems full stack enough, without being TOO big.  Doesn’t try to be as hip as Laravel, but seems to address many of the same issues.

Silex + Twig

I’ve done some experiments in this stack.  Felt quick and amazing, but I didn’t get very deep with it.  If this leads me to use Doctrine as a DB back end, would that be too much?

Slim

Seems to share a lot with Silex…but just Silex and a DI container.  Could be enough, but I’d love to hear from someone who has used it it it can deliver the goods.

Anything combination of things from the MicroPHP Manifesto

http://microphp.org/#!/code
Part of me really thinks the lighter the better–as it would play to most of PHP’s strengths. Whatever I do, composer will be a must.

I’d love to hear your thoughts in the comments.

  • jclermont

    I’d recommend something like:

    * Vagrant (reproducible dev environments that match production)

    * highlight some of the core components of PHP itself (I’m surprised how many devs don’t know about or use things like SPL)

    * Composer (high level of how it works and why you’d use it)

    * some micro framework (tangible demo of composer, use basic request/response stack of microframework then start bolting on third party components: templating, database layer, caching, auth)

    * finish with a modern full stack framework (maybe Symfony2 or Laravel) and compare/contrast with the experience of a micro framework

    • Dan H.

      oooh! I like that. I wasn’t considering saving time at the end to show off a full stack framework. That would help with demonstrating where they _could_ go from there. Thanks!

      • jclermont

        In a few weeks, I’m giving a talk on this very topic at thatConference: http://www.thatconference.com/sessions/session_707

        I’ll post my slides after the event. Even though I can’t go into as much detail as I outlined above in an hour, it may be useful to you nonetheless.

    • pthurmond

      I like this list. But I would add to it, before using a micro framework, to build a basic index.php file with some routing and CRUD features. Make it object oriented. Show them how OOP can be done in PHP 5.3+. Maybe even introduce them to closures. That way they can see how to do these things themselves and then they will have a better understanding of how these frameworks work.

  • Phillip Jackson

    As someone who has played around with development as a hobby for the last 4 yrs, I would say that the biggest mistake I made when I was introduced to PHP 2.5 years ago was not sticking with basic procedural PHP techniques before jumping into frameworks. Have a firmer foundation of the basic principles would have made learning a framework like Laravel so much easier.

    So I guess what I am proposing is that you not jump into the frameworks or things such as development environments too fast. If I had it to do all over again, I would first learn how to use PHP to create a dynamic site or app. Next, how to bootstrap a dynamic site. Next, use a micro framework to help remake that same app or site, while introducing Composer to the workflow. Then take it either to a small framework Fuel/Codeigniter or Lithium and finally something larger like Laravel.

    Again, I am not a pro and there is probably a better path that could be laid out then the one I have suggested above. But, the way I see it – the above plan (using that word loosely) would not only lay out for a better understanding of coding fundamentals along with workflow fundamentals as well.

  • Mark Baker

    In addition to jclermont’s excellent suggestions (particularly vagrant, SPL and Composer), I’d also be inclined to cover unit testing (PHPUnit); and the basic static analysis stack (PHPMD, PDepend, PHPCS, phpcpd, etc) and how to understand the results; plus namespacing and autoloading; decent secure login; and making sure that MySQLi/PDO prepared statements were covered rather than MySQL

  • Kyle Reeves

    Don’t get too turned off by the static methods in Laravel. They’re all Facades that create instances of the class. They’re also written in a way that makes them much simpler to test. Jeffrey Way’s book on Laravel testing covers this more in-depth. https://leanpub.com/laravel-testing-decoded . I haven’t dove fully into L4 just yet but I’ve been working in 3 for awhile now. I came from CodeIgniter.

    Overall, I have to agree with Mark’s statements (although I’m not familiar with his analysis stack he listed). I believe we could follow some of the remarks from http://www.phptherightway.com .

    I think it may also be worth it to look into Codeception (unit, functional, and integration tests)? Has anyone toyed around with that yet? It looks like a very impressive all around test suite with good docs. http://codeception.com/quickstart Perhaps this might be something worthy of investigating before the next meet-up?

  • James Byars

    I really enjoy the simplicity of CodeIgniter and found it to be really easy to stand up. They have great documentation as well.