netflex/api

Netflex API library
4,814
Install
composer require netflex/api
Latest Version:v7.0.1
PHP:^8.4
License:MIT
Last Updated:Jun 3, 2026
Links: GitHub  ·  Packagist
Maintainer: thomas-alrek

Netflex API

[READ ONLY] Subtree split of the Netflex API component (see netflex/api)

A library for working with the Netflex API.

Documentation

Table of contents

Installation

1. Setup

composer require netflex/api

Note: If you are using Netflex SDK 2.0 or later, or Laravel 5.5, the steps 2 and 3, for providers and aliases, are unnecessaries. Netflex API supports Package Discovery.

2. Provider

You need to update your application configuration in order to register the package so it can be loaded by Laravel, just update your config/app.php file adding the following code at the end of your 'providers' section:

config/app.php

<?php

return [
    // ...
    'providers' => [
        Netflex\API\Providers\APIServiceProvider::class,
        // ...
    ],
    // ...
];

3. Facades

You may get access to the Netflex API using following facades:

  • Netflex\API\Facades\API

You can setup a short-version aliases for these facades in your config/app.php file. For example:

<?php

return [
    // ...
    'aliases' => [
        'API'   => Netflex\API\Facades\API::class,
        // ...
    ],
    // ...
];

4. Configuration

Publish config

In your terminal type

php artisan vendor:publish

or

php artisan vendor:publish --provider="Netflex\API\Providers\APIServiceProvider"

Alternatively, you can create the config file manually, under config/api.php, see example here.

Standalone usage

Netflex API can be used standalone as well.

<?php

use Netflex\API\Client;

$client = new Client([
  'auth' => ['publicKey', 'privateKey']
]);

Testing

For testing purposes, use the provided Netflex\API\Testing\MockClient implementation. This can be used with the Facade, so you don't have to modify your code while testing.

To bind the MockClient into the container, register the Netflex\API\Testing\Providers\MockAPIServiceProvider provider.

Example:

<?php

use Illuminate\Container\Container;
use Illuminate\Support\Facades\Facade;

use Netflex\API\Facades\API;
use Netflex\API\Testing\Providers\MockAPIServiceProvider;

use GuzzleHttp\Psr7\Response;

$container = new Container;

Facade::setFacadeApplication($container);

// Register the service provider
(new MockAPIServiceProvider($container))->register();

// The container binding is now registered, and you can use the Facade.

API::mockResponse(
  new Response(
    200,
    ['Content-Type' => 'application/json'],
    json_encode(['hello' => 'world'])
  )
);

$response = API::get('/'); // Returns the mocked response

echo $response->hello; // Outputs 'world'

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

641,106,524 9,700
laravel/framework

The Laravel Framework.

593,882,149 34,959
laravel/tinker

Powerful REPL for the Laravel framework.

502,645,077 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

418,291,778 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released PHP Laravel License
v7.0.1 ^8.4 ^13.0 MIT
v7.0.0 ^8.4 ^13.0 MIT
v6.7.3 ^8.2 ^12.0 MIT
v6.7.2 ^8.2 ^12.0 MIT
v6.7.1 ^8.2 ^12.0 MIT