spatie/laravel-float-sdk

A Laravel SDK for the Float.com API

0.0.2 2025-02-28 08:42 UTC

This package is auto-updated.

Last update: 2025-02-28 09:16:11 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a seamless integration with the Float.com API for Laravel applications.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require spatie/laravel-float-sdk

Add the following environment variables to your .env file:

FLOAT_API_TOKEN=your_api_token_here
FLOAT_USER_AGENT=YourAppName (your-email@example.com)

You can publish the config file with:

php artisan vendor:publish --tag="float-sdk-config"

This is the contents of the published config file:

return [
    'api_token' => env('FLOAT_API_TOKEN'),
    'user_agent' => env('FLOAT_USER_AGENT'),
];

Usage

Making API Requests

You can use the FloatClient to interact with the Float API. Here's an example of fetching all users:

use Spatie\FloatSdk\FloatClient;
use Spatie\FloatSdk\Requests\GetUsers;

public function execute(FloatClient $client)
{
    $users = $client->users()->all();

    foreach ($users as $user) {
        echo $user->name;
    }
}

Using the Facade

use Spatie\FloatSdk\Facades\Float;

$users = Float::users()->all();

foreach ($users as $user) {
    echo $user->name;
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.