/omdb-laravel

A Laravel integration for OMDb API.

Primary LanguagePHPMIT LicenseMIT

Laravel OMDb API Wrapper

Introduction

A Laravel integration of PHP wrapper for OMDb API.

Installation

Install omdb-laravel using Composer.

composer require rooxie/omdb-laravel

Quickstart

Add OMDb API key to your .env file

OMDB_API_KEY=xxxxxxx

Use OMDb as a facade

use Rooxie\Laravel\Facades\OMDb;

OMDb::getByImdbId('tt0110912');
OMDb::getByTitle('harry potter', 'movie', 2004);
OMDb::search('arrival', 'movie', 2016, 1);

Use from Laravel Service Container

use Rooxie\OMDb;

class UserController extends Controller
{
    public function show(OMDb $omdb, string $imdbId)
    {
         return view('user.profile', [
            'movie' => $omdb->getByImdbId($imdbId),
        ]);
    }
}

Documentation

Read the full documentation here.