Download the PHP package lanos/php-bfl without Composer

On this page you can find all versions of the php package lanos/php-bfl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-bfl

PHP Black Forest Labs SDK

A professional PHP SDK for Black Forest Labs' FLUX API, providing easy integration for AI-powered image generation and fine-tuning services.

Latest Version PHP Version License Tests Coverage Status

Features

Installation

Install via Composer:

Quick Start

API Key Setup

  1. Sign up at Black Forest Labs
  2. Get your API key from the dashboard
  3. Set it as an environment variable or pass it directly to the client:

Core Services

The SDK is organized into three main services:

Image Generation Service

Generate images using various FLUX models:

Advanced Image Operations

Fine-tuning Service

Train custom models and use them for generation:

Utility Service

Handle task polling and result retrieval:

Request Builder

Use the fluent builder pattern for complex requests:

Error Handling

The SDK provides comprehensive error handling:

Response Objects

All responses are returned as typed objects:

Configuration Options

Customize the HTTP client:

Best Practices

1. Always Handle Async Operations

2. Use Appropriate Safety Tolerance

3. Optimize Image Dimensions

4. Handle Rate Limits

Examples

See the examples/ directory for complete working examples:

Complete API Reference

This section provides comprehensive documentation for all available SDK methods and endpoints.

FluxClient

The main client class providing access to all services.

Constructor

Parameters:

Service Access Methods


ImageGeneration Service

Access via $client->imageGeneration(). Handles all image generation operations.

Core Generation Methods

flux1Pro(Flux1ProRequest $request): ImageGenerationResponse

Generate images with FLUX1 Pro model - highest quality, balanced performance.

Endpoint: POST /flux-pro

Parameters: Use ImageRequestBuilder to construct the request object.

Example:

flux1Dev(array $params): ImageGenerationResponse

Generate images with FLUX1 Dev model - development model, faster generation.

Endpoint: POST /flux-dev

Parameters:

Example:

flux11Pro(array $params): ImageGenerationResponse

Generate images with FLUX 1.1 Pro model - improved quality and performance.

Endpoint: POST /flux-pro-1.1

Parameters:

flux11ProUltra(array $params): ImageGenerationResponse

Generate images with FLUX 1.1 Pro Ultra model - highest quality available.

Endpoint: POST /flux-pro-1.1-ultra

Parameters:

Example:

Contextual Generation Methods

fluxKontextPro(array $params): ImageGenerationResponse

Edit or create images with Flux Kontext Pro.

Endpoint: POST /flux-kontext-pro

fluxKontextMax(array $params): ImageGenerationResponse

Edit or create images with Flux Kontext Max.

Endpoint: POST /flux-kontext-max

Image Editing Methods

flux1Fill(array $params): ImageGenerationResponse

Fill/inpaint specific areas of an image using FLUX1 Fill Pro.

Endpoint: POST /flux-pro-1.0-fill

Required Parameters:

Optional Parameters:

Example:

flux1Expand(array $params): ImageGenerationResponse

Expand an image by adding pixels on any side.

Endpoint: POST /flux-pro-1.0-expand

Required Parameters:

Optional Parameters:

Example:

Control Methods

flux1Canny(array $params): ImageGenerationResponse

Generate images using Canny edge detection as control guidance.

Endpoint: POST /flux-pro-1.0-canny

Required Parameters:

Optional Parameters:

Example:

flux1Depth(array $params): ImageGenerationResponse

Generate images using depth information as control guidance.

Endpoint: POST /flux-pro-1.0-depth

Required Parameters:


Finetune Service

Access via $client->finetune(). Handles fine-tuning operations and fine-tuned model usage.

Management Methods

create(array $params): array

Create a new fine-tuned model from training images.

Endpoint: POST /finetune

Required Parameters:

Example:

listMyFinetunes(): array

List all fine-tunes belonging to the authenticated user.

Endpoint: GET /my_finetunes

Returns: Array containing finetunes list

Example:

getDetails(string $finetuneId): array

Get detailed information about a specific fine-tune.

Endpoint: GET /finetune_details

Parameters:

delete(string $finetuneId): array

Delete a previously created fine-tune.

Endpoint: POST /delete_finetune

Parameters:

Generation Methods with Fine-tuned Models

generateWithFinetunedPro(array $params): ImageGenerationResponse

Generate images using a fine-tuned FLUX Pro model.

Endpoint: POST /flux-pro-finetuned

Required Parameters:

Optional Parameters:

Example:

generateWithFinetunedUltra(array $params): ImageGenerationResponse

