Loading components

Hi guys,

I’m trying to implement this component into my code… what’s the best way to do this?

Do I load it via the config file as


'components' => [

              'foursquare' =>

              [

                'class' => 'garyrutland.foursquare.Foursquare',

                'clientId' => 'x',

                'secret' => 'y'

              ],

            ],

Or do I load it in the modules area


'modules'=>['components' => [

              'foursquare' =>

              [

                'class' => 'garyrutland.foursquare.Foursquare',

                'clientId' => 'y',

                'secret' => 'x'

              ],

            ],]

What’s the difference between the two?

U have to do in component.

Component

your own class file you want to do something with, specific to this site only. Examples are zip compression class in an uploader app, custom encryption algo for some security app.it likes hellers class.

Extension

An external class file or group of files which are re-usable, often provided by 3rd parties. Examples are facebook connect library you or someone else built, api library from ebay.com to get listing, rss reader library to read from google etc.

Module

A mini- yii based site which serves as a subset of your site,can also be reusable in other applications or is build independent to make yii even more modular. Examples are , a forum module that is independant of the site but uses only logged in user info, a user authentication module which contains integration with several sites like openid, facebook and google.