Download the PHP package ydb-platform/ydb-php-sdk without Composer

On this page you can find all versions of the php package ydb-platform/ydb-php-sdk. 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 ydb-php-sdk

YDB PHP SDK provides access to YDB from PHP code.

YDB is a open-source distributed fault-tolerant DBMS with high availability and scalability, strict consistency and ACID. An SQL dialect – YQL – is used for queries.

YDB is available in several modes:

Documentation

https://ydb.tech/docs/

Installation

The recommended method of installing is Composer.

Run the following:

Connection

First, create a database using Yandex Cloud Console.

YDB supports the following authentication methods:

Access token

Use your access token:

or:

OAuth token

You should obtain a new OAuth token.

Use your OAuth token:

or

JWT + private key

Create a service account with the editor role, then create a private key. Also you need a key ID and a service account ID.

Connect to your database:

or

JWT + JSON file

Create a service account with the editor role.

Create a service account JSON file, save it in your project as sa_name.json.

Connect to your database:

or:

Metadata URL

When you deploy a project to VM or function at Yandex.Cloud, you are able to connect to the database using Metadata URL. Before you start, you should link your service account to an existing or new VM or function.

or

Anonymous

or:

Determined by environment variables

The following algorithm that is the same for YDB-PHP-SDK applies:

  1. If the value of the YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS environment variable is set, the System Account Key authentication mode is used and the key is taken from the file whose name is specified in this variable.
  2. Otherwise, if the value of the YDB_ANONYMOUS_CREDENTIALS environment variable is set to 1, the anonymous authentication mode is used.
  3. Otherwise, if the value of the YDB_METADATA_CREDENTIALS environment variable is set to 1, the Metadata authentication mode is used.
  4. Otherwise, if the value of the YDB_ACCESS_TOKEN_CREDENTIALS environment variable is set, the Access token authentication mode is used, where the this variable value is passed.
  5. Otherwise, the Metadata authentication mode is used.

Static credentials

Reading from text file

Usage

You should initialize a session from the Table service to start querying with retry.

As soon as your script is finished, the session will be destroyed.

Customizing queries

Normally, a regular query through the query() method is sufficient, but in exceptional cases, you may need to fine-tune the query settings. You could do it using the query builder:

Methods of the query builder:

You can chain these methods for convenience.

Logging

For logging purposes, you need use class, which implements \Psr\Log\LoggerInterface. YDB-PHP-SDK has build-in loggers in YdbPlatform\Ydb\Logger namespace:

Example of using:

gRPC

gRPC client's options

You can customize the gRPC client's behavior by setting options in config array

Example of using:


All versions of ydb-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-bcmath Version *
ext-curl Version *
ext-grpc Version *
ext-json Version *
google/protobuf Version ~3.15.8
grpc/grpc Version ^1.35
phpseclib/phpseclib Version ^2.0|^3.0
psr/log Version ^1|^2|^3
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 ydb-platform/ydb-php-sdk contains the following files

Loading the files please wait ....