PHPackages                             novadaemon/skyflow-php - 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. [API Development](/categories/api)
4. /
5. novadaemon/skyflow-php

ActiveLibrary[API Development](/categories/api)

novadaemon/skyflow-php
======================

This PHP SDK is designed to help developers easily implement Skyflow into their php backend.

v1.0.0(2y ago)111MITPHPPHP &gt;=8.1

Since Jun 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/novadaemon/skyflow-php)[ Packagist](https://packagist.org/packages/novadaemon/skyflow-php)[ RSS](/packages/novadaemon-skyflow-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Skyflow-PHP
===========

[](#skyflow-php)

Description
-----------

[](#description)

This PHP SDK is designed to help developers easily implement Skyflow into their php backend.

[![Cover](https://camo.githubusercontent.com/a2d04c60cef52ee7e43f1d8a61ab412927176d6a9a8c231ccd58a7884963718c/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f536b79666c6f7725323050485025323053444b2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6e6f76616461656d6f6e253246736b79666c6f772d706870267061747465726e3d63697263756974426f617264267374796c653d7374796c655f31266465736372697074696f6e3d5468652b5048502b53444b2b666f722b536b79666c6f772b7661756c742b73657276696365266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)](https://camo.githubusercontent.com/a2d04c60cef52ee7e43f1d8a61ab412927176d6a9a8c231ccd58a7884963718c/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f536b79666c6f7725323050485025323053444b2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6e6f76616461656d6f6e253246736b79666c6f772d706870267061747465726e3d63697263756974426f617264267374796c653d7374796c655f31266465736372697074696f6e3d5468652b5048502b53444b2b666f722b536b79666c6f772b7661756c742b73657276696365266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Installation](#installation)
    - [Requirements](#requirements)
    - [Install](#install)
- [Examples](#examples)
    - [Prerequisites](#prerequisites)
    - [Create the vault](#create-the-vault)
    - [Create a Service Account](#create-a-service-account)
- [Service Account Bearer Token Generation](#service-account-bearer-token-generation)
- [Vault API](#vault-api)
    - [Get records](#get-records)
    - [Get record by ID](#get-record-by-id)
    - [Insert records](#insert-records-into-the-vault)
    - [Update record](#update-record)
    - [Delete record](#delete-record)
    - [Bulk delete records](#bulk-delete)
    - [Detokenization](#detokenization)
    - [Tokenization](#detokenization)
    - [Execute SQL Query](#execute-sql-query)
    - [Invoke Connection](#invoke-connection)

Features
--------

[](#features)

Authentication with a Skyflow Service Account and generation of a bearer token.

Vault API operations to insert, retrieve, update, delete and tokenize sensitive data.

Execute SQL queries into vault scheme.

Invoking connections to call downstream third party APIs without directly handling sensitive data.

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- Require PHP 8.1 or above
- You need to have installed [Composer](https://getcomposer.org/)

### Install

[](#install)

Type in your terminal:

```
composer require novadaemon/skyflow-php
```

Examples
--------

[](#examples)

You can find samples for all the features of the SDK in the `samples` directory. To run a given example:

1. Download the repository using `git clone https://github.com/novadaemon/skyflow-php.git`
2. Run `$ composer install` into directory project.
3. Go to the `samples` directory in your terminal.
4. Change the values enclosed by `` for the right values into the example file.
5. Execute the example you want: `$ php get_records.php`

### Prerequisites

[](#prerequisites)

- A Skyflow account. If you don't have one, register for one on the [Try Skyflow](https://skyflow.com/try-skyflow) page.
- PHP 8.1 or above.
- GIT

### Create the vault

[](#create-the-vault)

1. In a browser, sign in to Skyflow Studio.
2. Create a vault by clicking **Create Vault** &gt; **Start With a Template** &gt; **Quickstart vault**.
3. Once the vault is ready, click the gear icon and select **Edit Vault Details**.
4. Note your **Vault URL** and **Vault ID** values, then click **Cancel**. You will need these later.

### Create a Service Account

[](#create-a-service-account)

1. In the side navigation click, **IAM** &gt; **Service Accounts** &gt; **New Service Account**.
2. For **Name**, enter "SDK Sample". For **Roles**, choose **Vault Editor**.
3. Click **Create**. Your browser downloads a **credentials.json** file. Keep this file secure, as You will need it for each of the samples.

Service Account Bearer Token Generation
---------------------------------------

[](#service-account-bearer-token-generation)

The [Novadaemon\\SkyFlow\\ServiceAccount\\Token](src/ServiceAccount/Token.php) class is used to generate service account tokens from service account credentials file which is downloaded upon creation of service account. The token generated from this class is valid for 60 minutes and can be used to make API calls to vault services as well as management API(s) based on the permissions of the service account.

The `Token::generateBearerToken($credentialsPath)` static method takes the credentials file path for token generation, alternatively, you can also send the entire credentials as array, by using `Token::generateBearerTokenFromCredentials($credentials)`

[Example using filepath](samples/generate_bearer_token.php):

```
