PHPackages                             bridgekit-tools/bridgekit-lib - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. bridgekit-tools/bridgekit-lib

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

bridgekit-tools/bridgekit-lib
=============================

A Laravel library for managing third-party provider integrations (Google, Microsoft, Meta, LinkedIn, X)

v1.3.0(2mo ago)561MITPHPPHP ^8.2

Since Apr 1Pushed 2mo agoCompare

[ Source](https://github.com/bridgekit-tools/bridgekit-lib)[ Packagist](https://packagist.org/packages/bridgekit-tools/bridgekit-lib)[ RSS](/packages/bridgekit-tools-bridgekit-lib/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependencies (8)Versions (5)Used By (0)

 [![BridgeKit](https://raw.githubusercontent.com/bridgekit-tools/bridgekit-lib/main/.github/logo.svg)](https://raw.githubusercontent.com/bridgekit-tools/bridgekit-lib/main/.github/logo.svg)

BridgeKit
=========

[](#bridgekit)

 **Universal Laravel Integration Library**
 One library to connect Google, Microsoft, Meta, LinkedIn &amp; X.

 [![Latest Version](https://camo.githubusercontent.com/0586fd98a70e25914553aa4a40e6835c42d85f3d4bc94373adb0b911bb08409c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6272696467656b69742d746f6f6c732f6272696467656b69742d6c69622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bridgekit-tools/bridgekit-lib) [![Total Downloads](https://camo.githubusercontent.com/f14e68329093a59bdd0dfe9b19983216bb3ebcb539a5a4db0c59e369d223ddea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6272696467656b69742d746f6f6c732f6272696467656b69742d6c69622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bridgekit-tools/bridgekit-lib) [![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE) [![Tests](https://camo.githubusercontent.com/24f638c938f7dfae77140cbb83da8451d98c05b74d7b0a28d9fc42e9668edd09/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6272696467656b69742d746f6f6c732f6272696467656b69742d6c69622f74657374732e796d6c3f7374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://github.com/bridgekit-tools/bridgekit-lib/actions)

---

What is BridgeKit?
------------------

[](#what-is-bridgekit)

BridgeKit is a Laravel library that provides a **unified, typed API** for integrating with third-party providers. Instead of learning 5 different SDKs, you learn one interface.

```
use BridgeKit\Facades\BridgeKit;

// Google Drive
$files = BridgeKit::google()->setToken($token)->drive()->listFiles();

// Microsoft OneDrive — same interface
$files = BridgeKit::microsoft()->setToken($token)->onedrive()->listFiles();

// Post to LinkedIn with media
$result = BridgeKit::linkedin()->setToken($token)->posts()->publish(
    new SocialPost(
        content: 'Hello from BridgeKit!',
        media: [MediaContent::fromUrl('https://example.com/photo.jpg')],
    )
);
```

Features
--------

[](#features)

- **5 providers** — Google, Microsoft, Meta, LinkedIn, X
- **15 services** — Drive, OneDrive, Gmail, Outlook, Calendar (×2), Posts (×3), OAuth (×5)
- **6 contracts** — Swap providers without changing your code
- **Typed DTOs** — `final readonly` classes with `JsonSerializable`
- **7 enums** — `Provider`, `MediaType`, `Visibility`, `EventStatus`, `MailFolder`, `OAuthGrantType`, `ServiceType`
- **Streaming** — Zero-memory downloads via `downloadStream()`
- **Chunked uploads** — Resumable uploads for files of any size
- **Lazy generators** — Memory-efficient paginated listing
- **Media support** — Upload images &amp; videos from URL, path, or binary
- **PKCE** — Built-in for X/Twitter OAuth 2.0
- **Extensible** — Register custom providers via `extend()`

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

[](#requirements)

- PHP 8.3+
- Laravel 13+

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

[](#installation)

```
composer require bridgekit-tools/bridgekit-lib
```

The service provider and facade are auto-discovered. Publish the config:

```
php artisan vendor:publish --tag=bridgekit-config
```

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

[](#configuration)

Add credentials to your `.env`:

```
# Google
BRIDGEKIT_GOOGLE_CLIENT_ID=
BRIDGEKIT_GOOGLE_CLIENT_SECRET=
BRIDGEKIT_GOOGLE_REDIRECT_URI=

# Microsoft
BRIDGEKIT_MICROSOFT_CLIENT_ID=
BRIDGEKIT_MICROSOFT_CLIENT_SECRET=
BRIDGEKIT_MICROSOFT_REDIRECT_URI=
BRIDGEKIT_MICROSOFT_TENANT=common

# Meta
BRIDGEKIT_META_CLIENT_ID=
BRIDGEKIT_META_CLIENT_SECRET=
BRIDGEKIT_META_REDIRECT_URI=

# LinkedIn
BRIDGEKIT_LINKEDIN_CLIENT_ID=
BRIDGEKIT_LINKEDIN_CLIENT_SECRET=
BRIDGEKIT_LINKEDIN_REDIRECT_URI=

# X (Twitter)
BRIDGEKIT_X_CLIENT_ID=
BRIDGEKIT_X_CLIENT_SECRET=
BRIDGEKIT_X_REDIRECT_URI=
```

Quick Start
-----------

[](#quick-start)

### OAuth Flow

[](#oauth-flow)

```
// 1. Redirect to consent screen
$url = BridgeKit::google()->auth()->getAuthorizationUrl([
    'https://www.googleapis.com/auth/drive.readonly',
]);
return redirect($url);

// 2. Handle callback
$token = BridgeKit::google()->auth()->handleCallback($request->code);

// 3. Use services
$google = BridgeKit::google()->setToken($token);
$files = $google->drive()->listFiles();
$events = $google->calendar()->listEvents();
```

### File Storage

[](#file-storage)

```
$drive = BridgeKit::google()->setToken($token)->drive();

$files = $drive->listFiles();
$file = $drive->uploadFile('doc.txt', 'Hello world', 'text/plain');
$stream = $drive->downloadStream('file-id');

// Large file upload (chunked, resumable)
$file = $drive->uploadLargeFile('backup.zip', '/path/to/file.zip', 'application/zip');

// Memory-efficient listing
foreach ($drive->listFilesLazy() as $file) {
    echo $file->name;
}
```

### Folders &amp; files as a tree

[](#folders--files-as-a-tree)

Every storage provider exposes `listTree()` which returns a recursive `StorageTreeNode`. It can be JSON-serialised, walked depth-first, or rendered as ASCII for logs/debug output.

```
$tree = BridgeKit::s3()->storage()->listTree('photos/', [
    'max_depth' => 3,
    'include_files' => true,
]);

echo $tree->toAscii();
// photos/
// ├── 2025/
// │   ├── team.jpg
// │   └── trip.jpg
// └── logo.png

echo $tree->countDescendants(); // 4
echo $tree->totalSize();        // cumulative bytes

foreach ($tree->walk() as $node) {
    if ($node->isFile()) {
        echo $node->file->webUrl;
    }
}
```

### SharePoint document libraries

[](#sharepoint-document-libraries)

```
$sp = BridgeKit::microsoft()->setToken($token)->sharepoint([
    'site_path' => '/contoso.sharepoint.com:/sites/marketing',
    // 'drive_id' => '...', // optional, defaults to the site's Documents library
]);

$tree = $sp->listTree();
$file = $sp->uploadLargeFile('campaign.pdf', '/local/campaign.pdf', 'application/pdf');
$libraries = $sp->listLibraries();
```

Required Graph scopes (delegated): `Sites.Read.All`, `Files.ReadWrite.All`.

### Social Publishing

[](#social-publishing)

```
use BridgeKit\DTOs\{SocialPost, MediaContent};
use BridgeKit\Enums\Visibility;

$result = BridgeKit::x()->setToken($token)->posts()->publish(
    new SocialPost(
        content: 'Posted via BridgeKit!',
        media: [
            MediaContent::fromUrl('https://example.com/photo.jpg', altText: 'A photo'),
            MediaContent::fromPath('/local/video.mp4'),
        ],
        visibility: Visibility::Public,
    )
);

echo $result->url;
```

### Email

[](#email)

```
use BridgeKit\DTOs\EmailMessage;

BridgeKit::google()->setToken($token)->gmail()->send(new EmailMessage(
    subject: 'Welcome',
    body: 'Hello!',
    to: ['user@example.com'],
    isHtml: true,
));
```

### Calendar

[](#calendar)

```
use BridgeKit\DTOs\CalendarEvent;

$event = BridgeKit::google()->setToken($token)->calendar()->createEvent(
    new CalendarEvent(
        title: 'Team Standup',
        startAt: new DateTimeImmutable('2026-04-01T09:00:00'),
        endAt: new DateTimeImmutable('2026-04-01T09:30:00'),
        timezone: 'Europe/Paris',
        attendees: ['alice@company.com'],
    )
);
```

### Custom Providers

[](#custom-providers)

```
use BridgeKit\Support\AbstractProvider;

class DropboxProvider extends AbstractProvider
{
    public function getName(): string { return 'dropbox'; }
    // ... implement services
}

// Register
BridgeKit::extend('dropbox', DropboxProvider::class);
```

Available Services
------------------

[](#available-services)

ProviderStorageEmailCalendarSocialOAuthGoogle`drive()``gmail()``calendar()`—`auth()`Microsoft`onedrive()`, `sharepoint()``outlook()``calendar()`—`auth()`Meta———`posts()``auth()`LinkedIn———`posts()``auth()`X———`posts()``auth()`Dropbox`storage()`———`auth()`S3 (AWS, MinIO, R2, …)`storage()`————FTP / FTPS`storage()`————SFTP`storage()`————Architecture
------------

[](#architecture)

```
src/
├── Contracts/          # Interfaces (FileStorage, Email, Calendar, Social, OAuth)
├── DTOs/               # Typed value objects (OAuthToken, StorageFile, MediaContent, ...)
├── Enums/              # Provider, MediaType, Visibility, EventStatus, ...
├── Exceptions/         # BridgeKitException, AuthenticationException, ...
├── Providers/          # Google, Microsoft, Meta, LinkedIn, X
│   └── */Services/     # Concrete implementations
├── Support/            # AbstractProvider, AbstractService, ConnectManager
├── Concerns/           # HasHttpClient trait
├── Facades/            # BridgeKit facade
└── BridgeKitServiceProvider.php

```

Testing
-------

[](#testing)

```
composer test
```

101 tests, 276 assertions.

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for recent changes.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE) for details.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance87

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Every ~8 days

Total

4

Last Release

65d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/46071ff41a6620ef4019427bf6338efb59394b4f6342e9879cef0541df4cc878?d=identicon)[AkramZerarka](/maintainers/AkramZerarka)

---

Top Contributors

[![AkramZerarka](https://avatars.githubusercontent.com/u/14928910?v=4)](https://github.com/AkramZerarka "AkramZerarka (7 commits)")

---

Tags

laravelgoogleoauthmicrosoftsocialintegrationmetalinkedingmaildrive

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bridgekit-tools-bridgekit-lib/health.svg)

```
[![Health](https://phpackages.com/badges/bridgekit-tools-bridgekit-lib/health.svg)](https://phpackages.com/packages/bridgekit-tools-bridgekit-lib)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M846](/packages/laravel-socialite)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M131](/packages/laravel-mcp)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2795.3M3](/packages/auth0-login)[kovah/laravel-socialite-oidc

OpenID Connect OAuth2 Provider for Laravel Socialite

24110.5k](/packages/kovah-laravel-socialite-oidc)

PHPackages © 2026

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