aMember integration with PHP framework: Yii, Zend, CI -- which one?

Discussion in 'Integration' started by variability, Jul 16, 2012.

  1. variability

    variability New Member

    Joined:
    Jul 7, 2012
    Messages:
    1
    Does anyone have experience with integration aMember with a site built with a PHP framework? I would like to use Yii, but I would like to be sure how to integrate it with aMember. Alternatively: Zend? Code Igniter?
  2. cnick79

    cnick79 New Member

    Joined:
    Jun 23, 2012
    Messages:
    9
    I am working on integrating aMember into my Yii app. I have a User model mapping a user table. This table has a foreign key to the am_user table so I know what amember user relates to User. My plan is to have my users signup and sign-in using aMember. When a new amember user is created I was going to insert a record into my User table with the am_user.userid. I'm not sure if the CUserIdentiy class is needed for Yii to authenticate a user or if this class should be extended to handle amember login.

    I'm still exploring my options to see what is the easiest method.

    I would love to hear other experiences.
  3. spicyniknaks

    spicyniknaks New Member

    Joined:
    Feb 27, 2012
    Messages:
    20
    If I were you I would pick the framework which best suits what you want to do and not worry about doing it the same way as aMember works. aMember mainly uses Zend Framework as well as a few other components but I think you will be making your job more difficult if you try to integrate too deeply with aMember.

    There are two approaches :-
    1) Connect directly to the database tables as @cnick79 seems to be doing
    and
    2) (What I would probably do) Write write hooks into your own app and then write an API which talked to a plugin in aMember. That way you don't have to re-code your own app to work with future versions of aMember, just update the plugin. Writing an aMember plugin is pretty easy and there are plenty of examples in the wiki and the forums that will help you.

    I have written a couple of plugins using the second method to talk to my own php apps via some AJAX calls to a simple API that I wrote just for this particular plugin.
  4. cnick79

    cnick79 New Member

    Joined:
    Jun 23, 2012
    Messages:
    9
    I won't exactly be connecting to the AM database tables. I have a base Controller class that has a filter to check if somebody is logged in to amember using the Am::Lite class. This way all access is contained in one controller. If I need/want to access amember user info then I will probably write a plugin as spicyniknaks talked about which hooks into my Yii app via CWebUser so it will be available to Yii::app()->user. I'm only offering a 7-day trial and one monthly subscription so my app doesn't need to distinguish between product access which should make integration easier.
  5. cnick79

    cnick79 New Member

    Joined:
    Jun 23, 2012
    Messages:
    9
    I managed to create an integration plugin using amember/admin-plugin-maker which adds a record into my user table when somebody signups with amember. The part I'm having difficulties with is authenticating the users in my app by making them appear to have logged in to my app after logging into amember.

    My app does have a UserLoginForm and it will login already registered members. However, this means users have to use my login to access my app and then login to amember to access their billing and profile information. I'm trying to integrate these two and not have them independent.

Share This Page