GithubHelp home page GithubHelp logo

laravel-cloudflare-stream's Introduction

Laravel Cloudflare Stream

A Laravel Package for working with Cloudflare Stream seamlessly

Installation

Run

composer require bjthecod3r/laravel-cloudflare-stream

Configuration

You may publish the configuration file using this command:

php artisan vendor:publish --provider="Bjthecod3r\CloudflareStream\CloudflareStreamServiceProvider"

A configuration file named cloudflare-stream with some defaults and required properties will be placed in your config directory.

Usage

Open your .env file and add the following variables, remember to substitute the actual values

CLOUDFLARE_API_TOKEN=xxxxxxxxxxxx
CLOUDFLARE_ACCOUNT_ID=xxxxxxxxxxxxxxxxx
CLOUDFLARE_BASE_API_URL=https://api.cloudflare.com/client/v4/accounts
CLOUDFLARE_KEY_ID=xxxxxxxxxxxxxxx

Using the package is pretty straight forward, you can make use of the class like you would do any in Laravel. There is also support for facade.

use Bjthecod3r\CloudflareStream\CloudflareStream;

use Bjthecod3r\CloudflareStream\Facades\CloudflareStream as CloudflareStreamFacade;

class StreamService
{
    public function fetchStream(string $id, CloudflareStream $cloudflareStream)
    {
        dd($cloudflareStream->fetchVideo($id));
    }
    
    public function fetchVideo(string $id): array
    {
       return CloudflareStreamFacade::fetchVideo(string $id)
    }
}

Note

This package currently covers my current usage of cloudflare stream, although, in the next couple of weeks I plan to expand its features. However, if there is a need for a particular feature, feel free to reach out to me via [email protected], and I'll gladly attend to it.

Todo

  • Add Tests
  • Add the remaining useful features available on Cloudflare Stream

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

License

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.