PHPackages                             sent-flying/cloudflare-stream-laravel - 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. sent-flying/cloudflare-stream-laravel

ActiveLibrary[API Development](/categories/api)

sent-flying/cloudflare-stream-laravel
=====================================

Laravel package for Cloudflare Stream Live Inputs API

010PHP

Since Jun 4Pushed 11mo agoCompare

[ Source](https://github.com/SentFlying/cloudflare-stream-laravel)[ Packagist](https://packagist.org/packages/sent-flying/cloudflare-stream-laravel)[ RSS](/packages/sent-flying-cloudflare-stream-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Cloudflare Stream Live Inputs for Laravel
=========================================

[](#cloudflare-stream-live-inputs-for-laravel)

> **⚠️ Pre-Release Software**: This package is currently in alpha/beta development. The API may change before the stable 1.0 release. Use in production at your own risk.

A Laravel package that provides a clean, fluent interface to the Cloudflare Stream Live Inputs API, specifically focused on managing Live Inputs.

Features
--------

[](#features)

- Simple, fluent interface to Cloudflare Stream Live Inputs API
- Support for both API Token and API Key authentication methods
- Comprehensive error handling with specific exception types
- Laravel Facade for convenient static access
- Full test coverage including integration tests
- Compatible with Laravel 11.0+ and 12.0+

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

[](#requirements)

- PHP 8.1+
- Laravel 11.0+ or 12.0+
- Cloudflare account with Stream service enabled

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

[](#installation)

You can install the package via Composer:

```
composer require sent-flying/cloudflare-stream-laravel
```

The package will automatically register its service provider if you're using Laravel's package auto-discovery.

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag="cloudflare-stream-config"
```

This will create a `config/cloudflare-stream.php` file in your application. You should configure your Cloudflare API credentials in your `.env` file:

```
# Required configuration
CLOUDFLARE_ACCOUNT_ID=your-account-id

# Token authentication (recommended)
CLOUDFLARE_AUTH_TYPE=token
CLOUDFLARE_API_TOKEN=your-api-token

# OR Key authentication (alternative)
# CLOUDFLARE_AUTH_TYPE=key
# CLOUDFLARE_API_KEY=your-api-key
# CLOUDFLARE_EMAIL=your-email@example.com

# Optional configuration
# CLOUDFLARE_API_BASE_URL=https://api.cloudflare.com/client/v4
# CLOUDFLARE_API_TIMEOUT=30

```

Usage
-----

[](#usage)

### Available Methods

[](#available-methods)

The package provides the following methods for managing Live Inputs:

MethodDescription`listLiveInputs()`List all Live Inputs`createLiveInput($meta, $recording, $uid, $deleteRecordingAfterDays)`Create a new Live Input`getLiveInput($liveInputId)`Get a specific Live Input by ID`updateLiveInput($liveInputId, $meta, $recording, $deleteRecordingAfterDays)`Update a Live Input`deleteLiveInput($liveInputId)`Delete a Live Input### Using the Facade

[](#using-the-facade)

```
use SentFlying\CloudflareStreamLaravel\Facades\Stream;

// List all Live Inputs
$liveInputs = Stream::listLiveInputs();

// Create a new Live Input
$meta = ['name' => 'My Live Stream'];
$recording = [
    'mode' => 'automatic',
    'timeoutSeconds' => 60,
    'requireSignedURLs' => false,
    'allowedOrigins' => ['*.example.com']
];
$liveInput = Stream::createLiveInput($meta, $recording);

// Get a specific Live Input
$liveInput = Stream::getLiveInput('live-input-id');

// Update a Live Input
$updatedMeta = ['name' => 'Updated Live Stream'];
$updatedLiveInput = Stream::updateLiveInput('live-input-id', $updatedMeta);

// Delete a Live Input
$result = Stream::deleteLiveInput('live-input-id');
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use SentFlying\CloudflareStreamLaravel\Client;

class LiveStreamController extends Controller
{
    protected $streamClient;

    public function __construct(Client $streamClient)
    {
        $this->streamClient = $streamClient;
    }

    public function index()
    {
        $liveInputs = $this->streamClient->listLiveInputs();

        return view('live-streams.index', compact('liveInputs'));
    }

    public function store(Request $request)
    {
        $meta = ['name' => $request->input('name')];
        $recording = [
            'mode' => $request->input('recording_mode', 'automatic'),
            'timeoutSeconds' => $request->input('timeout', 60),
        ];

        $liveInput = $this->streamClient->createLiveInput($meta, $recording);

        return redirect()->route('live-streams.show', $liveInput['uid']);
    }
}
```

Error Handling
--------------

[](#error-handling)

The package throws specific exceptions for different types of errors:

ExceptionHTTP StatusDescription`AuthenticationException`401, 403Authentication or authorization errors`ValidationException`400, 422Validation errors in request data`NotFoundException`404Resource not found`CloudflareStreamApiException`AnyBase exception for all other errorsAll exceptions include the original error message from Cloudflare and provide access to the full error details via the `getErrors()` method.

Example:

```
use SentFlying\CloudflareStreamLaravel\Exceptions\AuthenticationException;
use SentFlying\CloudflareStreamLaravel\Exceptions\NotFoundException;
use SentFlying\CloudflareStreamLaravel\Exceptions\ValidationException;
use SentFlying\CloudflareStreamLaravel\Facades\Stream;

try {
    $liveInput = Stream::getLiveInput('non-existent-id');
} catch (NotFoundException $e) {
    // Handle not found error
    return response()->json([
        'error' => 'Live input not found',
        'message' => $e->getMessage(),
        'details' => $e->getErrors()
    ], 404);
} catch (AuthenticationException $e) {
    // Handle authentication error
    return response()->json(['error' => 'Authentication failed'], 401);
} catch (ValidationException $e) {
    // Handle validation error
    return response()->json(['error' => 'Validation failed', 'details' => $e->getErrors()], 422);
} catch (\Exception $e) {
    // Handle other errors
    return response()->json(['error' => 'An error occurred'], 500);
}
```

Testing
-------

[](#testing)

The package includes both unit tests and integration tests.

### Unit Tests

[](#unit-tests)

Run the unit tests with:

```
composer test
# or more specifically
composer test:unit
```

### Feature Tests

[](#feature-tests)

Run the feature tests with:

```
composer test:feature
```

### Integration Tests

[](#integration-tests)

The package includes integration tests that make real API calls to Cloudflare.

To run the integration tests:

1. Create a `.env.testing` file in the root of your package with your Cloudflare test account credentials:

```
CLOUDFLARE_TEST_AUTH_TYPE=token
CLOUDFLARE_TEST_API_TOKEN=your_test_api_token
CLOUDFLARE_TEST_ACCOUNT_ID=your_test_account_id

```

2. Run the integration tests:

```
composer test:integration
```

To run all tests (unit, feature, and integration):

```
composer test
```

> **Warning**: Integration tests will create, update, and delete real Live Inputs in your Cloudflare account. Always use a test account or a sandbox environment.

License
-------

[](#license)

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

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bfda666a9194a92edecb00b96768bb04181d63c9b91bb2bf7a87c3bd32d14ff?d=identicon)[sf-steve](/maintainers/sf-steve)

---

Top Contributors

[![sf-steve](https://avatars.githubusercontent.com/u/36995198?v=4)](https://github.com/sf-steve "sf-steve (2 commits)")

### Embed Badge

![Health badge](/badges/sent-flying-cloudflare-stream-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/sent-flying-cloudflare-stream-laravel/health.svg)](https://phpackages.com/packages/sent-flying-cloudflare-stream-laravel)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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