Download the PHP package christianjbrown/ebay-browse-api-sdk without Composer

On this page you can find all versions of the php package christianjbrown/ebay-browse-api-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 ebay-browse-api-sdk

eBay Browse API SDK

CI Coverage Packagist License PHP

A strongly-typed PHP client for the eBay Browse API. It reads eBay's public listing data — a single item, the items in a multi-variation listing, keyword and image searches, and part compatibility — returning plain, typed model objects rather than raw arrays.

The client is read-only and covers the whole public Browse surface. It authenticates with an application (client-credentials) OAuth2 token, so it needs no seller consent and no user token. Two things it does that a thin wrapper would not: it exposes estimatedAvailabilities, which carries the sold and remaining quantities that replaced the retired Shopping API's QuantitySold, and it turns eBay's "item not found" response into its own ItemNotFoundException so a caller can tell an ended listing apart from a failed request.

Supported endpoints

Resource Client Endpoint(s) Returns
Items getItemApi() GET /item/{item_id}, GET /item/get_item_by_legacy_id, GET /item/get_items_by_item_group ItemInterface / ItemGroupInterface
Items (bulk) getItemApi() GET /item ItemsResponseInterface
Item compatibility getItemCompatibilityApi() POST /item/{item_id}/check_compatibility CompatibilityResponseInterface
Item summaries getItemSummaryApi() GET /item_summary/search, POST /item_summary/search_by_image SearchPagedCollectionInterface

:warning: getItems() (GET /item) is a Limited Release Browse API call, available to select partners only. It needs an extra OAuth2 scope — https://api.ebay.com/oauth/api_scope/buy.item.bulk on top of the application's usual https://api.ebay.com/oauth/api_scope — which the client requests for you automatically for this one call; every other call keeps using the plain scope. Calling getItems() without that scope granted on your application answers with an authorization error.

ItemInterface and ItemSummaryInterface now cover eBay's full published field set: Item gained addonServices, authenticityGuarantee, authenticityVerification, availableCoupons, charityTerms, conditionDescriptors, ecoParticipationFee, gender, hazardousMaterialsLabels, inferredEpid, manufacturer, minimumPriceToBid, pattern, priceDisplayCondition, primaryItemGroup, primaryProductReviewRating, productFicheWebUrl, productSafetyLabels, qualifiedPrograms, quantityLimitPerBuyer, repairScore, reservePriceMet, responsiblePersons, sellerCustomPolicies, size, sizeSystem, sizeType, taxes, tyreLabelImageUrl and watchCount; ItemSummary gained compatibilityMatch, compatibilityProperties, distanceFromPickupLocation, pickupOptions, priceDisplayCondition, qualifiedPrograms and tyreLabelImageUrl. Product, PaymentMethod, Seller and ShippingOption also gained the remaining fields eBay documents for them (product identities and aspect groups; payment/seller instructions; userId and sellerLegalInfo; fulfilledThrough, shipToLocationUsedForEstimate and trademarkSymbol).

:heavy_check_mark: Prerequisites

:bulb: If you're on MacOS and have Homebrew, PHP and Composer will install with brew install composer.

:building_construction: Installation

For your composer-enabled project:

:computer: Usage

The Browse API authenticates every request with an application access token — eBay's OAuth2 client_credentials grant against https://api.ebay.com/identity/v1/oauth2/token, scope https://api.ebay.com/oauth/api_scope. This client fetches and caches that token for you, so you supply only your app's client id and client secret from the eBay developer program.

Every request also carries a marketplace id (X-EBAY-C-MARKETPLACE-ID), which decides the site the data comes from and the currency prices are quoted in. That, plus the optional X-EBAY-C-ENDUSERCTX and Accept-Language headers, lives in a small Marketplace value object.

You supply four things to the Browse entry point, plus an optional fifth:

BrowseFactory takes the API host and builds the Browse facade:

:satellite: Overriding the API host

Every request, including the OAuth2 token exchange, goes to the host you give BrowseFactory. To point the client at eBay's sandbox, pass ApiHost::sandbox() instead of ApiHost::production():

eBay runs the Buy APIs, including Browse, through a different sandbox gateway host than the rest of the platform: ApiHost::sandbox() calls the Browse API on apiz.sandbox.ebay.com and the OAuth2 token endpoint on api.sandbox.ebay.com. ApiHost::production() calls both on api.ebay.com. For any other host (a proxy, a mock server in tests), construct new ApiHost($browseApiBaseUrl, $oauthTokenUrl) directly.

:package: Reading one item

getOneById() takes a Browse item id (v1|123456789012|0); getOneByLegacyId() takes the plain numeric id you see in an eBay URL and optionally a variation id or SKU.

fieldgroups is passed straight through, so getOneById($itemId, 'PRODUCT') adds the catalogue product block, and the multi-variation parent of a listing is read with:

:package: Reading several items at once

