Quantcast

ZF2 Modules

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

ZF2 Modules

Steve Rayner-2
I see there is a module called zfc-user, with a sub-module for using
doctrine orm.
I'm new to ZF2 and the concept of modules (i didn't use them in zf1).
ZF2 seems to have quite a complicated folder structure, that looks
well thought out.

I'm using composer, so I've added the required dependencies, done an
update and it looks like everything i need has been downloaded into
the vendor folder (and sub-folders).

Now i'm lost. What's my next step? I thought the concept of modules
was that it would drop a module into my application that i could use,
but it apears not. Is my next step to create my own module that makes
use of the stuff in the vendor folders, or does the module live under
the vendor folder and i have to config my application to use it.

Can anyone get me started? I think once i have integrated my first
module i should get the hang of it.

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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF2 Modules

Jurian Sluiman-3
2012/6/15 Steve Rayner <[hidden email]>

> Now i'm lost. What's my next step? I thought the concept of modules
> was that it would drop a module into my application that i could use,
>
but it apears not. Is my next step to create my own module that makes
> use of the stuff in the vendor folders, or does the module live under
> the vendor folder and i have to config my application to use it.
>

It is, but completely depending on the module you have downloaded. A module
can contain configuration files and/or source code and/or view scripts
and/or even more. If you downloaded a module with just some view helpers
(as an example) you obviously need to use them before you can see their
effect. On the other hand, ZfcUser is a module that provides an MVC
structure, with a controller, models and view scripts.

For ZfcUser, there are some routes defined, so under "/user" you see either
your profile page or a login form. However, before you get it working you
need to configure the module (for example: what is the database
connection?). The post-installation configuration is documented on the
README: https://github.com/ZF-Commons/ZfcUser#installation

Currently only the Zend\Db configuration is documented, but is should you
get started.


> Can anyone get me started? I think once i have integrated my first
> module i should get the hang of it.


Because modules can contain anything, there is no single way in using them.
Usually a README or INSTALL file explains how you can use the module in
your application. Your first step to use composer to download all
dependencies is at least correct :)
--
Jurian Sluiman
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF2 Modules

weierophinney
Administrator
In reply to this post by Steve Rayner-2
-- Steve Rayner <[hidden email]> wrote
(on Friday, 15 June 2012, 07:53 AM +0100):

> I see there is a module called zfc-user, with a sub-module for using
> doctrine orm.
> I'm new to ZF2 and the concept of modules (i didn't use them in zf1).
> ZF2 seems to have quite a complicated folder structure, that looks
> well thought out.
>
> I'm using composer, so I've added the required dependencies, done an
> update and it looks like everything i need has been downloaded into
> the vendor folder (and sub-folders).
>
> Now i'm lost. What's my next step?

Enable the module in config/application.config.php:
   
    'modules' => array(
        'Application',
        'ZfcUser',
        /* ... etc. ... */
    ),

We've added a step of explicitly enabling modules here. The reason for
this is because it allows you to have a central "repository" of modules
that you can selectively choose from. A good example is, for instance,
if you're a client shop and host for your clients; instead of having
module installations per client project, you could have a single
location, and selectively enable the modules you need for a given
project.

Additionally, it allows you to toggle modules on and off when desired;
I've done this in the past to determine what modules may or may not have
been causing issues for the site I was working on.

> I thought the concept of modules was that it would drop a module into
> my application that i could use, but it apears not. Is my next step to
> create my own module that makes use of the stuff in the vendor
> folders, or does the module live under the vendor folder and i have to
> config my application to use it.

Typically, once you've enabled the module, you will likely need to do
some configuration -- it really depends on the module. For instance, my
PhlyContact module will basically work "out-of-the-box" -- but it
assumes Sendmail as the mail transport, and the "Dumb" captcha adapter
-- neither of which is likely what you want. Thus, you configure the
module to suit your site's needs. Similarly with ZfcUser, you need to
configure a database connection at minimum, and potentially some other
options -- all of which are documented in its README.md file.

So, while modules are mostly "plug and play", they will often benefit
from configuration.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF2 Modules

Steve Rayner-2
Thanks Matthew, it's starting to make sense.

I'm getting this error;

Unable to locate class associated with "zfcuserauthentication"

I see this was an issue around three months ago, but any discussions i
find seem to indicate it was fixed so i assume my problem is something
i have done wrong.

should i post any of my code here?

On Fri, Jun 15, 2012 at 2:59 PM, Matthew Weier O'Phinney
<[hidden email]> wrote:

> -- Steve Rayner <[hidden email]> wrote
> (on Friday, 15 June 2012, 07:53 AM +0100):
>> I see there is a module called zfc-user, with a sub-module for using
>> doctrine orm.
>> I'm new to ZF2 and the concept of modules (i didn't use them in zf1).
>> ZF2 seems to have quite a complicated folder structure, that looks
>> well thought out.
>>
>> I'm using composer, so I've added the required dependencies, done an
>> update and it looks like everything i need has been downloaded into
>> the vendor folder (and sub-folders).
>>
>> Now i'm lost. What's my next step?
>
> Enable the module in config/application.config.php:
>
>    'modules' => array(
>        'Application',
>        'ZfcUser',
>        /* ... etc. ... */
>    ),
>
> We've added a step of explicitly enabling modules here. The reason for
> this is because it allows you to have a central "repository" of modules
> that you can selectively choose from. A good example is, for instance,
> if you're a client shop and host for your clients; instead of having
> module installations per client project, you could have a single
> location, and selectively enable the modules you need for a given
> project.
>
> Additionally, it allows you to toggle modules on and off when desired;
> I've done this in the past to determine what modules may or may not have
> been causing issues for the site I was working on.
>
>> I thought the concept of modules was that it would drop a module into
>> my application that i could use, but it apears not. Is my next step to
>> create my own module that makes use of the stuff in the vendor
>> folders, or does the module live under the vendor folder and i have to
>> config my application to use it.
>
> Typically, once you've enabled the module, you will likely need to do
> some configuration -- it really depends on the module. For instance, my
> PhlyContact module will basically work "out-of-the-box" -- but it
> assumes Sendmail as the mail transport, and the "Dumb" captcha adapter
> -- neither of which is likely what you want. Thus, you configure the
> module to suit your site's needs. Similarly with ZfcUser, you need to
> configure a database connection at minimum, and potentially some other
> options -- all of which are documented in its README.md file.
>
> So, while modules are mostly "plug and play", they will often benefit
> from configuration.
>
> --
> Matthew Weier O'Phinney
> Project Lead            | [hidden email]
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>

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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF2 Modules

weierophinney
Administrator
-- Steve Rayner <[hidden email]> wrote
(on Friday, 15 June 2012, 11:35 PM +0100):

> Thanks Matthew, it's starting to make sense.
>
> I'm getting this error;
>
> Unable to locate class associated with "zfcuserauthentication"
>
> I see this was an issue around three months ago, but any discussions i
> find seem to indicate it was fixed so i assume my problem is something
> i have done wrong.
>
> should i post any of my code here?

Here or in a pastebin -- you might also go onto Freenode IRC and join
the #zftalk.2 channel -- the authors of that module are generally around
and can help you troubleshoot in real-time.

