PHPackages                             rs/builder-api - 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. rs/builder-api

ActiveLibrary[API Development](/categories/api)

rs/builder-api
==============

Make API calls to Builder

v1.0.6(1y ago)03.4kMITPHPPHP ^8.0

Since Feb 9Pushed 1y ago3 watchersCompare

[ Source](https://github.com/RedSnapper/builder-api)[ Packagist](https://packagist.org/packages/rs/builder-api)[ RSS](/packages/rs-builder-api/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (3)Versions (9)Used By (0)

Builder API
===========

[](#builder-api)

---

A Laravel package for querying the Builder API

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

[](#installation)

You can install the package via composer:

```
composer require rs/builder-api
```

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

[](#configuration)

By default, the API client will attempt to find settings from the following environment variables

```
# .env

BUILDER_SITE_NAME=sitename # the name of the site in Builder
BUILDER_PUBLISHED=true # whether to query the published or unpublished data of the Builder site (defaults to true if not defined)
BUILDER_API_USER=builderuser
BUILDER_API_KEY=key-123
```

Alternatively, you can publish the config file and define your settings there:

```
php artisan vendor:publish --provider="RedSnapper\Builder\BuilderApiServiceProvider" --tag="config"
```

```
# config/builder-api.php

return [
    'site'       => 'sitename',
    'published'  => true,
    'user'       => 'builderuser',
    'password'   => 'key-123',
];
```

Authorisation
-------------

[](#authorisation)

If you provide both a user and password then basic authentication will be attempted.

Alternatively you can provide just a user - this will add an `X-USER` header to the request. This will only work if your application lives on the same network as the Builder instance

Usage
-----

[](#usage)

You can use the `BuilderApi` facade to create a `PendingRequest`. You can overwrite any configuration using the fluent methods available on this object.

```
$pendingRequest = BuilderApi::new();
$pendingRequest->forSite('sitename')
    ->withAuth('builderuser', 'key-123')
    ->unpublished()
    ->get('apiPages');
```

To make a GET request provide the Builder macro name and optionally provide parameters as a second argument.

```
 $response = $pendingRequest->forSite('sitename')->get('apiPages', ['foo', 'bar']);
```

You can also make a request directly with the facade. This will make use of the configuration defined in your config file or environment variables

```
$response = BuilderApi::get('apiPages'); // returns BuilderResponse object
```

If you don't want to use the facade, you can type-hint the `BuilderRequestFactory` class in your constructor methods or use `app()->make()`

```
use RedSnapper\Builder\BuilderRequestFactory;

    public function __construct(BuilderRequestFactory $factory)
    {
        $this->factory = $factory;

        # or...
        $factory = app()->make(BuilderRequestFactory::class);

        $pendingRequest = $factory->new();
        $response = $pendingRequest->get('apiPages');
    }
```

When a request is made a `BuilderResponse` object is returned, this provides methods for retrieving the Builder data or Builder error messages on a failed request.

```
 $data = $response->data(); # get json decoded data

 if($response->failed()) {
    $errorMsg = $response->errorMsg();
 }
```

Below is the full list of methods provided to help you analyse the response

```
$response->data();

$response->successful();

$response->failed();

$response->errorMsg(); # error msg provided by Builder

$response->status(); # status code of the response

$response->throw(); # throw an exception if a server or client error occurred

$response->getResponse(); # get the underlying 'Illuminate\Http\Client\Response' object
```

Testing
-------

[](#testing)

```
vendor/bin/phpunit
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.MD) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.MD) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [Licence File](LICENCE.MD) for more information.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

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

Every ~154 days

Recently: every ~186 days

Total

7

Last Release

670d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6851104?v=4)[rstechnical](/maintainers/rstechnical)[@rstechnical](https://github.com/rstechnical)

---

Top Contributors

[![joeuk89](https://avatars.githubusercontent.com/u/6736852?v=4)](https://github.com/joeuk89 "joeuk89 (17 commits)")[![cammackmatthew](https://avatars.githubusercontent.com/u/10643740?v=4)](https://github.com/cammackmatthew "cammackmatthew (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rs-builder-api/health.svg)

```
[![Health](https://phpackages.com/badges/rs-builder-api/health.svg)](https://phpackages.com/packages/rs-builder-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

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

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

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

PHPackages © 2026

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