Page 1 of 1

Introducing WWW, a new API-focused micro-framework for PHP

Posted: Fri Feb 10, 2012 2:41 am
by kristovaher
I've never felt comfortable working with various huge frameworks out there. I gave Zend a shot for about six months and since then have been mostly using Kohana. But personally I still find myself preferring the approach of 'micro-frameworks' (article here) that do a specific task and for everything else leave the things in developer hands. This means no bloated libraries and no heavy footprint.

As such I've been developing, writing and rewriting and refactoring a small framework that I've mystically named 'WWW Framework' for the better part of last six months.

It is open source (LGPL) and available at SourceForge: WWW Framework.

WWW is a PHP micro-framework that is built loosely on model-view-control architecture and factory method design pattern. It is made for web services, websites and info-systems and is built around a native API architecture, caching and smart resource management. WWW is a compact framework that does not include libraries and bloated features and is developed keeping lightweight speed and optimizations in mind.

WWW comes by default with a view controller and a gateway intended for website functionality with clean URLs and it also incorporates a front-end JavaScript controller.

Documentation about use
A simple tutorial

Mercurial repository is available for developers who are interested in following the development.

It's still quite new and I intend to frequently post more tutorials and updates for the framework. I am sharing it here since some of you just might be interested if you are a likeminded developer and find this exactly to be what you've been looking for :)

Re: Introducing WWW, a new API-focused micro-framework for P

Posted: Fri Feb 10, 2012 9:24 pm
by Christopher
You might want to see if you can get listed here: http://microphp.org/code.html

Re: Introducing WWW, a new API-focused micro-framework for P

Posted: Sat Feb 11, 2012 2:14 am
by kristovaher
Christopher wrote:You might want to see if you can get listed here: http://microphp.org/code.html
Cheers, I had no idea he attempts to list such frameworks there. Considering that it's been inspired by the manifesto somewhat, I did let him know about it for what its worth.

Re: Introducing WWW, a new API-focused micro-framework for P

Posted: Sun Feb 12, 2012 2:54 am
by kristovaher
Those of you who downloaded 1.0.3 version of the framework, it had a bug in the code (and totally my fault!). You should grab 1.0.4 which is the latest now here.

Re: Introducing WWW, a new API-focused micro-framework for P

Posted: Fri Mar 16, 2012 6:49 am
by kristovaher
Just wanted to let you know that the system has been improved quite a bit since the original release.

I am still working on a tutorial about how to build a simple website though. There is a tutorial about how to build a simple web service and other detailed documentation, but I hope to finish the website tutorial soon!

There's not a lot to show 'visually', but I did add some interesting features such as dynamically loading images.

Basically any file in environment controlled by WWW Framework is loaded through an image handler which accepts various 'parameters'. So instead of PHP script type of solutions, the result is far more elegant.

For example, if you have this image on the server:
http://waher.net/w/resources/chesspawns.jpg

You can adjust this image based on filters set to it through its filename:
http://waher.net/w/resources/320x240&cr ... spawns.jpg (Cropped into new resolution)
http://waher.net/w/resources/320x240&fi ... spawns.jpg (Cropped and fitted into new resolution)
http://waher.net/w/resources/720x160&fi ... spawns.jpg (Fitted with background)
http://waher.net/w/resources/720x160&ce ... spawns.jpg (Fitted with background and background color)
http://waher.net/w/resources/@30&720x16 ... spawns.jpg (The same as above, but with 30% quality)
http://waher.net/w/resources/@1&720x160 ... spawns.jpg (Same as above but with worst quality)

It's also possible to use image filters for color adjustments:
http://waher.net/w/resources/480x420&fi ... spawns.jpg (Sepia toned)
http://waher.net/w/resources/480x420&@1 ... spawns.jpg (Bad quality and B&W)

And of course you can change these parameters around as you see fit.

There is only one real file stored in filesystem (/resources/chesspawns.jpg), but every request is cached separately. This can be used to dynamically load avatar pictures and other type of pictures without having to worry about design changes later on and if these design changes 'break' things. Nothing has to be 'regenerated' for that purpose. Server only stores what is needed and is as optimized about it as possible.

List of all newly added features is here:
  • New returned data types with additional processing, like ‘ini’ and ‘rss’ files
  • New configuration option for resource cache durations, dynamic resource loadings and limiters
  • Can now use deflate as an output compression type, together with Gzip
  • New Cleaner developer script for cleaning WWW created caches and temporary system files
  • Better support for clients that send no request headers
  • System now maintains image files as well and this includes support to dynamically resize and crop images per request
  • It is now possible to dynamically unify CSS and Javascript files
  • Simple minification can be used for CSS, Javascript, HTML and XML files
  • JS and CSS file compressions are now cached, increasing performance
  • It is also now possible to use image overrides from resources subfolder
  • Limiter now affects all requests, including static file requests
  • Logger now is categorized and is also used for tracking static file requests
  • New compatibility script for testing server and PHP setup
  • Restructured Index gateway and added request-type handlers for each resource type
  • Minifier class added and functionality implemented in both Resouce handler as well as for API requests
  • File paths and resource loading much improved
  • Limiter and Logger have now a more streamlined internal process
  • Index gateway now also supports IP based blacklists
  • Much better URL Map functionality which allows to set whether unsolved URL’s are allowed or not
  • Default View controller now uses unified resources