Download the PHP package kodansha/wack-preview without Composer

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

WACK Preview

WACK Preview is a WordPress plugin that helps you to implement a preview system for unpublished drafts on your frontend application.

How it works

Originally designed for use with the WACK Stack, this plugin can also be used with other decoupled, headless WordPress setups that use separate frontend applications, such as those utilizing the REST API or WPGraphQL.

This plugin replaces the default permalinks and preview links for posts (and other custom post types) generated by WordPress.

Preview links are generated with a JWT token as a parameter. By verifying this JWT using the same secret key on your frontend application, you can ensure the token was legitimately generated by WordPress. This lets you securely fetch data before it is published.

Installation

Using Composer

[!NOTE] This plugin is not available on the WordPress.org plugin repository. The only installation method currently available is through Composer.

Configuration

To use WACK Preview, you need to configure URL mappings for displaying pages on the frontend. Additionally, you must set up a secret token for preview URLs.

You can configure these settings using one of the following methods:

Setting via WACK_PREVIEW_SETTINGS constant

Define WACK_PREVIEW_SETTINGS in functions.php or similar:

[!NOTE] For each post type, publish and preview can be configured independently. If preview is not set for a post type but publish is, preview links will be rewritten using the publish path (with the preview token appended as a query parameter), instead of being left as WordPress's default preview link. If neither publish nor preview is set, the original link is left unchanged.

[!NOTE] The secret_key is used to sign tokens with HMAC-SHA256 (HS256). A minimum length of 32 bytes is required. Using a shorter key will result in a fatal error at runtime. Generate a sufficiently long random value with a command such as openssl rand -hex 32.

[!NOTE] On multisite WordPress installations, the WACK_PREVIEW_SETTINGS constant does not function as expected. In such cases, configure settings individually for each site using the admin menu.

Setting via WordPress admin menu

Navigate to the WACK Preview settings screen in the WordPress admin menu and follow the on-screen instructions.

[!TIP] If settings are defined in both the WACK_PREVIEW_SETTINGS constant and the admin menu, the constant's settings will take precedence. This allows flexible configuration - for example, you could define only the secret_key as a constant (keeping it out of the database) while managing other settings through the admin screen.

Preview token payload

The preview token is a JWT token that contains the following payload:

This means that the frontend application can verify the token is valid for the specified post by checking the sub field.

API

wack_preview_verify_token

This is a utility function provided as a convenient API. It can be used in WordPress themes to verify preview tokens and control access to unpublished posts.

It returns true if the token is valid, false otherwise.


All versions of wack-preview with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
firebase/php-jwt Version ^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 kodansha/wack-preview contains the following files

Loading the files please wait ...