Download the PHP package xpiston/salsify without Composer

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

# ๐Ÿ—‚๏ธ Salsify for PHP **The PIM, as a few small objects.** Records, exports you can stream, imports, and webhook signatures that are actually verified โ€” for Laravel, Symfony, or no framework at all. [![PHP](https://img.shields.io/badge/PHP-8.2%20%E2%86%92%208.5-777BB4?logo=php&logoColor=white)](https://php.net) [![Laravel](https://img.shields.io/badge/Laravel-12%20%7C%2013-FF2D20?logo=laravel&logoColor=white)](https://laravel.com) [![Symfony](https://img.shields.io/badge/Symfony-6.4%20%7C%207-000000?logo=symfony&logoColor=white)](https://symfony.com) [![Tests](https://img.shields.io/badge/tests-141-22C55E)](#-tests) [![PHPStan](https://img.shields.io/badge/PHPStan-max-2563EB)](#-tests) [![License](https://img.shields.io/badge/license-MIT-blue)](#license)

Salsify is a product information management platform. Its ProductXM API is the one this package speaks: an organization, a token, records that are products, exports that are files, and webhooks that are signed.

What it gives you is a typed way to do the four things an integration really does โ€” read a product, mirror a catalogue, push a feed, and trust an incoming webhook โ€” with the platform's two awkward facts made impossible to get wrong: the rate limit belongs to the organization, not to you, and the webhook signature covers a URL that is not in the request.

โš ๏ธ Read this before you trust it

Nothing here has been checked against the live Salsify API. Salsify has no public sandbox, and API access is a licence option rather than something you can sign up for โ€” so unlike a package built against a published test platform, there was no server to measure. Every request this library builds comes from Salsify's own documentation and OpenAPI definitions, not from a response anybody observed.

What is proved, offline and end to end, is the webhook signature verification โ€” see what's proved and what's read. If you have API access, the fastest useful thing you can do with this package is run one call and tell me what came back.

โœจ What's inside

๐Ÿš€ Quick start

You also need any PSR-18 client. If you have none, this is the shortest way:

The organization id is in the Salsify app URL, right after /orgs/. It is not optional and not decoration: see the rate limit.

Changing one product

Creating one

The id is a property โ€” whichever one holds the ID role in your organization โ€” so it goes in the record rather than beside it.

๐Ÿ“ฆ Exporting a whole catalogue

This is the part worth reading, because it is the part an integration gets wrong. Three calls, not one:

There is deliberately no exportAndWait(). A full export takes minutes to hours; a method that polled until it finished would hold a web request or a queue worker open, and would hide the one decision that matters โ€” how often to ask โ€” which is a question about your organization's ten thousand requests an hour and not one a library can answer for you.

What a JSON Lines export actually contains

It is a data model told in order, not a list of products:

Line gives you isHeader(), isProperty(), isEnumeratedValue(), isDigitalAsset(), isRecord() โ€” and keeps anything it does not recognise. Salsify adds to this format, and a reader that silently dropped unknown entity types would lose data from a newer organization than itself, which for a mirror is the worst failure there is.

It really does stream

compressed: true reads a gzip file through compress.zlib:// without shelling out and without unpacking it to disk. One of the tests builds a 50 000-record file and asserts that streaming it costs under a megabyte of memory and that file_get_contents on the same file costs at least five times more โ€” so the claim fails loudly if the generator is ever broken by a refactor.

๐Ÿ” Webhooks

Salsify signs each webhook with RSA-SHA256 over five values joined by periods:

Four of those five are in the request. The fifth is not. The endpoint URL is the one Salsify was configured to call, and a verifier has to supply it from its own configuration. Rebuilding it from the request โ€” from Host, from REQUEST_URI, from a proxy header โ€” means checking a signature against a value the sender controls, which is not a check at all. So this library makes the URL a required constructor argument; there is no way to call it without one.

Headers are matched on a normalised form, so PHP's HTTP_X_SALSIFY_TIMESTAMP, PSR-7's x-salsify-timestamp and Salsify's own X-Salsify-Timestamp all work without the caller having to know which stack it is on.

Two things this does that the published example does not

It validates the certificate URL before fetching it. The URL arrives in a header. Fetching whatever a header says is server-side request forgery with extra steps: point it at 169.254.169.254 and the application obligingly requests the cloud metadata service. So the scheme must be https and the host must be exactly webhooks-auth.salsify.com โ€” checked before anything is downloaded, and checked again inside the fetcher, because that class is public and the day somebody calls it directly the check has to be next to the network call rather than in the caller who skipped it.

A test asserts each of nine untrusted URLs is refused and that the fetcher was never called โ€” a subdomain, a lookalike host, http, a userinfo trick, a redirect target, the metadata address. Refusing them is easy; refusing them before the request is the thing worth testing.

It rejects timestamps from the future. Salsify's tolerance is documented one-sided โ€” ignore requests that are too old โ€” which leaves a captured request replayable forever if its timestamp is set far enough ahead. A few seconds of clock skew is a clock; an hour is a forgery with a long life.

The raw body, not the parsed one

Both read the raw body deliberately. A JSON document that has been through json_decode and back is a different string the moment a key order, a float or an escape changes โ€” and it will verify perfectly in your tests and fail on the first real payload that happens to differ. There is a test that signs {"b":1, "a":2, "price": 1.10} and proves the re-encoded version does not verify.

๐Ÿ“ˆ The rate limit is the organization's

