[TYPO3-mvc] Libraries in Extbase

Jochen Rau jochen.rau at typoplanet.de
Wed Dec 9 09:23:02 CET 2009


Hi.

schrieb Christian Lerrahn (Cerebrum):
> Traditional extensions can be written as libraries. That can be very
> useful if functionality gets re-used in extensions a lot. I suppose, so
> far this will work with Extbase, too. However, I am wondering how a
> library should be designed. It still has a clear model but where does
> the API go? I would argue that the API is the user interaction part and
> therefore the controller. Or does a library have a minimal controller
> and the API is provided as the domain?
>
> Is there any standard for how a DD library is set up? Or maybe a
> consensus on that for Extbase/FLOW3 at least?

The quick answer is: It depends.

Handling tasks inside a software is also a domain (in sense of DDD). If 
your library produces complex output on its own, you may design it with 
the whole MVC stack. If you provide some nice ViewHelpers for Fluid, you 
are done. Just put them into an appropriate subfolder of Classes and 
others can refer to it in their templates by defining a namespace

{namespace foo=Tx_YourExtension_ViewHelper}

If you want to provide some domain-related services but has no output ( 
like an Tx_YourExtension_Service_InvoiceNumberService), just put them 
into the subfolder Domain/Service and others can call them from their 
code. (In TYPO3 4.4 there will be hopefully dependency injection.)

Could you go a little bit in detail what your library is meant for?

Regards
Jochen

-- 
Every nit picked is a bug fixed



More information about the TYPO3-project-typo3v4mvc mailing list