<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>0xDECAFBAD - Tag: cakephp</title>
    <link href="http://decafbad.com/blog/atom.xml" rel="self"/>
    <link href="http://decafbad.com/blog"/>
    <updated>2011-11-16T16:29:50+00:00</updated>
    <id></id>
    <author>
        <name></name>
        <email>l.m.orchard@pobox.com</email>
    </author>
    

    <entry>
        <title>A Curmudgeon Playing with the CodeIgniter Framework and OpenID</title>
        <link href="http://decafbad.com/blog/2007/07/23/a-curmudgeon-playing-with-the-codeigniter-framework-and-openid"/>
        <updated>2007-07-23T14:37:33+00:00</updated>
        <id>http://decafbad.com/blog/2007/07/23/a-curmudgeon-playing-with-the-codeigniter-framework-and-openid</id>
        <content type="html">&lt;p&gt;One bit of hackery I did this weekend was to explore the &lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter PHP framework&lt;/a&gt;, which is even less magic yet more glued-together out of the box than the &lt;a href=&quot;http://framework.zend.com/&quot;&gt;Zend Framework&lt;/a&gt;.  Also, very much less magic than &lt;a href=&quot;http://cakephp.org/&quot;&gt;CakePHP&lt;/a&gt; and barely in the same universe as &lt;a href=&quot;http://www.symfony-project.com/&quot;&gt;Symfony&lt;/a&gt;.  I think I may have found my sweet spot of simplicity and comprehensible magic.&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter&lt;/a&gt; has is a PHP 4 / 5 framework that provides a lightweight Model / View / Controller arrangement with URL routing and a useful but minimal constellation of utility classes and helpers.  The view templates are in PHP, with just a bit of pre-processing.  The controllers are plain-old PHP classes whose methods are called via simple URL routes.&lt;/p&gt;


&lt;p&gt;The &lt;a href=&quot;http://codeigniter.com/user_guide/general/models.html&quot;&gt;model layer of CodeIgniter&lt;/a&gt;, however, is the weakest part of the trio - which I actually like a lot.  It's not a magical ORM - instead it's just a simple superclass from which to derive, mostly there to suggest that a separate model is a good thing to write.  The DB abstraction classes just make the job of writing SQL statements easier and don't pretend that there's no impedance mismatch between objects and relational tables.&lt;/p&gt;


&lt;p&gt;The depth of code in &lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter&lt;/a&gt; is shallow enough that I felt I was able to get into developing quickly while still taking side trips through the framework methods I was calling and get at least a glance at what being taken care of for me.  &lt;a href=&quot;http://codeigniter.com/forums/viewthread/50715/&quot;&gt;There's always danger in magic&lt;/a&gt;, but this stuff doesn't really get out of hand.&lt;/p&gt;


&lt;p&gt;To doodle around with an idea, I threw together a layout decorator class to support the sort of nested templates I'm used to from &lt;a href=&quot;http://www.symfony-project.com/&quot;&gt;Symfony&lt;/a&gt;.  Out of the box, &lt;a href=&quot;http://codeigniter.com/user_guide/general/views.html&quot;&gt;CI views&lt;/a&gt; are simple, offering facilities for calling sub-templates and &quot;partials&quot; but not directly providing conventions for such.  My first swatches of code add a bit of that.&lt;/p&gt;


&lt;p&gt;After playing around with layouts, the next thing I did was to use &lt;a href=&quot;http://codeigniter.com/user_guide/libraries/sessions.html&quot;&gt;CI sessions&lt;/a&gt; and the &lt;a href=&quot;http://www.openidenabled.com/openid/libraries/php&quot;&gt;PHP OpenID Library&lt;/a&gt; to develop both an auth producer and consumer.  &lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter&lt;/a&gt; doesn't come with a ready-made user auth system, though it does come with &lt;a href=&quot;http://codeigniter.com/user_guide/libraries/sessions.html&quot;&gt;its own implementation of sessions&lt;/a&gt; using encrypted browser cookies to replace PHP's native sessions - another feature I really like.&lt;/p&gt;


&lt;p&gt;Kind of odd - but on the same toy app I can sign up for local accounts, sign into other sites with OpenID URLs based on local accounts, and sign into my &lt;a href=&quot;http://codeigniter.com/&quot;&gt;CI&lt;/a&gt; app with external OpenID identities.&lt;/p&gt;


&lt;p&gt;The wild bit is that I can even sign in locally with one OpenID URL, then use the newly created local profile to get a second OpenID URL to sign in somewhere else.  Seems interesting yet possibly dangerous.  I mostly just glued the right parts together and got the Auth_OpenID black-box modules working - now that I have an operational OpenID system, I need to study it further.&lt;/p&gt;


&lt;p&gt;The next thing I want to do is work more on profile managment, offer some of the &lt;a href=&quot;http://openid.net/specs/openid-simple-registration-extension-1_1-01.html&quot;&gt;OpenID Simple Registration&lt;/a&gt; fields, and look into &lt;a href=&quot;http://drnicwilliams.com/2007/07/20/one-app-one-user-account-and-multiple-openids/&quot;&gt;supporting multiple auth IDs linked to the same user profile&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;It might also be fun to do something like &quot;&lt;a href=&quot;http://simonwillison.net/2007/Jul/13/&quot;&gt;catalogue the sites that a user logs into and automatically construct a homepage&lt;/a&gt;.&quot;  Overall, I've got some vague notional ideas to build a personal status collector and maybe some federated social networking and messaging stuff.  But, one hack at a time.&lt;/p&gt;


&lt;p&gt;Hopefully, I'll get this code I've got so far into better shape and commit to my SVN repository.  Sooner than later, otherwise it'll never get off my dev box.&lt;/p&gt;




&lt;div id=&quot;comments&quot; class=&quot;comments archived-comments&quot;&gt;
            &lt;h3&gt;Archived Comments&lt;/h3&gt;
            
        &lt;ul class=&quot;comments&quot;&gt;
            
        &lt;li class=&quot;comment&quot; id=&quot;comment-221087156&quot;&gt;
            &lt;div class=&quot;meta&quot;&gt;
                &lt;div class=&quot;author&quot;&gt;
                    &lt;a class=&quot;avatar image&quot; rel=&quot;nofollow&quot; 
                       href=&quot;http://plasmasturm.org/&quot;&gt;&lt;img src=&quot;http://www.gravatar.com/avatar.php?gravatar_id=e17949267bbfe21a0fadf1bbf00592b4&amp;amp;size=32&amp;amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png&quot;/&gt;&lt;/a&gt;
                    &lt;a class=&quot;avatar name&quot; rel=&quot;nofollow&quot; 
                       href=&quot;http://plasmasturm.org/&quot;&gt;Aristotle Pagaltzis&lt;/a&gt;
                &lt;/div&gt;
                &lt;a href=&quot;#comment-221087156&quot; class=&quot;permalink&quot;&gt;&lt;time datetime=&quot;2007-07-24T01:34:03&quot;&gt;2007-07-24T01:34:03&lt;/time&gt;&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;content&quot;&gt;&lt;p&gt;Hmm, a system that treats its own OpenIDs just like any other OpenID and considers them foreign credentials for which it creates a new account seems… weird. It seems it should recognize its own OpenIDs and map them back to the corresponding username.&lt;/p&gt;&lt;/div&gt;
            
        &lt;/li&gt;
    
        &lt;li class=&quot;comment&quot; id=&quot;comment-221087158&quot;&gt;
            &lt;div class=&quot;meta&quot;&gt;
                &lt;div class=&quot;author&quot;&gt;
                    &lt;a class=&quot;avatar image&quot; rel=&quot;nofollow&quot; 
                       href=&quot;http://www.elroyjetson.org&quot;&gt;&lt;img src=&quot;http://www.gravatar.com/avatar.php?gravatar_id=4a34cf8d239b6589024fc004cfdad5b8&amp;amp;size=32&amp;amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png&quot;/&gt;&lt;/a&gt;
                    &lt;a class=&quot;avatar name&quot; rel=&quot;nofollow&quot; 
                       href=&quot;http://www.elroyjetson.org&quot;&gt;Elroy Jetson&lt;/a&gt;
                &lt;/div&gt;
                &lt;a href=&quot;#comment-221087158&quot; class=&quot;permalink&quot;&gt;&lt;time datetime=&quot;2007-08-24T20:51:24&quot;&gt;2007-08-24T20:51:24&lt;/time&gt;&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;content&quot;&gt;&lt;p&gt;Thanks for pointing this framework out.  Some how it had slipped through my fingers.&lt;/p&gt;

&lt;p&gt;I have tried them all and was (maybe still am) close to dumping php for ruby and the rails framework.&lt;/p&gt;

&lt;p&gt;Once I started digging into rails all the php frameworks just seemed like awkward teenagers that have to do everything their own way just to prove that they are different.&lt;/p&gt;

&lt;p&gt;codeIgniter is small.  Simple to setup and, so far anyway, seems about as elegant as you are going to get using php.&lt;/p&gt;&lt;/div&gt;
            
        &lt;/li&gt;
    
        &lt;li class=&quot;comment&quot; id=&quot;comment-221087159&quot;&gt;
            &lt;div class=&quot;meta&quot;&gt;
                &lt;div class=&quot;author&quot;&gt;
                    &lt;a class=&quot;avatar image&quot; rel=&quot;nofollow&quot; 
                       href=&quot;&quot;&gt;&lt;img src=&quot;http://www.gravatar.com/avatar.php?gravatar_id=7b2554252993cc349aa4671cdc751985&amp;amp;size=32&amp;amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png&quot;/&gt;&lt;/a&gt;
                    &lt;a class=&quot;avatar name&quot; rel=&quot;nofollow&quot; 
                       href=&quot;&quot;&gt;Cody Ray&lt;/a&gt;
                &lt;/div&gt;
                &lt;a href=&quot;#comment-221087159&quot; class=&quot;permalink&quot;&gt;&lt;time datetime=&quot;2008-06-03T21:30:09&quot;&gt;2008-06-03T21:30:09&lt;/time&gt;&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;content&quot;&gt;&lt;p&gt;Did you ever put this into your SVN? I can't seem to find it through Trac.&lt;/p&gt;&lt;/div&gt;
            
        &lt;/li&gt;
    
        &lt;/ul&gt;
    
        &lt;/div&gt;



</content>
    </entry>
    
    
</feed>

