{
    "href": "/post/2006/09/26/solar-0240-released/",
    "relId": "2006/09/26/solar-0240-released",
    "title": "Solar 0.24.0 Released",
    "author": "pmjones",
    "markup": "html",
    "tags": [
        {
            "href": "/tag/php/",
            "relId": "php",
            "title": "PHP",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/solar/",
            "relId": "solar",
            "title": "Solar",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2006-09-26 15:02:43 UTC",
    "updated": [
        "2006-09-26 15:02:43 UTC"
    ],
    "html": "<p>Last night, I released version 0.24.0 of <a href=\"http://solarphp.com\">Solar</a>, the simple object library and application repository.  Solar is a PHP 5 framework for rapid application development.</p>\n<p>On an administrative note, <a href=\"http://killersoft.com/randomstrings/\">Clay Loveless</a> has set up a Trac installation for us, so now you can <a href=\"http://solarphp.com/trac\">report bugs and request enhancements</a> without having to join the <a href=\"http://mail.killersoft.com/mailman/listinfo/solar-talk\">Solar-Talk</a> mailing list.  You can keep up with the Trac issues via the <a href=\"http://mail.killersoft.com/mailman/listinfo/solar-trac\">Solar-Trac</a> mailing list if you like.</p>\n<p>You can read the <a href=\"http://solarphp.com/channel.php?package=Solar&amp;release=0.24.0&amp;downloads\">change notes</a> for a full run-down, but there are a few changes in particular that I want to highlight.</p>\n<p><!--more--></p>\n<h2><code>Solar_Request</code></h2>\n<p>In previous releases, the Solar arch-class had a series of methods to read from the superglobals:  Solar::post(), for example, would read a <code>$_POST</code> key and return it (or a default value of your choosing if the key did not exist).  Those methods and their related support methods have been removed from the arch-class and placed in their own class, the new <a href=\"http://solarphp.com/trac/browser/trunk/Solar/Request.php\">Solar_Request</a>.</p>\n<p>For now, <code>Solar_Request</code> acts as a singleton, since it is tied back to the super globals.  Future releases will convert it to a true standalone object, and classes that need access to the request environment will receive a dependency injection of a <code>Solar_Request</code> object.</p>\n<p>Whereas you would have used Solar::post() in earlier versions of Solar, you now create a <code>Solar_Request</code> object and use the $request-&gt;post() method.  <code>Solar_Request</code> provides access to these superglobals after some minimal filtering (essentially just stripping magic quotes):</p>\n<ul>\n<li>get() -- <code>$_GET</code>\n</li>\n<li>post() -- <code>$_POST</code>\n</li>\n<li>cookie() -- <code>$_COOKIE</code>\n</li>\n<li>env() -- <code>$_ENV</code>\n</li>\n<li>server() -- <code>$_SERVER</code>\n</li>\n<li>files() -- <code>$_FILES</code>\n</li>\n<li>http() -- ...</li>\n</ul>\n<p>Wait a minute, there's no \"HTTP\" superglobal!  One of the things that <code>Solar_Request</code> does for you is some basic cleaning and normalizing of the <code>$_SERVER['HTTP_*']</code> values into their own storage array, so you can ask for the HTTP headers directly.  For example, to get the value of the \"X-Requested-With\" header, ask for $request-&gt;http(\u2018X-Requested-With').</p>\n<p><code>Solar_Request</code> also lets you check how the current request was made:</p>\n<ul>\n<li>isGet() is true if this was a GET request</li>\n<li>isPost()  is true if this was a POST request</li>\n<li>isPut() is true if this was a PUT request</li>\n<li>isDelete() is true if this was a DELETE request</li>\n<li>isXml() is true if this was an XMLHTTP request (Ajax!)</li>\n</ul>\n<p>Many thanks to Clay Loveless for getting <code>Solar_Request</code> up and running.</p>\n<h2><code>Solar_Session</code></h2>\n<p>Similar to <code>Solar_Request</code>, <code>Solar_Session</code> (<a href=\"http://solarphp.com/trac/browser/trunk/Solar/Session.php\">here</a>) provides an interface to the <code>$_SESSION</code> superglobal.  It also takes over for the previous Solar_Flash class by providing read-once \"flash\" support via the <code>$_SESSION</code> values.</p>\n<p>In Solar, we aggressively segment the global name space so that different classes don't step on each other's toes.  <code>Solar_Session</code> makes this segmentation easier, by providing a config key to tell the particular instance what class name space it should be working within the <code>$_SESSION</code> array.</p>\n<h2>Progressive Ajax Enhancement</h2>\n<p>It's not much, but I've added the tiniest bit of Scriptaculous enhancement to the reference application that comes with Solar, <code>Solar_App_Bookmarks</code>.  In the <a href=\"http://solarphp.com/trac/browser/trunk/Solar/App/Bookmarks/View/edit.php\">\"edit\" view</a>, instead of using a simple class to indicate success or failure of a save, I've put in a pair of effect calls:</p>\n<pre><code>// output a form from the \"formdata\" processor\necho $this-&gt;form(array('id' =&gt; 'form-bookmark'))\n      -&gt;auto($this-&gt;formdata)\n      // ...\n      -&gt;fetch();\n\n// add an effect for success message lists\n$this-&gt;jsScriptaculous()-&gt;effect-&gt;highlight(\n    \"#form-bookmark ul.success\",\n    array(\n        'duration' =&gt; 3,\n        'endcolor' =&gt; '#aaaaff',\n        'restorecolor' =&gt; true,\n    )\n);\n\n// add an effect for failure message lists\n$this-&gt;jsScriptaculous()-&gt;effect-&gt;highlight(\n    \"#form-bookmark ul.failure\",\n    array(\n        'duration' =&gt; 3,\n        'endcolor' =&gt; '#ffaaaa',\n        'restorecolor' =&gt; true,\n    )\n);\n</code></pre>\n<p>That's all it takes.  Again, Clay Loveless has done wonderful work with his JavaScript helpers for Solar.</p>\n"
}
