Download the PHP package andy87/php-client-avito without Composer

On this page you can find all versions of the php package andy87/php-client-avito. 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 php-client-avito

PHP Client for Avito Public API

Russian documentation

Typed PHP client for the Avito Public API. The package provides a main ApiClientAvito entry point, generated provider sections, request prompt DTOs, response DTOs, and schema classes.

The client is built on top of andy87/php-client-sdk and targets PHP 8.1 or newer.

Requirements

Installation

Install the package with Composer:

Release v0.9.2 is published on Packagist as andy87/php-client-avito.

Compatibility

Version v0.9.2 targets PHP 8.1 or newer and requires andy87/php-client-sdk:v0.7.0. Composer resolves the SDK dependency automatically when the package is installed.

Quick Start

Create a client from an array and call a generated API method:

ApiClientAvito exposes provider sections lazily through properties such as user, item, messenger, autoload, deliverySandbox, and others generated from the Avito OpenAPI specifications.

Additional Documentation

Working with Prompts

Generated prompt DTOs are filled through public properties. Create a prompt object first, then assign request values directly to its fields.

Do not pass request data as a constructor array:

For API methods without parameters, create an empty prompt and pass it to the provider method:

Configuration

You can pass configuration as an array:

If you need to compose the API URL from parts, use protocol, host and prefix. An explicit baseUrl still has priority:

You can also use environment variables:

By default, AvitoConfig::fromEnv() reads:

For multiple credential sets, pass a suffix:

This reads AVITO_CLIENT_ID_CURIES and AVITO_CLIENT_SECRET_CURIES.

Responsibility Boundaries

The package handles the technical Avito API client layer:

The application usually owns the integration layer around the client:

OAuth Token

ApiClientAvito uses client credentials automatically for authorized generated API calls. You do not need to call /token manually before each regular API request.

Manual token endpoint calls are useful for diagnostics, credential checks, or specific OAuth scenarios:

Events and Headers

ApiClientAvito supports shared runtime options from andy87/php-client-sdk: default request headers and event listeners. Runtime state is stored once on the client and is shared with all provider sections, including providers that were already created lazily.

If you use the default HTTP transport, pass runtime options as the second constructor argument:

If you pass a custom transport as the second argument, pass runtime options as the fourth argument:

You can also change headers and attach listeners after client creation:

Available events:

Each event option accepts either one callable or a list of callables:

Header names are merged case-insensitively. The request starts with Accept: application/json, then client headers are applied, then authorization headers are applied. Authorization headers override default client headers, and EVENT_BEFORE_REQUEST listeners can mutate the final HttpRequest before it is sent.

HTTP responses with status 400 or higher are still converted into response DTOs and dispatch EVENT_AFTER_REQUEST. EVENT_REQUEST_EXCEPTION is only for thrown exceptions.

Authorization and Diagnostics Options

ClientCredentialsAuthorizationStrategy refreshes the token and retries the original API request once after 401 by default. You can override or disable refresh statuses:

Pass an SDK CacheInterface through options when the default OAuth strategy must store tokens in an external TTL store. This keeps the Avito client independent from Redis, Yii2, Symfony or any other framework:

For Redis, file cache, DB cache or framework cache, use any object implementing and_y87\PhpClientSdk\Contracts\Cache\CacheInterface, or the SDK adapter when the storage is PSR-16/simple-cache compatible.

Use authorizationResolver when a generated prompt needs a different auth strategy:

Enable TraceableTransport with traceableTransport => true to inspect requests and responses:

Mock Testing

Generated prompts can be mocked by class through andy87/php-client-sdk. This keeps tests independent from generated URL grouping:

Providers and Generated API

The root namespace is:

Main classes:

Generated classes are placed under:

You can inspect available top-level provider names at runtime:

You can access a provider either by property or by name:

Errors and Exceptions

The client and generated methods may throw:

License

MIT. See composer.json for the package license declaration.


All versions of php-client-avito with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
andy87/php-client-sdk Version v0.7.0
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 andy87/php-client-avito contains the following files

Loading the files please wait ...