Some refactoring

March 4th, 2010

The most recent release of Nephtali includes some basic refactoring of ncore.php.  The new file is now less than 2500 lines, and unzipped, is 84KB.  That is to say, the whole API is smaller in size than this image of Rasmus:

Rasmus Lerdorf, creator of PHP

[Source image found at Sebastian Bergmann's Flickr feed.]

Templates are here

January 13th, 2010

As I was working on integrating the caching capabilities (coming soon), I realized I should have a firm grasp of what any templating system might be.  And, as I “mighted” through a few days, eventually the templating system simply was :)

Check it out, it’s simple, relatively efficient, and you can even nest templates if you’d like.  There’s also a screencast that walks you through the new templating capabilities.

Now, back to getting the caching capabilities integrated.

What’s coming next?

January 8th, 2010

Currently I’m working on integrating a caching mechanism that will automatically integrate your tool of choice (APC, memcache, etc.) at several possible levels of granularity within a page request (whole page, pipe region, persistence.)  I hope to have the caching integrated within the next 2 weeks.

Once I have the caching in place, I would like to develop a simple application using some of the other available PHP frameworks (CakePHP, CodeIgniter, perhaps Yii) to contrast the approaches for the different frameworks.  I hate seeing the comparison of frameworks using stupid “Hello World” examples.

Additionally, I’ll have a new screencast that walks you through some basic DB work with Nephtali in the next few days.

All this to say, things are still improving, and I hope you come back to check on the progress :)

Hooray! CPanel now supports PHP 5.3

December 24th, 2009

I’ve been eagerly following the thread over at cPanel.net that was detailing progress on support for PHP 5.3.  Today I noticed support was here starting with PHP 5.3.1.

CPanel powers many webhosts, and this support means that the new capabilities of PHP 5.3 are now coming to the masses.  I’m hopeful web hosts will beginning offering PHP 5.3 as an option for hosting plans at the start of the new year.

Soon, it will be very easy to find a host that supports Nephtali, a framework that leverages the new functional capabilities of PHP.

Merry Christmas!

Accommodating SVG in (X)HTML 5

December 18th, 2009

(X)HTML 5 is just around the corner, and the improved support for SVG is impressive.  However, HTML 5 has been a moving target for quite some time, and full support for the new features will take some time.

In terms of current SVG support, it appears that browsers that build on Webkit (e.g., Safari, Chrome) will support inline SVG only if you’re using XHTML 5 (no support for HTML 5.) Of note, to get your pages parsed as XML, you’ll have to set the MIME type to “application/xhtml+xml”.

For a typical page request, PHP defaults to MIME type “text/html”, however the language easily allows you to change the MIME type of a response with one little line of code:

header(‘Content-Type:  application/xhtml+xml’);

So, how do you handle this in Nephtali?  Easy.

If you’re developing a site that is primarily XHTML 5, toss a the line of code in nregister.php to make that MIME type the default, as nregister.php runs for every request.  For pages that are of a different MIME type, you can just call the function header() again in the Nephtali file for the page with the appropriate MIME type (a later call to header() overwrites a value set earlier in the script.)

And, as you’ve probably guessed from above, if only one page is XHTML 5, just toss the line of code in the Nephtali file for that specific page.

In either case, there are no framework-specific calls or functions, no vast amounts of code, just use the powerful PHP you’re already familiar with.  Changing the MIME type within a Nephtali application is a snap.

That’s it, let the fun begin with HTML 5 and SVG.

Parallel processing for web requests

December 3rd, 2009

The newest release of Nephtali takes a new approach to parallel processing.

In the earlier releases, Nephtali made it easy for the developer to make any pipe process in parallel, but this came at a great cost to the server.  Running a fast server, this would still lead to better page-load times.  However, if resources were limited, this could quickly spiral into a heavy load that actually hurt performance.

Current releases make the following assumptions about parallel processing:

  • Web service requests stand to gain the most from parallel processing given Nephtali’s use of CURL to achieve it, as breaking off separate requests for direct queries to a DB can actually impede the servers performance under heavy load.
  • Htmlfrag requests using Nephtali’s REST-ful API involve individual pipes that typically use one web service call, so parallel processing isn’t nearly as important (although you could implement the parallel requests on your own if you have a pipe that needs this performance.)

The new capabilities allow you to register requests (e.g., n\curl\request\register($url, $post_data = array(), $connect_timeout = 1, $transaction_timeout = 2)) and then retrieve responses in whatever pipes need them (e.g., n\curl\response\get($url)), making it easy to improve the performance of any pages that makes multiple requests to web services.  All requests are processed in parallel before any pipes during standard requests.

If you use the REST-ful API to retrieve an htmlfrag request for a pipe, the request will happen in real-time (i.e., it won’t already have happened in parallel before any pipes are processed.)

Wiki now in place for documentation

October 15th, 2009

Well, those who know me know I’m not great at keeping up on documentation.  Those days are hopefully over.

The most recent release of Nephtali includes docblocks, which will be used to generate Javadoc-like documentation for the site.  Additionally, the documentation section of the website is now a wiki, so hopefully those who benefit from Nephtali will find it in their hearts to help improve the experience for others.

Adios, objects.

October 15th, 2009

Nephtali has gone through many transitions, and the most recent involves a complete refactoring of the code-base to make use of the new namespace features and functional programming enhancements ushered in by PHP 5.3.  So, those stuck in server environments without PHP >= 5.3 will not be able to install the most recent release of Nephtali.

Why the switch?  Because Nephtali could greatly benefit from the simplicity of a functional approach to the framework’s features.  Simplified code (the core to Nephtali now fits within one file), simplified API, it’s simply beautiful.

Now that the code is refactored, I’ll be working on unit tests for the code-base (no I’m not a TDD guy), creating the new documentation, and reworking Nedit, the online code generator for Nephtali.

The functionally inspired Nephtali is here to stay, sorry OOP.