Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8307829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:37:29+00:00 2026-06-08T18:37:29+00:00

I have a facebook app developed in plain PHP, I’m migrating the app to

  • 0

I have a facebook app developed in plain PHP, I’m migrating the app to YII framework.

The thing is that I use a class call “utilsFacebook” where I have the object facebook(of the fb sdk) and all the methods that I need to get data from facebook, getUserId, getUserFriendList, etc.

I don’t know how to handle all the operations that I do in utilsFacebook with Yii.

Create a controller with the functions of utilsFacebook is the correct think to do?
Every time that I instance the controller would create a new Facebook object, Should I store that object in a SESSION to get a better performance or is a bad idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:37:31+00:00Added an answer on June 8, 2026 at 6:37 pm

    Q. Create a controller with the functions of utilsFacebook is the correct think to do?

    Having done a facebook app using yii as the framework, i would recommend you to make this library either a component, or an extension.

    But definitely don’t put these functions in the controller directly. Whenever a controller needs them call the functions using your custom facebook util class.

    Components can be put in the folder: projectrootfolder/protected/components

    Extensions can be put in the folder: projectrootfolder/protected/extensions

    If you don’t believe that either of these make semantic sense, you can always create a new folder within protected, say utils and put the class there. However i think extensions is the best way to go.

    Q. Should I store that object in a SESSION to get a better performance or is a bad idea?

    I don’t think it’s necessary to store the object in a session, because there will be no visible performance gain. Further you’ll complicate your code unnecessarily.

    What i had done was, created an app level component and used this component throughout the app, in any controller.

    Example:

    In your application’s config, protected/config/main.php :

    'components'=>array(
        'fbHelper'=>array( // gave the component this name
            'class'=>'ext.utils.FacebookHelper', // had stored the helper class in extensions/utils folder
            'parameter1'='somevalue',
            // more parameters
        ),
    
        // standard yii app components
    
    ),
    

    This will allow you to use the component like this: Yii::app()->fbHelper->getFriends();

    Take a look at the facebook-opengraph extension, which could help you, on the way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to develop web2py app and have to use Facebook sdk in that.
I have developed an iphone app that needs the email address of a facebook
i have developed a php based app for facebook. now i need to push
I have developed a facebook page tab app for my website and now I
I have a facebook app that requiers authorization, therefore I have to pass a
I have a facebook app that I authenticate using a general-purpose authentification. Like this:
I have a facebook app using a lot of Javascript that doesn't work correctly
I have built a Facebook app using the Javascript SDK that has been up
I've developed a Flash quiz app for facebook, which calls for a php script
I Developed a REST Service in Jax-RS, and I have some functions that use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.