BEWARE! This is a super early version in active development. So please be careful if you decide to use it ✌️
This is open source software and not in any official way supported by Webflow.
This PHP SDK allows you to interact with the Webflow API easily.
There are two main ways to use this library. By accessing Sites and other entities and interacting with their respective classes or...
See the Entities documentation
...directly as an API wrapper through the underlying Webflow
class.
See the API client wrapper documentation
- Installation
- Usage
- Entities
- Client (API Wrapper)
- Meta
- Sites
- Webhooks
- Collections/Items
- List all collections for a specific site
- Fetch a specific collection by its ID
- List items for a specific collection by its ID
- Create an item in a specific collection by its ID
- Get an item by its ID
- Publish one or more items by their ID
- Update an item by its ID
- Patch an item by its ID
- Delete or un-publish an item by its ID
- Products/SKUs
- Ecommerce
- Contributing
- License
Install the SDK via Composer:
composer require nicdev/webflow-sdk
To use this SDK, first create a new instance of the Webflow
class with your API token.
use Nicdev\WebflowSdk\Webflow;
$token = 'your-webflow-api-token';
$webflow = new Webflow($token);
$user = $webflow->user();
$authInfo = $webflow->authInfo();
$sites = $webflow->listSites();
$site = $webflow->getSite($siteId);
$webflow->publishSite($siteId);
$domains = $webflow->listDomains($siteId);
$webhooks = $webflow->listWebhooks($siteId);
$webhook = $webflow->getWebhook($siteId, $webhookId);
use Nicdev\WebflowSdk\Enums\WebhookTypes;
$triggerType = WebhookTypes::SITE_PUBLISH;
$url = 'https://your-webhook-url.com';
$filter = []; // Optional filter array
$webflow->createWebhook($siteId, $triggerType, $url, $filter);
$webflow->deleteWebhook($siteId, $webhookId);
$collections = $webflow->listCollections($siteId);
$collection = $webflow->fetchCollection($collectionId);
$page = 1; // Optional page number
$items = $webflow->listItems($collectionId, $page);
$fields = [
'field-name' => 'field-value',
// ...
];
$live = false; // Optional live mode
$item = $webflow->createItem($collectionId, $fields, $live);
$item = $webflow->getItem($collectionId, $itemId)
$itemIds = ['your-item-id', 'your-other-item-id'];
$webflow->publishItems($collection, $itemIds);
$fields = $fields = [
'field-name' => 'field-value',
// ...
];
$live = false; // Optional publish
$webflow->updateItem($collectionId, $itemId, $fields, $live)
I don't see a real difference between the update and patch methods but they have been matched to their respective endpoints. For more information see the documentation.
$fields = $fields = [
'field-name' => 'field-value',
// ...
];
$live = false; // Optional publish
$webflow->updateItem($collectionId, $itemId, $fields, $live)
$live = true; // Optional. When set to true the item will be un-published but kept in the collection
$webflow->deleteItem($collectionId, $itemId, $live)
$page = 1; // Optional page number
$webflow->listProducts($siteId, $page);
$product = [
'slug' = 'foo-bar',
'name' => 'Foo Bar',
];
$sku = [
'slug' => 'foo-bar-small',
'name' => 'Foo Bar (S)',
'price' => [
'value' => 990,
'unit' => 'USD'
]
]; // Optional
$webflow->createProductAndSku($siteId, $product, $sku)
$webflow->getProduct($site, $product);
$fields = [
'name' => 'New Foo Bar',
'_archived' => true
];
$webflow->updateProduct($siteId, $productId, $fields);
$sku = [
'slug' => 'foo-bar-Medium',
'name' => 'Foo Bar (M)',
'price' => [
'value' => 1190,
'unit' => 'USD'
]
];
$webflow->createSku($siteId, $product, $sku);
$sku = [
'slug' => 'foo-bar-Medium',
'name' => 'Foo Bar (M) Discounted!!',
'price' => [
'value' => 1290,
'unit' => 'USD'
]
];
$webflow->updateSku($siteId, $productId, $skuId, $sku);
$collectionId = 'your-collection-id'; //likely to be the SKUs collection.
$webflow->getInventory($collectionId, $skuId)
$fields = [
'inventory_type' => 'infinite'
];
$webflow->updateInventory($collectionId, $skuId, $fields);
$page = 1; // Optional page number
$items = $webflow->listOrders($collectionId, $page);
$webflow->getOrdr($siteId, $orderId)
$fields = [
'comment' => 'Adding a comment to this order'
];
$webflow->updateOrder$siteId, $orderId, $fields);
$notifyCustomer = true; // Optional, defaults to false
$webflow->fullfillOrder($siteId, $orderId, $notifyCustomer);
$webflow->unfulfillOrder($siteId, $orderId);
$webflow->refundOrder($siteId, $orderId);
$webflow->getEcommerceSettings($siteId);
To use this SDK, first create a new instance of the Webflow
class with your API token.
use Nicdev\WebflowSdk\Webflow;
$token = 'your-webflow-api-token';
$webflow = new Webflow($token);
$sites = $webflow->sites; // [Site $site1, Site $site2...]
// or
$sites = $webflow->sites()->list(); // [Site $site1, Site $site2...]
$site = $webflow->sites($siteId) // Site $site;
// or
$site = $webflow->sites()->get($siteId) // Site $site;
$site->publish();
$webflow->sites($siteId)->domains();
// or
$webflow->sites($siteId)->domains;
$site->collections; // [Collection $collection1, Collection $collection2, ...]
// or
$site->collections(); // [Collection $collection1, Collection $collection2, ...]
$site->collections($collectionId) // Collection $collection;
$site->collections($collectionId)->items(); // [Item $item1, Item $item2, ...]
// or
$site->collections($collectionId)->items; // [Item $item1, Item $item2, ...]
$site->webhooks(); // [Webhook $webhook1, Webhook $webhook2, ...]
// or
$site->webhooks; // [Webhook $webhook1, Webhook $webhook2, ...]
$site->products(); // [Product $product1, Product $product2, ...]
// or
$site->products; // [Product $product1, Product $product2, ...]
$site->webhooks(); // [Order $order1, Order $order2, ...]
// or
$site->webhooks; // [Order $order1, Order $order2, ...]
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This SDK is licensed under the MIT License. See LICENSE for more information.