I will introduce the "Fluent Application" the idea is centralize and facilitate access "resources" and their use on sites that use Joomla!, and other applications. First I implement Joomla Application, but the idea is use the same thing for Wordpress, phpbb, Drupal, etc. You can use the same code in any application, just use the same DSL. This is cool for development on Joomla! usign in modules, components. So if developers use this on every extensions what the gain for community? We have service for construct our application(component, module, etc) let me try express better.
For example:
If we contruct a DSL for content, banners, virtuemart, sobi, docman, etc.
We can integrate all this things on same "application"(Component/Module).
Example of DSL:
First we get the Application with we need work on this case Joomla!
//instance the Joomla Application
$joomla = new FluentInterface('Joomla');
//connect to database
$joomla->configureConnection()
->host('localhost')
->username('root')
->password('1234')
->database('joomla_test')
->connect();
//now we can use Domains(Collections of DSLs).
$contentRows = $joomla->domain('content')->lists()->latest()->inOrder()->fromCategory()->withId(3)->getRows();
$docmanRows = $joomla->domain('docman')->lists()->latest()->withHitsMoreThan(10)->getRows();
In my idea I have think on construct a "widget"(like module on Joomla!) so we can get data and display usign this widget interface.
$widget->module('content')->addData('content',$contentRows)->addData('docman',$contentRows)->display();
So we instance Joomla Application, connect with this application and use Domains for get "Data". You can instance many of Joomla!s and this way make them change data with sameDSL. My ideas goes further.. I offer to you to connect in other applications and use the DSL for give Data and you can display on your application or use the Widgets.
Example:
$wordpress = new FluentApplication('Wordpress');
$wordpress->configureConnection()
->host('localhost')
->username('root')
->password('1234')
->database('wp_test')
->connect();
$wpPosts = $wordpress->domain('posts')->lists()->withStartDate('2009-09-29')->withFinishDate(''2009-10-01')->getRows();
//use widgets to display data if want
$widget->module('wp_content')->addData('content',$wpPosts)->display();
So this way we have a service between application and you can share data. But remember we can implement others things like:
If you need send e-mail you dont know how Joomla, Wordpress does we can have a DSL for E-mail like:
//wp use
$wordpress->service('email')->from('juliopfneto@gmail.com')->to('wilco@joomla.org')->subject('test')->body('text body')->send();
//joomla use
$joomla->service('email')->from('juliopfneto@gmail.com')->to('wilco@joomla.org')->subject('test')->body('text body')->send();
I have implement more part of this code. Widgets is not implement today. If you see the map maybe you can have the Idea how is my fluent application.
Now let start the discussion.. tell me what you think, give opinions.