Download the PHP package vadimushka/ok-php-sdk without Composer

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

ok-php-sdk

PHP library for Ok API interaction, includes OAuth 2.0 authorization and API methods. Full Ok API features documentation can be found here.

Packagist

1. Prerequisites

2. Installation

The Ok PHP SDK can be installed using Composer by running the following command:

3. Initialization

Create OkApiClient object using the following code:

4. Authorization

The library provides the authorization flows for user based on OAuth 2.0 protocol implementation in apiok.ru. Please read the full documentation before you start.

4.1. Server Authorization Code Flow

OAuth 2.0 Authorization Code Flow allows calling methods from the server side.

This flow includes two steps — obtaining an authorization code and exchanging the code for an access token. Primarily you should obtain the "code" (manual user access) by redirecting the user to the authorization page using the following method:

Create OKOAuth object first:

After successful authorization user's browser will be redirected to the specified redirect_uri. Meanwhile the code will be sent as a GET parameter to the specified address:

Then use this method to get the access token:

The redirect_uri should be the URL that was used to get a code at the first step.

4.2. Client Authorization Code Flow

In difference with server authorization code flow this flow gives you temporary access key.

Read more about user access key.

First step to get access using Implicit flow is creating OKOAuth object:

Arguments are similar with server authorization code flow

After successful authorization user's browser will be redirected to the specified redirect_uri. Meanwhile, the access token will be sent as a fragment parameter to the specified address:

access_token is your new access token. session_secret_key is secret session key. expires_in is lifetime of access token in seconds. permissions_granted is rights granted by the user to the application. state is string from authorize method.

5. API Requests

You can find the full list of OK API methods here.

5.1. Request sample

5.2. Uploading Photos into a Private Message

5.3. Uploading Video Files


All versions of ok-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
guzzlehttp/guzzle Version ^7.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 vadimushka/ok-php-sdk contains the following files

Loading the files please wait ....