PHPackages                             aslaluroba/babylai\_php\_auth\_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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. aslaluroba/babylai\_php\_auth\_client

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

aslaluroba/babylai\_php\_auth\_client
=====================================

A simple PHP client for BabylAI Auth API (get client token)

v1.0.0(11mo ago)00MITPHPPHP &gt;=7.4

Since Jun 4Pushed 8mo agoCompare

[ Source](https://github.com/AslAlUroba/babylai-php-auth-client)[ Packagist](https://packagist.org/packages/aslaluroba/babylai_php_auth_client)[ RSS](/packages/aslaluroba-babylai-php-auth-client/feed)WikiDiscussions main Synced 1mo ago

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

BabylAI PHP Auth Client
=======================

[](#babylai-php-auth-client)

A simple PHP library to fetch a client token from the [BabylAI Auth API](https://babylai.net). It wraps a single endpoint:

```
POST https://babylai.net/api/Auth/client/get-token

```

by accepting a Tenant ID (UUID) and API key, returning a JSON payload containing `token` and `expiresIn`.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
    - [Standalone PHP Example](#standalone-php-example)
    - [Laravel Integration](#laravel-integration)
- [Configuration](#configuration)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- **PSR-4 autoloading**: simply `require` via Composer.
- **Guzzle-powered**: uses [Guzzle HTTP](https://github.com/guzzle/guzzle) under the hood.
- **Lightweight**: only two DTO classes plus the client wrapper.
- **Error handling**: throws an exception if the HTTP request fails or the response is invalid.

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

[](#requirements)

- PHP &gt;= 7.4
- `ext-curl` / `ext-openssl` enabled (for HTTPS)
- [Guzzle 7.x](https://packagist.org/packages/guzzlehttp/guzzle) (installed via Composer)

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

[](#installation)

1. **Ensure you have Composer installed** on your system:

    ```
    composer --version
    ```
2. **Require this package**

    ```
    composer require aslaluroba/babylai_php_auth_client
    ```

    This will pull in Guzzle as well and configure PSR-4 autoloading for BabylAI\* classes.
3. **Verify that vendor/aslaluroba/babylai\_php\_auth\_client exists and that vendor/autoload.php was updated.**

Usage
-----

[](#usage)

Below are two common ways to use this client:

### Standalone PHP Example

[](#standalone-php-example)

Create a simple test.php in any folder outside Laravel:

```
