jeffersongoncalves / laravel-webflow
Laravel wrapper for Webflow's REST API v2
Package info
github.com/jeffersongoncalves/laravel-webflow
pkg:composer/jeffersongoncalves/laravel-webflow
Requires
- php: ^8.2
- illuminate/contracts: ^12.0|^13.0
- illuminate/http: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.21
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Laravel Webflow
A Laravel wrapper for the Webflow REST API v2. Covers sites, CMS collections/items, forms and publishing through a simple, typed API built on Laravel's Http client — no Webflow SDK dependency.
Features
- Sites:
listSites,getSite,publishSite - Collections:
listCollections - Collection items:
listCollectionItems,getCollectionItem,createCollectionItem,updateCollectionItem,publishCollectionItems(bulk) - Forms:
listForms,listFormSubmissions - Throws
WebflowException(with the HTTP status and the original API error body) on any non-2xx response
Installation
You can install the package via composer:
composer require jeffersongoncalves/laravel-webflow
Publish the config file with:
php artisan vendor:publish --tag="laravel-webflow-config"
This is the contents of the published config file:
return [ 'token' => env('WEBFLOW_API_TOKEN'), 'base_url' => env('WEBFLOW_BASE_URL', 'https://api.webflow.com/v2'), ];
Add your Webflow API token to your .env:
WEBFLOW_API_TOKEN=your-webflow-api-token
Usage
You can use the Webflow facade, or inject Jeffersongoncalves\Webflow\Webflow wherever you need it. Every method returns the decoded JSON response body as an array.
Sites
use Jeffersongoncalves\Webflow\Facades\Webflow; $sites = Webflow::listSites(); $site = Webflow::getSite('siteId'); Webflow::publishSite('siteId', customDomains: ['www.example.com'], publishToWebflowSubdomain: true);
Collections
$collections = Webflow::listCollections('siteId');
Collection items
$items = Webflow::listCollectionItems('collectionId', limit: 10, offset: 0); $item = Webflow::getCollectionItem('collectionId', 'itemId'); Webflow::createCollectionItem('collectionId', fieldData: [ 'name' => 'My New Item', 'slug' => 'my-new-item', ], isDraft: true); Webflow::updateCollectionItem('collectionId', 'itemId', fieldData: [ 'name' => 'Updated Item', ]); Webflow::publishCollectionItems('collectionId', ['itemId1', 'itemId2']);
Forms
$forms = Webflow::listForms('siteId'); $submissions = Webflow::listFormSubmissions('formId', limit: 25, offset: 0);
Error handling
Any non-2xx API response throws Jeffersongoncalves\Webflow\Exceptions\WebflowException, which exposes the decoded error body:
use Jeffersongoncalves\Webflow\Exceptions\WebflowException; try { Webflow::publishSite('siteId'); } catch (WebflowException $e) { logger()->error($e->getMessage(), $e->errorBody()); }
Rate limits
Webflow enforces 60 requests/minute per site for general endpoints and 10 requests/minute for publishing endpoints. This package does not throttle requests client-side — a WebflowException is thrown on 429 Too Many Requests like any other non-2xx response, so handle it (e.g. retry with backoff) if you publish in bulk.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