Generate images using a fine-tuned FLUX 1.1 Pro Ultra model.

Endpoint: POST /flux-pro-1.1-ultra-finetune

Required Parameters:

generateWithFinetunedDepth(array $params): ImageGenerationResponse

Generate images using fine-tuned FLUX1 Depth Pro with control guidance.

Endpoint: POST /flux-pro-1.0-depth-finetune

Required Parameters:

generateWithFinetunedCanny(array $params): ImageGenerationResponse

Generate images using fine-tuned FLUX1 Canny Pro with edge control.

Endpoint: POST /flux-pro-1.0-canny-finetune

Required Parameters:

generateWithFinetunedFill(array $params): ImageGenerationResponse

Generate images using fine-tuned FLUX1 Fill Pro for inpainting.

Endpoint: POST /flux-pro-1.0-fill-finetune

Required Parameters:

Optional Parameters:


Utility Service

Access via $client->utility(). Handles task status checking and result polling.

getResult(string $taskId): GetResultResponse

Retrieve the current status or final result for a task.

Endpoint: GET /get_result

Parameters:

Returns: GetResultResponse object

Example:

pollResult(string $taskId, int $maxAttempts = 60, int $delaySeconds = 5): GetResultResponse

Poll for task completion with automatic retries.

Parameters:

Example:

waitForCompletion(string $taskId): GetResultResponse

Wait for task completion with sensible defaults (120 attempts, 3 second delay).

Parameters:

Example:

isTaskComplete(string $taskId): bool

Check if a task is complete without polling.

Returns: Boolean indicating completion status

getProgress(string $taskId): ?float

Get task progress percentage if available.

Returns: Progress as float (0.0-100.0) or null if not available


ImageRequestBuilder

Fluent builder for constructing complex image generation requests.

Factory Method

create(): ImageRequestBuilder

Create a new builder instance.

Example:

Configuration Methods

withPrompt(string $prompt): ImageRequestBuilder

Set the text prompt for image generation.

withImagePrompt(string $imagePrompt): ImageRequestBuilder

Set an optional image prompt (base64 encoded).

withDimensions(int $width, int $height): ImageRequestBuilder

Set exact pixel dimensions for the output image.

Example:

withAspectRatio(string $ratio, int $baseSize = 1024): ImageRequestBuilder

Set dimensions using aspect ratio with automatic calculation.

Parameters:

Example:

withSteps(int $steps): ImageRequestBuilder

Set the number of denoising steps (more steps = higher quality, slower).

withPromptUpsampling(bool $enabled = true): ImageRequestBuilder

Enable or disable prompt upsampling for enhanced prompt processing.

withSeed(int $seed): ImageRequestBuilder

Set a specific seed for reproducible results.

withRandomSeed(): ImageRequestBuilder

Generate and set a random seed for varied results.

withGuidance(float $guidance): ImageRequestBuilder

Set classifier guidance scale (how closely to follow the prompt).

Typical values: 1.0-10.0 (default: 2.5)

withInterval(float $interval): ImageRequestBuilder

Set interval for progressive updates.

withSafetyTolerance(int $tolerance): ImageRequestBuilder

Set safety filtering level.

Values:

withOutputFormat(OutputFormat $format): ImageRequestBuilder

Set output format using enum.

asJpeg(): ImageRequestBuilder

Set output format to JPEG (shorthand method).

asPng(): ImageRequestBuilder

Set output format to PNG (shorthand method).

withWebhook(string $url, ?string $secret = null): ImageRequestBuilder

Configure webhook for result delivery.

Parameters:

Build Methods

buildFlux1Pro(): Flux1ProRequest

Build a typed request object for FLUX1 Pro generation.

buildArray(): array

Build a generic parameter array for other model types.

Example:


Response Objects

ImageGenerationResponse

Returned by all image generation methods.

Properties:

Methods:

GetResultResponse

Returned by utility methods for task results.

Properties:

Status Methods:

Result Methods:

Example:

Requirements

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Testing & Quality Assurance

This package includes comprehensive testing across multiple PHP versions and dependency combinations.

Local Testing

CI/CD Pipeline

The package is automatically tested using GitHub Actions across:

Test Coverage

Quality Gates

All PRs must pass:

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Disclaimer

This is an unofficial SDK for Black Forest Labs' FLUX API. It is not affiliated with or endorsed by Black Forest Labs.


Made with ❤️ by l4nos


All versions of php-bfl with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.0
psr/http-message Version ^1.0 || ^2.0
psr/http-client Version ^1.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lanos/php-bfl contains the following files

Loading the files please wait ....