getItems() (GET /item) reads up to 20 items or up to 10 item groups in a single call, given one of itemIds or itemGroupIds (never both). It is a Limited Release call — see the warning above — and returns only a reduced field set per item (no title, description or seller, for example), so treat every field on the returned items as optional even where a single-item read would guarantee it.

Reading by item group instead:

quantityForShippingEstimate is accepted here and by getOneById(), getOneByLegacyId() and getMultipleByItemGroupId(), and is passed straight through as the quantity_for_shipping_estimate query parameter.

:mag: Searching

search() exposes the full parameter set — keyword, GTIN, EPID, charity ids, category ids, aspect and compatibility filters, the general filter expression, sort, fieldgroups, auto_correct, and limit/offset pagination.

:bulb: eBay only returns itemSummaries alongside refinements when MATCHING_ITEMS is one of the fieldgroups. Ask for ASPECT_REFINEMENTS on its own and you get the refinements and nothing else.

searchByImage() takes a base64-encoded image and the same refinement parameters:

:wrench: Part compatibility

check() takes a Browse item id and a map of compatibility aspect names to values. The accepted names vary by marketplace and category — eBay answers 11507 listing the ones it does not recognise.

:rotating_light: Error handling

Everything this library throws implements ChristianBrown\EBay\Browse\Exception\ExceptionInterface, so a single catch covers it all:

There are three concrete types:

All three live in src/Exception/. Other request-level failures (network errors, 400s, throttling) surface as RequestExceptionInterface from christianjbrown/api-client, and token failures as RequestExceptionInterface from christianjbrown/oauth2-client. Both are outside this library's exception hierarchy. A BadResponseExceptionInterface carries getDecodedBody(), which is where eBay's errors payload (its errorId, domain, category, message and longMessage) can be read.

Under the hood, Browse wires the clients, their transformer chains, and the OAuth machinery through a Symfony dependency-injection container. If you don't want the container, you can build the same chain by hand — as shown below.

Wiring the clients Every client takes a request sender, its transformer chain, a `CredentialsInterface` and an `ApiHostInterface`. The credentials and the host are the same for all three, so they are built once: The transformer chains are built bottom-up from the leaves, sharing one instance of each leaf across every branch that needs it — exactly as the container wires them. The compatibility client has the shortest chain: `ItemTransformer` is a composition of eight part transformers (`ItemDescriptionTransformer`, `ItemConditionTransformer`, `ItemMediaTransformer`, `ItemPricingTransformer`, `ItemFulfilmentTransformer`, `ItemListingTransformer`, `ItemProductTransformer` and `ItemComplianceTransformer`), each taking the nested transformers for its own fields; `ItemSummaryTransformer` takes a longer constructor. Read the argument list off the class and hand each nested transformer in, in order. `ItemApi` and `ItemSummaryApi` take the same `$requestSender`, their own transformer chain, `$credentials` and `$apiHost`, plus one `KeyedCacheInterface` argument per independent cache they keep: `ItemSummaryApi` takes one (for `search()`), `ItemApi` takes four (for `getOneById()`, `getOneByLegacyId()`, `getMultipleByItemGroupId()` and `getItems()`, in that order) and an `ItemsResponseTransformerInterface` before the `getItems()` cache, each cache its own `ArrayKeyedCache` instance: The registrars under `src/Container/` (`LeafTransformerServiceRegistrar`, `ComposedTransformerServiceRegistrar`, `ApiClientServiceRegistrar`) are the canonical wiring if you need a reference.

:arrow_up: Upgrading to 2.0

Browse no longer builds anything itself: its constructor takes a PSR-11 container. The default wiring moved into BrowseFactory, and the API host is now a required argument rather than an optional fifth constructor argument.

If you construct clients by hand, ItemApi now requires its ItemsResponseTransformerInterface and getItems() cache, and ApiClientServiceRegistrar requires its getItems() cache, instead of building defaults. CoreServiceRegistrar now takes the ApiClientInterface, a ClientCredentialsTokenManagerFactoryInterface and a LockInterface; BrowseFactory supplies them. ItemTransformer takes eight part transformers instead of 29 nested ones.

This release also moves to christianjbrown/api-client 3, christianjbrown/oauth2-client 2.1 and christianjbrown/key-value-store 3. The access-token store you pass to create() must be built for key-value-store 3: new MemoryKeyValueStore(new NativeClock()) (it now needs a PSR-20 clock and enforces TTLs), and FirestoreKeyValueStore takes a clock too. The package now requires psr/clock and symfony/clock.

:memo: Changelog

Notable changes in each release are listed in CHANGELOG.md.

:page_facing_up: License

Released under the MIT License.


All versions of ebay-browse-api-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
christianjbrown/api-client Version ^3.0
christianjbrown/key-value-store Version ^3.0
christianjbrown/oauth2-client Version ^2.1
psr/clock Version ^1.0
psr/container Version ^2.0
symfony/clock Version ^8.0
symfony/dependency-injection Version ^8.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 christianjbrown/ebay-browse-api-sdk contains the following files

Loading the files please wait ...