Download the PHP package novadaemon/skyflow-php without Composer

On this page you can find all versions of the php package novadaemon/skyflow-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package skyflow-php

Skyflow-PHP

Description

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

Cover

Table of Contents

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

Requirements

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

Create the vault

  1. In a browser, sign in to Skyflow Studio.
  2. Create a vault by clicking Create Vault > Start With a Template > 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

  1. In the side navigation click, IAM > Service Accounts > 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

The Novadaemon\SkyFlow\ServiceAccount\Token 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:

Example using credentials:

Response:

Vault API

The Novadaemon\Skyflow\Vault\Client has all methods to perform operations on the vault such as get records, inserting records, detokenizing tokens, retrieving tokens for a skyflow_id, excute sql query and to invoke a connection.

To use this class, the skyflow client must first be initialized as follows.

All Vault API endpoints must be invoked using a client instance.

Get Records

Use the method Client@getRecords() to perform bulk operation of retrieve records of table. This method has the following parameters:

Parameter Description Type Required? Default
table Name of the table that contains the records string yes none
ids Values of the records to return. If not specified, this operation returns all records in the table. array no null
redaction Redaction level to enforce for the returned records. Subject to policies assigned to the API caller. RedactionType no RedactionType::DEFAULT
tokenization If true, this operations returns tokens instead of field values where applicable. Only applicable if skyflow_id values are specified. bool no null
fields Fields to return for the records. If not specified, all fields are returned. array no null
columnName Name of the column. It must be configured as unique in the schema. string no null
columnValues Column values of the records to return. column_name is mandatory when providing column_values array no null
offset Record position at which to start receiving data. int no 0
limit Number of record to return. Maximum 25. int no 25

Note: There are parameters that cannot be used together with others. If you pass the getRecords method arguments incorrectly, a SkyflowException is thrown.

Note: If the tokenization argument is true, you can set only tokenized field names in the fields parameter. An error is returned if you set the tokenization parameter to true and set a non-tokenized field name in the fields parameter.

An example of Client@getRecords() call:

Response:

Error:

Get record by id

To retrieve only once record from your Skyflow vault, use the method Client@getRecordById(). This method has the following parameters:

Parameter Description Type Required? Default
table Name of the table that contains the records string yes none
id Skyflow id of the record string yes none
redaction Redaction level to enforce for the returned records. Subject to policies assigned to the API caller. RedactionType no RedactionType::DEFAULT
tokenization If true, this operations returns tokens instead of field values where applicable. Only applicable if skyflow_id values are specified. bool no null
fields Fields to return for the records. If not specified, all fields are returned. array no null

An example of Client@getRecordById() call:

Response:

Error:

Insert records into the vault

To insert data into your vault use the Cient@insertRecord() method. The parameters to this method are:

Parameter Description Type Required? Default
table Name of the table that contains the records string yes none
records Records to insert array yes none
tokenization If true, this operations returns tokens instead of field values where applicable. Only applicable if skyflow_id values are specified. bool no null
upsert Name of a unique column in the table. Uses upsert operations to check if a record exists based on the unique column's value. If it does, the record updates with the values you provide. If it does not, the upsert operation inserts a new record. string no null

An example of Client@insertRecords() call:

Response:

Error:

Update record

To update data in your vault, use the Client@updateRecord() method. The parameters to this method are:

Parameter Description Type Required? Default
table Name of the table that contains the records string yes none
id Skyflow id of the record string yes none
record Fields with new values to update array no null
tokenization If true, this operations returns tokens instead of field values where applicable. Only applicable if skyflow_id values are specified. bool no null

An example of Client@updateRecord() call:

Response:

Error:

Delete record

The Client@deleteRecord() allow you to delete a record from your Skyflow vault. This method has the following parameters:

Parameter Description Type Required? Default
table Name of the table that contains the records string yes none
id Skyflow id of the record string yes none

An example of Client@deleteRecord() call:

Response:

Error:

Bulk delete

The Client@bulkDelete() allow you to delete specified record from your Skyflow vault. This method has the following parameters:

Parameter Description Type Required? Default
table Name of the table that contains the records string yes none
ids kyflow id values of the records to delete. If * is specified, this operation deletes all records in the table. array yes ['*']

An example of Client@bulkDelete() call:

Response:

Error:

Detokenization

In order to retrieve data from your vault using tokens that you have previously generated for that data, you can use the Client@detokenize() method. The parameters to this method are:

Parameter Description Type Required? Default
params Detokenization details array yes none

An example of Client@detokenize() call:

Response:

Error:

Note: The structure for each item of the params parameter is:

Tokenization

The method Client@tokenize() method returns tokens that correspond to the specified records. Only applicable for fields with deterministic tokenization. The parameters to this method are:

Parameter Description Type Required? Default
params Tokenization details array yes none

Note: This endpoint doesn't insert records, it returns tokens for existing values. To insert records and tokenize that new record's values, see Insert Records and the tokenization parameter.

An example of Client@tokenize() call:

Response:

Error:

Execute SQL Query

The method Client@query() returns record for a valid SQL query. While this endpoint retrieves columns under a valid redaction scheme, it can't retrieve tokens. Only supports the SELECT command. The parameters to this method are:

Parameter Description Type Required? Default
query The SQL query to execute. string yes none

Note: See the Skyflow API Documentation to know moer about the query restrictions.

An example of Client@query() call:

Error:

Invoke Connection

Using Skyflow Connection, end-user applications can integrate checkout/card issuance flow with their apps/systems. To invoke connection, use the Client@invokeConnection() method of the Skyflow client. This method accepts the following parameters:

Paramater Description Type Required? Default
connectionUrl The connection URL. Must be the entire url for the route string yes none
method The connection route request method RequestMethodType yes none
headers Connection route request headers array no null
body Connection route request body array no null
pathParams Url path variables array no null
queryParams Query parameters array no null

Note: See the Skyflow API Documentation to know more about Connections.

An example of Client@invokeConnection() call:


All versions of skyflow-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
guzzlehttp/guzzle Version ^7.5
firebase/php-jwt Version ^6.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package novadaemon/skyflow-php contains the following files

Loading the files please wait ....