Ralf Eggert wrote
> Hi,
> 
> within ZF1 I created my own library which was located in
> /library/Travello/ parallel to /library/Zend/. In my library I had
> additional filters or validators, general view helpers or extensions for
> some classes like the action controller or the response object.
> 
> ZF2 now has modules. It is quite easy to add all these classes to a
> module. Stuff that I only need in my application can go to to the
> /module/Application/src/ directory.
> 
> But how about stuff that I might want to use in different projects?
> 
> a) Should this go to a module in the /vendor/ directory which has the
>    Module.php located at /vendor/travello/Library/Module.php
> 
> b) Since the ZF2 is no module (Module.php is missing), I could build
>    my extension in the same way that
>    /vendor/zendframework/zendframework/ is set up?
> 
> I think I would prefer a). What do others think about this?
> 
> Regards,
> 
> Ralf

My recommendation is the first option you've pointed out. It''s very
flexible in terms of reusing stuff.
I'm using sub namespaces for my vendor common Modules. I have it structured
like that: vendor/BS/ModuleName1, vendor/BS/ModuleName2, etc.
In my application config I'm loading them in this way:
return array(
    'modules' => array(
        'Test',
        'BS\ModuleName1', // loading module from vendor when no config
override is needed
        'BS\ModuleName2', // loading module from vendor...
        'ModuleName2', // ...from /modules folder to override settings of
the 'BS\ModuleName2'
        'Application',
    ),
    'module_listener_options' => array(
        'config_glob_paths'    => array(
            'config/autoload/{,*.}{global,local}.php',
        ),
        'module_paths' => array(
            './module',
            './vendor',
        ),
    ),
);





-----
Cheers,
--
Luke Mierzwa
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-create-own-library-tp4657032p4657034.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to