Salsify allows 10 000 requests per hour per organization โ€” not per user, not per token. Three consequences this library is built around:

  1. A 429 is as likely to be somebody else's fault as yours. Another integration in the same organization can spend the budget.
  2. The window resets at the top of the hour, not sixty minutes after your first request. A job that runs dry at 16:45 resumes at 17:00 with ten thousand.
  3. A loop over a catalogue cannot work. Fifty thousand products through the record endpoints is five hours of the whole organization's budget. Use an export to read and an import to write โ€” Salsify says the same thing, and the arithmetic says it louder.

And when it does happen:

๐Ÿšซ Three things this SDK refuses to do

It never retries. Not a 429, not a 500. A retry loop hidden inside an SDK is multiplied by every job your application starts, which is how one bad afternoon becomes two. The exception carries the seconds until the reset; the decision is yours, where you can see it.

It never puts the token in the URL. Salsify supports ?access_token= and its own documentation explains why not to โ€” URLs are logged by proxies, by web servers, by error trackers. The header costs nothing. Credentials also refuses a token pasted with the Bearer prefix, because that produces Bearer Bearer โ€ฆ and a 401 that looks like a bad token.

It never pretends an error is a result. A 4xx is an exception carrying the status and the decoded body, because Salsify's error bodies are useful โ€” a 400 for an ambiguous organization lists the organizations you belong to โ€” and the most common thing an SDK does with them is throw them away.

The Unauthorized message names the licence, because "your organization does not have API access" is the answer often enough to be worth saying before somebody spends an afternoon re-reading the token.

๐Ÿงฐ Laravel

The provider is auto-discovered. Two variables:

The signature verifier is a separate binding on purpose, so a webhook endpoint can resolve it alone:

php artisan vendor:publish --tag=salsify-config for the rest.

๐Ÿงฐ Symfony

Salsify and, when webhook_url is set, SignatureVerifier are autowired. The bundle picks up your PSR-18 client and PSR-17 factories from the container if they are there, and discovers them otherwise.

โœ… What's proved and what's read

The honest version, feature by feature. "Documented" means it comes from Salsify's published reference and has a test against the examples printed there; "proved" means a test demonstrates the behaviour end to end on your machine; "unverified" means nobody has seen the real server answer it.

Status
Webhook signature verification โœ… Proved. The tests generate an RSA key and a self-signed certificate, sign exactly as Salsify does, and then forge: the body altered, the body rewritten with the same data in another order, the request id, the organization id and the timestamp each tampered with, a verifier configured with the wrong endpoint URL, a different certificate, a certificate that is not one, a signature that is not base64, a replay outside the window, both tolerance edges, a timestamp from the future, and nine untrusted certificate URLs. The algorithm does not care whose key it is, so this is the real thing.
JSON Lines streaming โœ… Proved. Including the memory ceiling, with file_get_contents as the control.
Rate limit handling โœ… Proved against responses carrying Salsify's documented headers.
Record field semantics ๐Ÿ“„ Documented. The salsify: system fields, localized values and digital asset shapes are the ones in the reference, with its own examples as fixtures.
Request shapes (paths, methods, bodies, the two base prefixes) ๐Ÿ“„ Documented. Every request is asserted in full against a fake PSR-18 transport โ€” method, URL, headers, body. They match the published definitions. Whether the server agrees is unverified.
Export start ๐Ÿ“„ Documented โ€” there is an OpenAPI definition for it.
Export status endpoint โš ๏ธ Unverified and flagged in the code. Salsify documents the start call in full and describes polling only in prose. ExportClient::status() uses the conventional REST path, export_runs/{id}, and says so in its docblock rather than hiding it.
Import start and status โš ๏ธ Unverified. The paths follow the documented pattern.
Everything else about imports ๐Ÿšซ Absent. See below.

Nothing in this table is guesswork dressed up as a measurement, and nothing in the code pretends to a certainty it does not have.

๐Ÿ™ If you have a token

One call is enough to turn most of the โš ๏ธ rows above into โœ… or into a bug report, and either is worth having:

Open an issue with what came back โ€” redact the ids โ€” and the table above gets more honest.

๐Ÿงฑ How it's built

Decisions visible in the code

โœ… Tests

Under three seconds, no credentials, no network. Four suites:

unit โ€” each piece held still. The webhook verifier gets the most attention because it is the piece a mistake in is a security hole rather than a bug.

integration โ€” the joins, which is where the mistakes that matter live: a full export from start call to records, a record created-read-updated-deleted with every request asserted in full, a webhook downloading its certificate over PSR-18 and the certificate being fetched once for two deliveries.

laravel โ€” the bridge inside a real Laravel application, booted by Testbench.

symfony โ€” the bundle compiling a real Symfony container. That is one suite per bridge rather than one for both, because PHPUnit loads a suite's files before it filters anything, and CI builds a vendor tree with Symfony 6.4 and no Laravel to check the LTS claim โ€” a tree in which the Laravel test could not even be parsed.

Two tests exist because of specific mistakes rather than specific features: the one that proves 'yesterday' is not a timestamp, and the one that proves the untrusted certificate URL was never fetched rather than merely rejected.

โš ๏ธ Not included

Deliberately, and not for lack of time:

๐Ÿ“š The documentation this was built from

Where the documentation is thin, the code says so in the docblock of the method that had to guess. There are exactly two such places, and both are in the table above.

License

MIT. See LICENSE.


All versions of salsify with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
ext-openssl Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.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 xpiston/salsify contains the following files

Loading the files please wait ...