Skip to content

Using the SDK Documentation

Daniel Marshall edited this page Aug 26, 2015 · 34 revisions

To orient you on how to navigate the gedcomx-php SDK documentation, it would be helpful to follow the documentation through the steps of getting the name of a person in the Family Tree.

Activity: Open the gedcomx-php SDK documentation and enter FamilySearchClient in the Search box to find and display the FamilySearchClient class. From there follow the state transitions listed in the following steps and locate the methods in the documentation. As you go, notice some of the other methods that are available in the various classes. You can also examine tutorial.php or the sample app code to see how to code the methods.

Steps to Instantiate a Client

  1. You must first populate a FamilySearchClient class array with an app key, a redirect URI, and an access token. The FamilySearchClient class contains the _construct method along with other methods. Click 'public' and '_construct' to examine the structure of the _construct array in the documentation.

  2. With the array populated you must use the PHP "new" command to create a FamilySearchClient class instance (see the tutorial.php file to see how this is done). This places you in the FamilySearchClient class state. You must transition your state from one class to another by executing methods that are in the current class.

Steps to Authenticate

  1. Examine the getOAuth2AuthorizationURI() method to familiarize yourself with its parameters and return value. This method directs the user to the FamilySearch login page and returns an authorization code.

  2. Examine the authenticateViaOAuth2AuthCode($code) method and the getAccessToken() getter method to familiarize yourself with how to obtain authentication. This method retrieves the authenticated access token.

Steps to Get a Name

After authenticating with FamilySearch, the following steps will transition your state from one class to another in order to get the name of a person you have identified by person ID.

To follow these steps in the documentation, find the method then click the link to the state being transitioned to.

  1. Use the familytree() method to transition to the FamilyTreeCollectionState class.
  2. Use the readPersonById() method to transition to the FamilyTreePersonState class.

The FamilyTreePersonState class inherits the getPerson() method from the PersonState class. See the "Methods inherited from Gedcomx\Rs\Client\PersonState" heading and click the link to see the PersonState class and its methods.

  1. Use the getPerson() method to transition to the Person class.

  2. Use the getDisplayExtension() method to transition to the DisplayProperties class.

    The DisplayProperties class is where you can get (or set) a person's information.

  3. Use the getName() method (getter) to get the person's name.

What Next?

You might want to examine the sample app as your next step, or simply get started coding on your own.

Home

Tutorial

  • Step 1: Register
  • Step 2: Set up your test environment
  • Step 3: Build tutorial.php
  • Step 4: Use the SDK Documentation

Sample App

Documentation

Design

Clone this wiki locally