Download the PHP package webhubworks/craft-weclapp-api without Composer
On this page you can find all versions of the php package webhubworks/craft-weclapp-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webhubworks/craft-weclapp-api
More information about webhubworks/craft-weclapp-api
Files in webhubworks/craft-weclapp-api
Package craft-weclapp-api
Short Description A Craft CMS wrapper around webhubworks/weclapp-api-core.
License MIT
Homepage https://github.com/webhubworks/craft-weclapp-api
Informations about the package craft-weclapp-api
Weclapp API for Craft CMS
A Craft CMS wrapper around webhubworks/weclapp-api-core.
It is the Craft counterpart to webhubworks/weclapp-api-laravel: instead of a
Laravel service provider + facade, it registers a singleton Yii service that
exposes a fully configured core Client. The base URL and auth token are read
from environment variables, so no per-call configuration is needed.
Requirements
- Craft CMS 4.0+ or 5.0+
- PHP 8.3+
Installation
Configuration
Set the two required environment variables in your .env:
Note:
WECLAPP_API_BASE_URLshould include the full API path (e.g./webapp/api/v2). The adapter concatenates this base with the relative endpoint paths produced by the core client.
Usage
The plugin registers the core client behind a singleton api service:
getClient() returns the generated Webhubworks\WeclappApiCore\Client, so every
endpoint method from the core package is available.
How it works
Plugin::config()registersWeclappServiceas theapicomponent. Craft instantiates Yii components once per request, giving singleton semantics.WeclappService::getClient()readsWECLAPP_API_BASE_URLandWECLAPP_AUTH_TOKENviacraft\helpers\App::env(), then builds the core client with theCraftHttpClientPSR-18 adapter, caching the result.CraftHttpClientimplementsPsr\Http\Client\ClientInterfaceon top ofCraft::createGuzzleClient(). It prepends the base URL to each relative endpoint URI and attaches theAuthenticationTokenheader - the same contract the Laravel wrapper fulfils with Laravel's HTTP client.
License
The MIT License (MIT). Please see License File for more information.
All versions of craft-weclapp-api with dependencies
craftcms/cms Version ^4.0 || ^5.0
webhubworks/weclapp-api-core Version 3.1.*