Download the PHP package verstka/sdk-php74 without Composer

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

verstka/sdk-php74

PHP 7.4 SDK for Verstka API v2. Open the editor, handle signatures, callback processing, ZIP download, and media/font persistence through a storage adapter.

For PHP 8.2+ use verstka/sdk (includes Laravel and Symfony integrations).

Installation

Requirements:

Requirement Value
PHP 7.4 – 8.1
Extensions ext-json, ext-hash, ext-zip
HTTP client Guzzle 7

Configuration

Usually apiKey, apiSecret, and a public callbackUrl are enough:

callbackUrl must be reachable by Verstka from the internet. Verstka calls it when the user saves in the editor.

Optional settings:

Parameter Default Description
apiUrl https://api.r2.verstka.org/integration Verstka API base URL
maxContentSize 200 * 1024 * 1024 (200 MiB) Max ZIP download size in bytes
requestTimeout 60.0 HTTP timeout for session/open (seconds)
downloadTimeout 120.0 HTTP timeout for content ZIP download (seconds)
debug false Include debug_info in callback responses

Main methods

Method Purpose
VerstkaClient::getEditorUrl(...) Opens a session via POST /session/open and returns the editor URL.
VerstkaClient::processMaterialCallback(...) Handles article_saved: signature, ZIP, media, onFinalize.
VerstkaClient::processFontsCallback(...) Handles site_fonts_updated: signature, fonts ZIP, font files, manifests.
StorageAdapter::saveMedia(...) Saves a file from vms_media/* and returns a public URL.
StorageAdapter::saveFontFile(...) Saves a font file and returns a public URL.
StorageAdapter::saveFontsManifest(...) Saves vms_fonts.css or vms_fonts.json and returns a URL.
LocalStorageAdapter Filesystem reference storage adapter.
CallbackDispatcher::dispatch(...) Routes a single callback endpoint by event field.
CallbackDispatcher::mapException(...) Maps SDK exceptions to HTTP error responses.
SignatureService::signMaterial(...) Builds HMAC for material_id:url.
SignatureService::verifySignature(...) Verifies HMAC.
UrlBuilder::buildAuthorizedContentUrl(...) Adds api_key and material_id to content_url.

1. Open editor from admin

In the admin UI, use a link that opens in a new tab and points to your backend route:

The backend route checks permissions, loads the article, gets editorUrl via the SDK, and redirects:

For a first-time article, omit vmsJson or pass null. For re-editing, pass the last saved vmsJson so the editor opens the current version.

Both vmsJson and metadata accept an array or a JSON string. The SDK sends metadata as a JSON object and automatically adds version: "php_<sdk-version>".

2. StorageAdapter

The SDK downloads the ZIP and extracts files, but does not know where your site stores media. Implement StorageAdapter to save files and return public URLs.

Each method must return a URL accessible to site visitors. The SDK replaces dummy-* placeholders in vmsHtml, vmsJson['assets'][*]['clientUrl'], vms_fonts.css, and the fonts tree.

For local development, use LocalStorageAdapter:

3. Material callback

When the user clicks Save in Verstka, your backend receives a callback. The SDK verifies the signature, downloads the ZIP, saves media via StorageAdapter, replaces temporary file URLs with public ones, and calls your onFinalize hook.

ContentFinalizeContext fields:

Field Description
materialId CMS material ID
metadata Metadata from the callback
vmsJson Publication JSON with updated clientUrl values
vmsHtml Publication HTML with replaced temporary URLs
savedMediaUrls Map {filename: public_url}

Save the updated vmsJson from the callback — pass it to getEditorUrl on the next editor open.

Response format (toResponse()):

rc: 1 means success, rc: 0 means failure or rejection.

4. Fonts callback

When site fonts change in Verstka, a separate site_fonts_updated event is sent.

onFinalize for fonts may be omitted if saving files via storage and returning the updated fonts tree to Verstka is enough.

5. Single callback endpoint

Use CallbackDispatcher to handle both material and fonts callbacks on one route:

The dispatcher checks $payload['event']: site_fonts_updated routes to the fonts flow, everything else to the material flow.

Metadata

metadata is an optional array or JSON string passed when opening the editor. Verstka stores it in the session and returns it in the callback.

Useful keys:

Service keys version_id, version_cdate, user_email, user_ip are added or updated by Verstka in the callback. Do not use metadata to store secrets or unnecessary PII.

Full reference: metadata.

PreSave hooks

processMaterialCallback and processFontsCallback accept an optional onPreSave hook. It runs after signature verification but before ZIP download — use it for permission checks, locks, or quotas.

If allow is false, the ZIP is not downloaded, no files are written, and Verstka receives rc: 0.

Callback authorization

If your callback URL is protected by Basic Auth or a Bearer token, pass credentials in metadata when opening the editor.

Basic Auth:

Bearer token:

Verstka adds the Authorization header to the outgoing callback. Details: Callback Authorization.

Exceptions

Exception When
VerstkaSignatureError Invalid X-Verstka-Signature
VerstkaCallbackDataError Missing or invalid callback fields
VerstkaContentTooLargeError ZIP exceeds maxContentSize
VerstkaApiError HTTP error from Verstka API (statusCode property)
VerstkaVmsJsonError Invalid vmsJson passed to getEditorUrl
VerstkaMetadataJsonError Invalid metadata passed to getEditorUrl

Use CallbackDispatcher::mapException($e) to convert exceptions to HTTP status codes and JSON error bodies in your callback handler.

Documentation

Full integration guide (Russian):

License

MIT — see LICENSE.


All versions of sdk-php74 with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4 <8.2
ext-hash Version *
ext-json Version *
ext-zip Version *
guzzlehttp/guzzle Version ^7.8
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 verstka/sdk-php74 contains the following files

Loading the files please wait ...