PHPackages                             lifeboat/php-sdk - 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. lifeboat/php-sdk

ActiveLibrary

lifeboat/php-sdk
================

Lifeboat PHP SDK

2210[1 issues](https://github.com/lifeboat-app/php-sdk/issues)PHP

Since Dec 28Pushed 2y ago1 watchersCompare

[ Source](https://github.com/lifeboat-app/php-sdk)[ Packagist](https://packagist.org/packages/lifeboat/php-sdk)[ RSS](/packages/lifeboat-php-sdk/feed)WikiDiscussions main Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Lifeboat.app - PHP SDK
======================

[](#lifeboatapp---php-sdk)

[![Build Status](https://camo.githubusercontent.com/68431a51e9eb7e019150213766d1f5ccab472050523561261f8697362cd3adf7/68747470733a2f2f6170702e7472617669732d63692e636f6d2f6c696665626f61742d6170702f7068702d73646b2e7376673f6272616e63683d6d61696e)](https://app.travis-ci.com/lifeboat-app/php-sdk)[![Latest Stable Version](https://camo.githubusercontent.com/3603ef4b55e16d647d2799e18d3d71467a4a514c3d1f44f4cecc5b484a8b46a9/687474703a2f2f706f7365722e707567782e6f72672f6c696665626f61742f7068702d73646b2f76)](https://packagist.org/packages/lifeboat/php-sdk)[![License](https://camo.githubusercontent.com/2798ed78823b951b14fa74cd77df01a1af84baaee81e8c7d30b703f39bbee96a/687474703a2f2f706f7365722e707567782e6f72672f6c696665626f61742f7068702d73646b2f6c6963656e7365)](https://packagist.org/packages/lifeboat/php-sdk)

This SDK is meant to help developers to build apps that access the Lifeboat API.
[lifeboat.app](https://lifeboat.app)

UNDER DEVELOPMENT
-----------------

[](#under-development)

This SDK is still under development.

---

The Lifeboat PHP SDK enables site owners and app developers to leverage the Lifeboat API with their software.

Requirements
------------

[](#requirements)

PHP 7.2 or later

Composer
--------

[](#composer)

You can install this SDK via [Composer](https://getcomposer.org). Run the command

```
composer require lifeboat/php-sdk

```

To use this SDK you need to use [Composer](https://getcomposer.org) autoload.

```
require_once('vendor/autoload.php');
```

Setup
-----

[](#setup)

1. Create a developer account on [dev.lifeboat.app](https://dev.lifeboat.app)
2. Register an app

### NOTE

[](#note)

**NEVER share your app credentials**

Getting Started
---------------

[](#getting-started)

### Invoke the client

[](#invoke-the-client)

Initialise the SDK and redirect the user to the Lifeboat OAuth service. The OAuth service will automatically login and capture user authorisation to use your app.

```
// The SDK requires sessions to store and cache data
session_start();

$client = new \Lifeboat\App(
    '',
    ''
);

// The SDK will create a strong challenge key
// and automatically store it in the session
$challenge = $client->getAPIChallenge();

// Redirect the user to the auth screen
$redirect_url = $client->getAuthURL(
    'https://my.app/oauth/process_url',
    'https://my.app/oauth/error_url',
    $challenge
);
header("Location: {$redirect_url}");
exit;
```

##### Processing Page

[](#processing-page)

```
// https://my.app/oauth/process_url
session_start();
$client = new \Lifeboat\App(
    '',
    ''
);

// This code will be returned by the oauth service to provide
// you with temporary access to the logged in user account.
$code = $_GET['code'];

// Get an access token
// The SDK will automatically store the access token in sessions
//
// If the user has access to multiple stores
// the SDK will also automatically select the active store
// based on the user's selection durin OAuth
$access_token = $client->fetchAccessToken($code);
```

### Using the client without user interaction

[](#using-the-client-without-user-interaction)

Sometimes you might need to perform actions on the user's store without that user actively interacting with your app. A common usecase is retreiving products on a cron to perform analysis or other checks.

To do this you need to know 2 important parameters:

- `site_key`: The store's site\_key you want to access
- `site_host`: The store's master domain

**Note: The user must first authorise your app before you can use this method**

```
$client = new \Lifeboat\App(
    '',
    ''
);

// Let the SDK know which store you'll be interacting with
$client->setActiveSite($site_host, $site_key);
```

*From here on forward you can keep using the `$client` as if the user has logged in. The SDK &amp; Lifeboat OAuth will automatically check that your app has been authorised by the user.*

### Basic Usage

[](#basic-usage)

Creating, manipulating and deleting objects from here on is done completely through the SDK.

```
$product = $client->product->create([
    'Title' => 'MyProduct',
    'SKU' => 'xxx',
    'TrackStock' => true
]);

// Makes the necessary calls to the API to store the object
$product->save();
```

### Examples

[](#examples)

You can see a working example in the **examples** directory of this repository.

- `Auth.php` - An example auth controller for your front-end
- `Cron.php` - An example cron controller
- `Store.php` - An example object to save store information

[![Latest Unstable Version](https://camo.githubusercontent.com/c592555e5453a270a851ce585a2d7cbbd6b1df41648a057e38f6e2fcbcd2d755/687474703a2f2f706f7365722e707567782e6f72672f6c696665626f61742f7068702d73646b2f762f756e737461626c65)](https://packagist.org/packages/lifeboat/php-sdk)[![codecov](https://camo.githubusercontent.com/89feed9d78753ee08cdc1568218a3b4a226e5c91ebfa909d78e4719826a4282b/68747470733a2f2f636f6465636f762e696f2f67682f6c696665626f61742d6170702f7068702d73646b2f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/lifeboat-app/php-sdk)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e1bd942070397b1210a7c491446e0d31d2d1a24bf107f9b592d8c2c34ca46452/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c696665626f61742d6170702f7068702d73646b2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/lifeboat-app/php-sdk/?branch=main)

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor1

Top contributor holds 59.7% 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.

### Community

Maintainers

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

---

Top Contributors

[![chalie-ai](https://avatars.githubusercontent.com/u/262650352?v=4)](https://github.com/chalie-ai "chalie-ai (86 commits)")[![dylangrech92](https://avatars.githubusercontent.com/u/5817606?v=4)](https://github.com/dylangrech92 "dylangrech92 (58 commits)")

### Embed Badge

![Health badge](/badges/lifeboat-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/lifeboat-php-sdk/health.svg)](https://phpackages.com/packages/lifeboat-php-sdk)
```

PHPackages © 2026

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