PHPackages                             strawblond/strawblond-php-sdk - 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. strawblond/strawblond-php-sdk

ActiveLibrary[API Development](/categories/api)

strawblond/strawblond-php-sdk
=============================

PHP library for the StrawBlond API

v1.0.0(2y ago)23MITPHP

Since Dec 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/strawblond/strawblond-php-sdk)[ Packagist](https://packagist.org/packages/strawblond/strawblond-php-sdk)[ RSS](/packages/strawblond-strawblond-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

StrawBlond PHP SDK
==================

[](#strawblond-php-sdk)

The StrawBlond PHP SDK provides convenient access to the StrawBlond API for PHP applications.

Requirements
------------

[](#requirements)

- PHP 8.1 and later

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

[](#installation)

You can install the library via Composer:

```
composer require strawblond/strawblond-php-sdk
```

Getting started
---------------

[](#getting-started)

Basic usage looks something like this:

```
// Initialize a new SDK client using your API key
$api = new StrawBlond\StrawBlond('YOUR_API_KEY');

// Retrieve an invoice
$invoice = $api->invoice()->get('jDe2KdWYK4')->json();

// Get all paid invoices and include their contact and company relations
$invoices = $api->invoice()->all(
    filters: ['status' => 'paid'],
    include: ['contact.company'],
)->json('data');

// Create a new contact
$contact = $api->contact()->create([
    'firstname' => 'Max',
    'lastname' => 'Muster',
    'email' => 'max@muster.com'
])->json();
```

The StrawBlond API uses personal API keys to authenticate incoming requests. You can view and manage your API keys in the [User Settings](https://app.strawblond.com/user/integrations). Your API keys carry the same permissions as your regular user account, so be sure to keep them secure!

Important

An API key acts as your user in a specific organization. You cannot access multiple organizations with a single key.

Resources
---------

[](#resources)

The SDK gives you access to all resources documented on .

```
$api = new StrawBlond\StrawBlond('YOUR_API_KEY');

// CRUD resources
$api->contact();
$api->company();
$api->project();
$api->timeTracking();
$api->invoice();
$api->offer();
$api->documentElement();
$api->product();
$api->rate();
$api->unit();

// Special resources
$api->user();
$api->member();
$api->webhook();
```

### Available methods

[](#available-methods)

All CRUD resources give you at least following request methods to call:

DescriptionMethodRetrieve a single resource`get(string $id)`Get a list of resources`all(array $filters, array $include, string $sort, int $page)`Create a resource`create(array $data)`Update a resource`update(string $id, array $changes)`Delete a resource`delete(string $id)`Consult our documentation at  for resources that expose additional methods (like `send()` on invoices and offers).

Usage
-----

[](#usage)

Start by sending a request using one of the methods available on the resource. In this example we're trying to fetch a single invoice given a invoice ID. The `get` method returns a `Response` object.

```
$response = $api->invoice()->get('jDe2KdWYK4');
```

We can now check if the request was successful and use the fetched data in various ways:

```
if ($response->ok()) {
    // Get the response data as an json decoded array
    $invoice = $response->json();

    // Same as `json` but gets a single value from the data
    $dueDate = $response->json('due_at');

    // Get the response data as a Laravel Collection.
    // ! Requires `illuminate/collections` to be installed
    $lineItems = $response->collect('elements');
}
```

Here's another example for creating a new contact:

```
$contact = $api->contact()->create([
    'firstname' => 'Max',
    'lastname' => 'Muster',
    'email' => 'max@muster.com'
])->json();
```

See [Responses](#responses) for more methods on the `Response` object.

### Filtering

[](#filtering)

When calling the `all` method on a resource, you may pass an `filters` array to the method. (See the API reference on  for which filters are allowed on a given resource)

```
$projects = $api->project()->all(
    filters: [
        'status' => 'active',
        'billing_type' => 'flat'
    ],
)->json('data');
```

### Sorting

[](#sorting)

When calling the `all` method on a resource, you may pass a `sort` key to the method. (See the API reference on  for which sort keys are allowed on a given resource)

```
$projects = $api->project()->all(
    sort: 'starts_at'
)->json('data');
```

Sorting is **ascending by default** and can be reversed by adding a hyphen (**-**) to the start of the property name.

```
$projects = $api->project()->all(
    sort: '-starts_at'
)->json('data');
```

### Including relations

[](#including-relations)

When calling the `get` or `all` method on a resource, you may pass an `include` array to include related resources. (See the API reference on  for which resources are allowed to be included in a request)

```
$projects = $api->project()->all(
    include: ['company', 'user']
)->json('data');
```

You may also use the dot notation to include nested relations ()

### Pagination

[](#pagination)

The `all` method on most resources returns a paginated list of objects inside a `data` property. The `links` and `meta` properties contain information useful for retrieving more pages.

You can set the page using the `page` argument.

```
$projects = $api->project()->all(
    page: 2,
)->json('data');
```

Responses
---------

[](#responses)

After sending a request, the StrawBlond SDK resource will return a `Response` class. This response class contains many helpful methods for interacting with your HTTP response like seeing the HTTP status code and retrieving the body.

```
$response = $api->invoice()->get('jDe2KdWYK4');

$response->status() // Returns the response status code
$response->headers() // Returns all response headers
$response->header('X-Something') // Returns a given header
$response->body() // Returns the raw response body as a string
$response->json() // Retrieves a JSON response body and json_decodes it into an array.
$response->collect() // Retrieves a JSON response body and json_decodes it into a Laravel Collection. Requires `illuminate/collections`.
$response->object() // Retrieves a JSON response body and json_decodes it into an object.

// Methods used to determine if a request was successful or not based on status code.
$response->ok();
$response->successful();
$response->redirect();
$response->failed();
$response->clientError();
$response->serverError();

// Will throw an exception if the response is considered "failed".
$response->throw();
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

878d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/218c6d8b335e0e4feced7d6273c997ce6d0ce6358ac105798352dd74be00c408?d=identicon)[jschwendener](/maintainers/jschwendener)

---

Top Contributors

[![jschwendener](https://avatars.githubusercontent.com/u/10193428?v=4)](https://github.com/jschwendener "jschwendener (9 commits)")

### Embed Badge

![Health badge](/badges/strawblond-strawblond-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/strawblond-strawblond-php-sdk/health.svg)](https://phpackages.com/packages/strawblond-strawblond-php-sdk)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

765.7M124](/packages/saloonphp-laravel-plugin)[saloonphp/rate-limit-plugin

Handle rate limits beautifully in your Saloon API integrations or SDKs

201.3M43](/packages/saloonphp-rate-limit-plugin)[myoutdeskllc/salesforce-php

salesforce library for php8+

1560.8k](/packages/myoutdeskllc-salesforce-php)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[sandorian/moneybird-api-php

Moneybird API client for PHP

127.3k](/packages/sandorian-moneybird-api-php)

PHPackages © 2026

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