PHPackages                             kirschbaum-development/bee-plugin-php-client - 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. kirschbaum-development/bee-plugin-php-client

AbandonedArchivedLibrary[API Development](/categories/api)

kirschbaum-development/bee-plugin-php-client
============================================

PHP client to interact with Bee's plugin API

0.3.1(4y ago)3163.4k1MITPHPPHP ^7.1|^8.0CI passing

Since Aug 22Pushed 10mo ago11 watchersCompare

[ Source](https://github.com/kirschbaum-development/bee-plugin-php-client)[ Packagist](https://packagist.org/packages/kirschbaum-development/bee-plugin-php-client)[ Docs](https://github.com/kirschbaum-development/bee-plugin-php-client)[ RSS](/packages/kirschbaum-development-bee-plugin-php-client/feed)WikiDiscussions master Synced 6d ago

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

Bee Plugin PHP Client
=====================

[](#bee-plugin-php-client)

[![](https://raw.githubusercontent.com/kirschbaum-development/bee-plugin-php-client/master/banner.png)](https://raw.githubusercontent.com/kirschbaum-development/bee-plugin-php-client/master/banner.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/efcdaa65f2d7249577ffe5fc9314719f604378bf061829519ca5b347fac1c405/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b69727363686261756d2d646576656c6f706d656e742f6265652d706c7567696e2d7068702d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kirschbaum-development/bee-plugin-php-client)[![Actions Status](https://github.com/kirschbaum-development/bee-plugin-php-client/workflows/CI/badge.svg)](https://github.com/kirschbaum-development/bee-plugin-php-client/actions)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![StyleCI](https://camo.githubusercontent.com/d7b662b4214dce4b2612e212002ddd1909aaa7e870467d14fa2811c38a7b864d/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3230323831323431382f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/202812418)[![Total Downloads](https://camo.githubusercontent.com/8fd5c3fa912ccf3d55779e59ede2c04e1b930ec5af0727407bc71e0e8f39f281/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b69727363686261756d2d646576656c6f706d656e742f6265652d706c7567696e2d7068702d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kirschbaum-development/bee-plugin-php-client)

PHP client to interact with Bee's plugin API. This includes the [Message Services API](https://docs.beefree.io/message-services-api-reference/) and a convenient way to use [authorization](https://docs.beefree.io/authorization-process/).

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

[](#installation)

You can install the package via composer:

```
composer require kirschbaum-development/bee-plugin-php-client
```

Usage
-----

[](#usage)

First thing you will need is to instantiate the `Bee` base class and setup the API token. You can grab the API token by logging in into the [Developer portal](https://developers.beefree.io) and going to the "details" of your application.

```
use KirschbaumDevelopment\Bee\Bee;

$bee = new Bee(new \GuzzleHttp\Client);
$bee->setApiToken('your-api-token-here');
```

### Using Message Services API: HTML

[](#using-message-services-api-html)

This API allows you to post the JSON content generated on the Bee editor, and it will return the rendered HTML of the JSON. Reference:

```
$beeEditorData = []; // this will be the JSON generated using the editor
$html = $bee->html($beeEditorData);
```

### Using Message Services API: PDF

[](#using-message-services-api-pdf)

This API allows you to post the HTML content and get an URL with a PDF created from the HTML. Reference:

```
$pdf = $bee->pdf([
    'html' => $html, // HTML generated using the HTML API (required)
    'page_size' => 'Letter', // (optional)
    'page_orientation' => 'Landscape', // (optional)
]);

// then, you can call these methods:
$pdf->getUrl();
$pdf->getFilename();
$pdf->getPageSize();
$pdf->getPageOrientation();
$pdf->getContentType();
```

### Using Message Services API: Image

[](#using-message-services-api-image)

This API allows you to post the HTML content and get an URL with a PDF created from the HTML. Reference:

```
$image = $bee->image([
    'html' => $html, // HTML generated using the HTML API (required)
    'width' => 500, // (required)
    'height' => 400, // (optional)
    'file_type' => 'jpg',
]);

// then, you can save the image content somewhere, some examples on how you may do this:
file_put_contents('/path/to/storage/image.jpg', $image);

// on Laravel with Storage object:
Storage::put('/path/to/storage/image.jpg', $image);
```

Generating access token
-----------------------

[](#generating-access-token)

To initialize Bee Editor you may need an access token. You can use `BeeAuth` to easily generate that. You can grab the Client ID and Secret by logging in into the [Developer portal](https://developers.beefree.io) and going to the "details" of your application.

```
use KirschbaumDevelopment\Bee\BeeAuth;

$beeAuth = new BeeAuth(new \GuzzleHttp\Client);
$beeAuth->setClientId('your-client-id-here');
$beeAuth->setClientSecret('your-client-secret-here');
$token = $beeAuth->generateToken();

// then you can use the following methods:
$token->getAccessToken();
$token->getRefreshToken();
$token->getExpiresIn();
```

Auth tokens are valid for 5 minutes. If you want to cache your tokens for as long as possible, you will need to pass a [PSR-16](https://www.php-fig.org/psr/psr-16/) compatible cache implementation. Laravel, Symfony and all major frameworks are already compatible with this interface. To enable the cache, you only need to call the `setCache` method passing a `Psr\SimpleCache\CacheInterface` implementation.

```
$beeAuth->setCache($cacheImplementation);
```

Usage with Laravel
------------------

[](#usage-with-laravel)

If you use Laravel, `BeePluginServiceProvider` will be auto-registered if you use Laravel package discovery. Otherwise, you can manually register the following provider:

```
'providers' => [
    // ...
    KirschbaumDevelopment\Bee\Laravel\BeePluginServiceProvider::class,
],
```

This will make sure that any time you ask Laravel for `KirschbaumDevelopment\Bee\Bee` or `KirschbaumDevelopment\Bee\BeeAuth` using the Laravel container (e.g. `app(Bee::class)`), Guzzle will be automatically injected and also the API token and Client ID/Secret will be injected into the classes.

The config values will be extracted from the following config: `.services.bee`. So, we'll use the following conventions:

API Token: `config('services.bee.api_token')`Client ID: `config('services.bee.client_id')`Client Secret: `config('services.bee.client_secret')`

If you don't want to use this config, you can always pass the values manually.

### Caching with Laravel

[](#caching-with-laravel)

Laravel service provider will also automatically inject Laravel's cache implementation on `BeeAuth`, so your auth tokens will be cached for as long as possible.

### Testing with Laravel

[](#testing-with-laravel)

If you are writing integration tests, but don't want your tests making requests to Bee to get credentials, we have a little helper that can help you. Just run the following code:

```
use KirschbaumDevelopment\Bee\Laravel\BeeAuthMock;

BeeAuthMock::init();
```

With this, any time you call `BeeAuth::generateToken()` in your code you will receive the same response you would receive, but with some fake tokens and without making any HTTP requests.

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  or  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Luis Dalmolin](https://github.com/luisdalmolin)

Sponsorship
-----------

[](#sponsorship)

Development of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more [about us](https://kirschbaumdevelopment.com) or [join us](https://careers.kirschbaumdevelopment.com)!

License
-------

[](#license)

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

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance40

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.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 ~126 days

Recently: every ~221 days

Total

8

Last Release

1574d ago

PHP version history (2 changes)0.1.0PHP ^7.1

0.3.1PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/57e405b52d482c9de35b17f299d2745e8e68d9d9951aec64854f2d7fa53110bf?d=identicon)[luisdalmolin](/maintainers/luisdalmolin)

![](https://www.gravatar.com/avatar/5f56743d64d77958321d43b2df49e9696d19c9dd99995730c5c38ccae50408fa?d=identicon)[Kirschbaum](/maintainers/Kirschbaum)

---

Top Contributors

[![luisdalmolin](https://avatars.githubusercontent.com/u/403446?v=4)](https://github.com/luisdalmolin "luisdalmolin (28 commits)")[![therobfonz](https://avatars.githubusercontent.com/u/35386780?v=4)](https://github.com/therobfonz "therobfonz (3 commits)")[![jeffwray](https://avatars.githubusercontent.com/u/164155?v=4)](https://github.com/jeffwray "jeffwray (2 commits)")

---

Tags

kirschbaum-developmentbee-plugin-php-client

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kirschbaum-development-bee-plugin-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/kirschbaum-development-bee-plugin-php-client/health.svg)](https://phpackages.com/packages/kirschbaum-development-bee-plugin-php-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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