PHPackages                             sarfrazrizwan/laravel-webling - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sarfrazrizwan/laravel-webling

ActiveLibrary[API Development](/categories/api)

sarfrazrizwan/laravel-webling
=============================

An ergonomic Laravel wrapper for the Webling REST API featuring automated caching, credentials validation, robust API key redaction, and type-safe resource groups.

00PHPCI passing

Since Jul 1Pushed todayCompare

[ Source](https://github.com/sarfrazrizwan/laravel-webling)[ Packagist](https://packagist.org/packages/sarfrazrizwan/laravel-webling)[ RSS](/packages/sarfrazrizwan-laravel-webling/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Webling Wrapper Package
===============================

[](#laravel-webling-wrapper-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/943120d6ebbaee1ec8a6d42a77cd5372fba4fb43877167105dcbbfa4ee02f6c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7361726672617a72697a77616e2f6c61726176656c2d7765626c696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sarfrazrizwan/laravel-webling)[![GitHub Tests Action Status](https://github.com/sarfrazrizwan/laravel-webling/actions/workflows/run-tests.yml/badge.svg)](https://github.com/sarfrazrizwan/laravel-webling/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/718e5628ba14015ac3bc6df004b1c15ef7ba0e1e4bf6b4cf9f239f406c6d2a50/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7361726672617a72697a77616e2f6c61726176656c2d7765626c696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sarfrazrizwan/laravel-webling)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Laravel wrapper for the Webling REST API (`usystems/webling-api-php`). It features a three-layer architecture (raw pass-through, ergonomic resource models, and read-only singletons), credentials validation, automated caching, and robust API key security redacting.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require sarfrazrizwan/laravel-webling
```

You can publish the configuration file using:

```
php artisan vendor:publish --tag="webling-config"
```

Configuration
-------------

[](#configuration)

Set the environment variables in your `.env` file:

```
WEBLING_DOMAIN=https://your-domain.webling.ch
WEBLING_API_KEY=your-32-character-api-key

# Optional Timeouts
WEBLING_CONNECT_TIMEOUT=5
WEBLING_TIMEOUT=10
WEBLING_USER_AGENT=laravel-webling

# Optional Caching
WEBLING_CACHE_ENABLED=true
WEBLING_CACHE_DIR=/path/to/cache/directory
```

---

Usage
-----

[](#usage)

You can access the package using dependency injection or through the `Webling` facade:

```
use RizwanSarfraz\Webling\Facades\Webling;

// Or via container resolution:
// $webling = app(RizwanSarfraz\Webling\Webling::class);
```

### Layer 1: Raw HTTP Pass-through (Escape Hatch)

[](#layer-1-raw-http-pass-through-escape-hatch)

Thin methods returning decoded arrays and throwing `WeblingApiException` on HTTP status codes `>= 400`. Useful for endpoints not modeled by the resource layer.

```
// Perform raw HTTP requests
$members = Webling::get('member');
$response = Webling::post('member', ['FirstName' => 'Jane']);
$response = Webling::put('member/123', ['LastName' => 'Doe']);
$response = Webling::delete('member/123');

// Access the underlying Webling\API\Client directly
$rawClient = Webling::raw();
```

### Layer 2: Ergonomic Resource Groups

[](#layer-2-ergonomic-resource-groups)

Named accessors mapping to Webling object types. Resource instances are cached in memory for the duration of the request.

```
// List all objects (accepts filter, order, format, page/per_page)
$objects = Webling::member()->list([
    'filter' => '`Vorname` = "Hans"',
    'format' => 'full'
]);

// Get a single resource
$member = Webling::member()->get(123);

// Multiget (fetches several IDs in one request comma-joined)
$multipleMembers = Webling::member()->get([536, 525, 506]);

// Create a new resource (returns new object ID)
$newId = Webling::member()->create([
    'FirstName' => 'Hans',
    'LastName' => 'Müller'
]);

// Update a resource
Webling::member()->update(123, ['FirstName' => 'Hansi']);

// Delete a single resource or multiple resources
Webling::member()->delete(123);
Webling::member()->delete([536, 525]);
```

#### Specialized Subclass Endpoints

[](#specialized-subclass-endpoints)

- **`member`**: Adds binary downloads ```
    $imageBytes = Webling::member()->image($id, 'photo.jpg', 'mini'); // size: mini|thumb|medium
    $fileBytes = Webling::member()->file($id, 'contract.pdf');
    ```
- **`article`**: Adds image download ```
    $imageBytes = Webling::article()->image($id, 'image.png', 'thumb');
    ```
- **`document`**: Adds document content and head checks ```
    $fileBytes = Webling::document()->content($id, 'invoice', 'pdf');
    $metadata = Webling::document()->head($id);
    ```
- **`documentgroup`**: Adds archive ZIP download ```
    $zipBytes = Webling::documentgroup()->archive($id);
    ```
- **`apikey`**: Fetch last used details ```
    $lastUsed = Webling::apikey()->lastUsed($id);
    ```
- **`user`**: Trigger onboarding ```
    Webling::user()->sendOnboarding($id);
    ```

*Note: All binary sub-resources return raw bytes (strings) rather than JSON arrays.*

### Layer 3: Singletons and Read-Only Direct Methods

[](#layer-3-singletons-and-read-only-direct-methods)

Direct methods for singleton routes:

```
$config = Webling::config();
$currentUser = Webling::currentUser();
$definitions = Webling::definitions('simple'); // accepts format: simple|full|zapier
$quota = Webling::quota();
$settings = Webling::settings();

// Update settings
Webling::updateSettings(['theme' => 'dark']);

// Incremental synchronization / change tracking
$changes = Webling::changes(1719710000); // timestamp
$replication = Webling::replicate(123);   // revision ID
```

---

Caching Integration
-------------------

[](#caching-integration)

If `WEBLING_CACHE_ENABLED` is true, you can retrieve the cache instance wrapper:

```
$cache = Webling::cached(); // returns Webling\Cache\Cache

// Update the local cache state
$cache->updateCache();

// Fetch a cached object directly
$member = $cache->getObject('member', 123);
```

---

Error Handling
--------------

[](#error-handling)

All failed HTTP requests (`status >= 400`) throw a `WeblingApiException` which carries detailed request metadata. For security, **the API key is automatically redacted** from any exception messages and printed stack traces.

```
use RizwanSarfraz\Webling\Exceptions\WeblingApiException;
use RizwanSarfraz\Webling\Exceptions\WeblingReadonlyException;
use RizwanSarfraz\Webling\Exceptions\WeblingConfigurationException;

try {
    Webling::member()->get(999);
} catch (WeblingApiException $e) {
    echo $e->getStatusCode(); // e.g. 404
    echo $e->getPath();       // e.g. member/999
    echo $e->getMethod();     // e.g. GET
    echo $e->getResponseBody();
} catch (WeblingReadonlyException $e) {
    // Thrown if write is attempted on read-only resources (e.g. letters)
} catch (WeblingConfigurationException $e) {
    // Thrown if domain or API key is missing
}
```

---

Testing
-------

[](#testing)

Mocking requests is simple by swapping the bound Client singleton instance:

```
use Webling\API\Client;
use Webling\API\Response;

$mockClient = Mockery::mock(Client::class);
$mockClient->shouldReceive('get')->with('member/123')->andReturn(new Response(200, '{"id":123}'));

$this->app->instance(Client::class, $mockClient);
```

Run test suite:

```
composer test
```

References
----------

[](#references)

- [Webling REST API documentation](https://demo.webling.ch/api)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

↑

LowBetter than 21% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 60.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5105a5704a356702d32397a46feec95e249690f3d13fb3bd8a6a6dd7fd995f39?d=identicon)[sarfrazrizwan](/maintainers/sarfrazrizwan)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (390 commits)")[![mvdnbrk](https://avatars.githubusercontent.com/u/802681?v=4)](https://github.com/mvdnbrk "mvdnbrk (46 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (35 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (23 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (21 commits)")[![pforret](https://avatars.githubusercontent.com/u/474312?v=4)](https://github.com/pforret "pforret (16 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (14 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (12 commits)")[![riasvdv](https://avatars.githubusercontent.com/u/3626559?v=4)](https://github.com/riasvdv "riasvdv (10 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (10 commits)")[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (8 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (8 commits)")[![irfanm96](https://avatars.githubusercontent.com/u/42065936?v=4)](https://github.com/irfanm96 "irfanm96 (5 commits)")[![thecaliskan](https://avatars.githubusercontent.com/u/13554944?v=4)](https://github.com/thecaliskan "thecaliskan (5 commits)")[![IGedeon](https://avatars.githubusercontent.com/u/694313?v=4)](https://github.com/IGedeon "IGedeon (4 commits)")[![ziming](https://avatars.githubusercontent.com/u/679513?v=4)](https://github.com/ziming "ziming (3 commits)")[![jessarcher](https://avatars.githubusercontent.com/u/4977161?v=4)](https://github.com/jessarcher "jessarcher (3 commits)")[![koossaayy](https://avatars.githubusercontent.com/u/6431084?v=4)](https://github.com/koossaayy "koossaayy (3 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (3 commits)")[![maartenpaauw](https://avatars.githubusercontent.com/u/4550875?v=4)](https://github.com/maartenpaauw "maartenpaauw (3 commits)")

### Embed Badge

![Health badge](/badges/sarfrazrizwan-laravel-webling/health.svg)

```
[![Health](https://phpackages.com/badges/sarfrazrizwan-laravel-webling/health.svg)](https://phpackages.com/packages/sarfrazrizwan-laravel-webling)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M19](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k12](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
