Solar 0.0.5 Released

Solar is a simple object library and application repository for PHP5. Solar stresses comprehensibility and simplicity; reusable code should be easy to understand, and that’s what I strive for in Solar. It is written with worldwide application distribution in mind, so things like localization are built in from the start.

This release includes a new and very important component: the “Solar_App” class. It takes some superficial hints from Ruby on Rails (but is definitely not comparable to RoR in any meaningful sense). Essentially, Solar_App is an application controller class; when you extend it (e.g. to Solar_App_Bugs, the proof-of-concept bug tracker for Solar) it looks for subdirectories called “controllers”, “models”, “views”, and “helpers”. (So it looks like I have started to adopt “real” MVC methodology after years of shunning it.)

It’s easy enough to define new controller actions: you put your controller scripts in “controllers”, and for each script you can call an action. For example, if you have “edit.php” in controllers/, Solar_App will call it if the “action” URL variable is “edit” (“http://example.com/index.php?action=edit”). There’s a little more to it than that, of course, but the source code is thoroughly commented and should provide a good full-up example for now (it is a proof-of-concept, after all).

One nice thing about distributing apps this way is that they never have to leave the Solar directory itself; you can just create a simple PHP file (5-6 lines) to start Solar, get the application object, and call its output() method; the entire application sits outside the web root. Pretty nifty; you can see an example in the Solar_App_Bugs package (included in the full Solar package).

The full change notes are:

* This is a public development release, and is not yet stable.

* Added Solar_Super class for retrieving superglobals, modified Solar.php to use it

* Added Solar::cookie() method for retrieving cookie values.

* Added Solar::session() method for retrieving session data.

* Added new Solar_App application controller class (with standard directory structure using an MVC architecture inspired by Ruby-on-Rails)

* Solar_User_Auth ‘action*’ keys and values renamed to ‘op*’ (Solar_App now owns the ‘action’ keyword)

* Added validation for ‘new’ and ‘edit’ forms in Solar_Cell_Bugs

* Added Solar_App_Bugs proof-of-concept application based on Solar_App

You can download this release, read the API docs, or join the mailing list — just visit http://solarphp.com.

Are you stuck with a legacy PHP application? You should buy my book because it gives you a step-by-step guide to improving your codebase, all while keeping it running the whole time.

4 thoughts on “Solar 0.0.5 Released

  1. It is nice to see Solar has a built-in support to real MVC design. I wonder whether the development of Solar could eventually make it an better alternative to the mojavi framework.

  2. Hi, Darren — sorry, yes, it’s PHP5 only. It’s designed for E_STRICT compliance, and makes use of some PHP5-specific features (such as __call() and __construct() magic).

    If the problem is with hosting, you can get a free account at http://dotgeek.org and try PHP5 there; they’re quite friendly.

    Hope this helps. 🙂

  3. Hi, pcdinh — I don’t know too much about Mojavi, so I can’t say for sure. I do know that this is my first attempt at “real” MVC architecture, and as such this first implementation may not be the best out there. Lucky for me, Solar is still in “dev” state, so things may change. Your input is welcome! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *