PHPackages                             familysearch/fs-php-lite - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. familysearch/fs-php-lite

ActiveLibrary

familysearch/fs-php-lite
========================

1.3.3(8y ago)3493[2 issues](https://github.com/FamilySearch/fs-php-lite/issues)Apache-2.0PHPPHP &gt;=5.5CI failing

Since Aug 11Pushed 5y ago6 watchersCompare

[ Source](https://github.com/FamilySearch/fs-php-lite)[ Packagist](https://packagist.org/packages/familysearch/fs-php-lite)[ RSS](/packages/familysearch-fs-php-lite/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (7)Dependencies (4)Versions (8)Used By (0)

FamilySearch PHP Lite SDK
=========================

[](#familysearch-php-lite-sdk)

[![Packagist](https://camo.githubusercontent.com/d4d99857b0463e224b776c9887d40700dc49068152e06115af0f7278555a42d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66616d696c797365617263682f66732d7068702d6c6974652e737667)](https://packagist.org/packages/familysearch/fs-php-lite)[![Build Status](https://camo.githubusercontent.com/027b947337d949d31f9d441b72ecea004c540fe8f30320314931d8e5bfacf850/68747470733a2f2f7472617669732d63692e6f72672f46616d696c795365617263682f66732d7068702d6c6974652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/FamilySearch/fs-php-lite)

Lite PHP SDK for the [FamilySearch API](https://familysearch.org/developers/).

**Warning**: this SDK requires hard-coding the API endpoint URLs. That is considered bad practice when using the API. In most cases, FamilySearch does not consider URL changes as breaking changes. Read more about [dealing with change](https://familysearch.org/developers/docs/guides/evolution).

There is a sample app in the `/examples` directory that is deployed to .

Usage
-----

[](#usage)

```
include_once('FamilySearch.php');

// Create the SDK instance
$fs = new FamilySearch([
  'environment' => 'production',
  'appKey' => 'ahfud9Adjfia',
  'redirectUri' => 'https://example.com/fs-redirect',

  // Tell it to automatically save and load the access token from $_SESSION.
  'sessions' => true, // This defaults to true
  'sessionVariable' => 'FS_ACCESS_TOKEN',

  // Necessary for when the developer wants to store the accessToken somewhere
  // besides $_SESSION
  'accessToken' => '',

  // How many times should a throttled response be retried? Defaults to 5
  'maxThrottledRetries' => 5,

  // Activate pending modifications
  'pendingModifications' => ['consolidate-redundant-resources', 'current-person-401'],

  // Modify the default user agent by appending this value
  'userAgent' => 'myApp/1.2.3',

  // Enable optional serialization and deserialization with objects via gedcomx-php
  'objects' => true
]);

// OAuth step 1: Redirect
$fs->oauthRedirect();

// OAuth step 2: Exchange the code for an access token.
//
// This will automatically retrieve the code from $_GET and exchange it for
// an access token. The access token is contained in the response object if the
// request was successful. The token doesn't need to be saved to a variable if
// sessions are enabled because the SDK will automatically save it.
$response = $fs->oauthResponse();

// Get the current user
$response = $fs->get('/platform/users/current');

// All response objects have the following properties
$response->statusCode;     // Integer
$response->statusText;     // String
$response->headers;        // Array
$response->effectiveUrl;   // String
$response->body;           // String
$response->requestMethod;  // String
$response->requestHeaders; // Array
$response->requestBody;    // String
$response->redirected;     // Boolean; defaults to false
$response->throttled;      // Boolean; defaults to false
$response->curl;           // A reference to the curl resource for the request

// If the response included JSON in the body then it will be parsed into an
// associative array and be available via the `data` property.
$response->data;

// If a request is forwarded then the response will contain the original URL
$response->originalUrl;

// If a request is throttled then the response will tell how many times it was
// throttled until it finally succeeded.
$response->retries;

// You can POST too. The body may be an array or a string.
$response = $fs->post('/platform/tree/persons/PPPP-PPP', [
  'body' => $personData
]);

// The SDK defaults the Accept and Content-Type headers to application/x-fs-v1+json
// for all /platform/ URLs. But that doesn't work for some endpoints that require
// the atom data format so you'll need to set the headers yourself.
$response = $fs->get('/platform/tree/persons/PPPP-PPP/matches?collection=records', [
  'headers' => [
    'Accept' => 'application/x-gedcomx-atom+json'
  ]
]);

// You can also pass the query parameters to the HTTP methods if you don't want
// to construct the URL yourself.
$response = $fs->get('/platform/tree/persons/PPPP-PPP/matches', [
  'query' => [
    'collection' => 'records'
  ],
  'headers' => [
    'Accept' => 'application/x-gedcomx-atom+json'
  ]
]);

// Supported HTTP methods are `get()`, `post()`, `head()`, and `delete()`. They
// all call the core `request()` method which has the same signature.
$response = $fs->request('/platform/tree/persons/PPPP-PPP', [
  'method' => 'POST',
  'body' => $personData
]);
```

Serialization with gedcomx-php
------------------------------

[](#serialization-with-gedcomx-php)

When the `objects` configuration option is set to true, the [gedcomx-php](https://github.com/FamilySearch/gedcomx-php) library can be used for serialization from objects for requests and deserialization into objects for responses.

```
$fs = new FamilySearch({
    'objects' => true
});

$response = $fs->post('/platform/tree/persons', [
    'body' => new \Gedcomx\Extensions\FamilySearch\FamilySearchPlatform([
        'persons' => [ $personData ]
    ])
]);

$persons = $response->gedcomx->getPersons();
```

When a response body is present, it will be deserialized as either an [Atom Feed](http://familysearch.github.io/gedcomx-php/class-Gedcomx.Atom.Feed.html)or a [FamilySearchPlatform](http://familysearch.github.io/gedcomx-php/class-Gedcomx.Extensions.FamilySearch.FamilySearchPlatform.html)object.

gedcomx-php must be installed and included separately. gedcomx-php version 3.1.2 or later is required.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 96.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~81 days

Recently: every ~99 days

Total

7

Last Release

3073d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2c0823e440970744c44df6d71ee2ae024583b204f973a385cd5ed5528f6a784?d=identicon)[justincy](/maintainers/justincy)

---

Top Contributors

[![justincy](https://avatars.githubusercontent.com/u/1037458?v=4)](https://github.com/justincy "justincy (61 commits)")[![misbach](https://avatars.githubusercontent.com/u/796795?v=4)](https://github.com/misbach "misbach (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/familysearch-fs-php-lite/health.svg)

```
[![Health](https://phpackages.com/badges/familysearch-fs-php-lite/health.svg)](https://phpackages.com/packages/familysearch-fs-php-lite)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