> On Fri, Jun 15, 2012 at 2:59 PM, Matthew Weier O'Phinney
> <[hidden email]> wrote:
> > -- Steve Rayner <[hidden email]> wrote
> > (on Friday, 15 June 2012, 07:53 AM +0100):
> >> I see there is a module called zfc-user, with a sub-module for using
> >> doctrine orm.
> >> I'm new to ZF2 and the concept of modules (i didn't use them in zf1).
> >> ZF2 seems to have quite a complicated folder structure, that looks
> >> well thought out.
> >>
> >> I'm using composer, so I've added the required dependencies, done an
> >> update and it looks like everything i need has been downloaded into
> >> the vendor folder (and sub-folders).
> >>
> >> Now i'm lost. What's my next step?
> >
> > Enable the module in config/application.config.php:
> >
> >    'modules' => array(
> >        'Application',
> >        'ZfcUser',
> >        /* ... etc. ... */
> >    ),
> >
> > We've added a step of explicitly enabling modules here. The reason for
> > this is because it allows you to have a central "repository" of modules
> > that you can selectively choose from. A good example is, for instance,
> > if you're a client shop and host for your clients; instead of having
> > module installations per client project, you could have a single
> > location, and selectively enable the modules you need for a given
> > project.
> >
> > Additionally, it allows you to toggle modules on and off when desired;
> > I've done this in the past to determine what modules may or may not have
> > been causing issues for the site I was working on.
> >
> >> I thought the concept of modules was that it would drop a module into
> >> my application that i could use, but it apears not. Is my next step to
> >> create my own module that makes use of the stuff in the vendor
> >> folders, or does the module live under the vendor folder and i have to
> >> config my application to use it.
> >
> > Typically, once you've enabled the module, you will likely need to do
> > some configuration -- it really depends on the module. For instance, my
> > PhlyContact module will basically work "out-of-the-box" -- but it
> > assumes Sendmail as the mail transport, and the "Dumb" captcha adapter
> > -- neither of which is likely what you want. Thus, you configure the
> > module to suit your site's needs. Similarly with ZfcUser, you need to
> > configure a database connection at minimum, and potentially some other
> > options -- all of which are documented in its README.md file.
> >
> > So, while modules are mostly "plug and play", they will often benefit
> > from configuration.
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | [hidden email]
> > Zend Framework          | http://framework.zend.com/
> > PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
> >
> > --
> > List: [hidden email]
> > Info: http://framework.zend.com/archives
> > Unsubscribe: [hidden email]
> >
> >
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF2 Modules

Bart McLeod
In reply to this post by Steve Rayner-2
You will probably have to look for an alias in your class loader or just some mapping. Did you install using composer? If you did not, you may have to edit the autoloader config, so that it has an empty classmap, just to get you started.
-Bart

Op 16-06-12 00:35, Steve Rayner schreef:
Thanks Matthew, it's starting to make sense.

I'm getting this error;

Unable to locate class associated with "zfcuserauthentication"

I see this was an issue around three months ago, but any discussions i
find seem to indicate it was fixed so i assume my problem is something
i have done wrong.

should i post any of my code here?

On Fri, Jun 15, 2012 at 2:59 PM, Matthew Weier O'Phinney
[hidden email] wrote:
-- Steve Rayner [hidden email] wrote
(on Friday, 15 June 2012, 07:53 AM +0100):
I see there is a module called zfc-user, with a sub-module for using
doctrine orm.
I'm new to ZF2 and the concept of modules (i didn't use them in zf1).
ZF2 seems to have quite a complicated folder structure, that looks
well thought out.

I'm using composer, so I've added the required dependencies, done an
update and it looks like everything i need has been downloaded into
the vendor folder (and sub-folders).

Now i'm lost. What's my next step?
Enable the module in config/application.config.php:

   'modules' => array(
       'Application',
       'ZfcUser',
       /* ... etc. ... */
   ),

We've added a step of explicitly enabling modules here. The reason for
this is because it allows you to have a central "repository" of modules
that you can selectively choose from. A good example is, for instance,
if you're a client shop and host for your clients; instead of having
module installations per client project, you could have a single
location, and selectively enable the modules you need for a given
project.

Additionally, it allows you to toggle modules on and off when desired;
I've done this in the past to determine what modules may or may not have
been causing issues for the site I was working on.

I thought the concept of modules was that it would drop a module into
my application that i could use, but it apears not. Is my next step to
create my own module that makes use of the stuff in the vendor
folders, or does the module live under the vendor folder and i have to
config my application to use it.
Typically, once you've enabled the module, you will likely need to do
some configuration -- it really depends on the module. For instance, my
PhlyContact module will basically work "out-of-the-box" -- but it
assumes Sendmail as the mail transport, and the "Dumb" captcha adapter
-- neither of which is likely what you want. Thus, you configure the
module to suit your site's needs. Similarly with ZfcUser, you need to
configure a database connection at minimum, and potentially some other
options -- all of which are documented in its README.md file.

So, while modules are mostly "plug and play", they will often benefit
from configuration.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

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



    

--
Bart McLeod
Space Web
Middenlaan 47
6869 VN Heveadorp
The Netherlands
t +31(0)26 3392952
m 06 51 51 89 71
@ [hidden email]
www.spaceweb.nl
zce PHP 4 logo zce PHP 5 logo zce PHP 5.3 logo zce Zend Framework logo

Bart McLeod is a Zend Certified Engineer.

Click to verify!

Loading...