mm28ajos/php-reolink-camera-api

A minimal PHP API for Reolink cameras.

1.0.2 2019-12-26 18:24 UTC

This package is auto-updated.

Last update: 2024-09-27 05:19:06 UTC


README

A PHP class which provides access to Reolink's IP cameras.

This class can be installed manually or using composer/packagist for easy inclusion in your projects.

Requirements

  • a Reolink camera (tested with RLC-420-5MP, Build No. build 19061408, Hardware No. IPC_51516M5M, Configuration Version v2.0.0.0, Firmware Version v2.0.0.448_19061408)
  • a web server with PHP installed (tested with PHP cli Version 7.3.11-1~deb10u1)
  • network connectivity between this web server and the camera and port (normally TCP port 80)

Installation

You can use Composer, Git or simply Download the Release to install the API client class.

Composer

The preferred method is via composer. Follow the installation instructions if you do not already have composer installed.

Once composer is installed, simply execute this command from the shell in your project directory:

composer require mm28ajos/php-reolink-camera-api

Or you can manually add the package to your composer.json file:

{
    "require": {
        "mm28ajos/php-reolink-camera-api": "^1.0"
    }
}

Finally, be sure to include the autoloader in your code:

require_once('vendor/autoload.php');

Git

Execute the following git command from the shell in your project directory:

git clone https://github.com/mm28ajos/PHPReolinkCameraAPI.git

When git is done cloning, include the file containing the class like so in your code:

require_once('path/to/src/Client.php');

Download the Release

If you prefer not to use composer or git, you can simply download the package, uncompress the zip file, then include the file containing the class in your code like so:

require_once('path/to/src/Client.php');

Example usage

A basic example how to use the class:

/**
 * load the class using the composer autoloader
 */
require_once('vendor/autoload.php');

/**
 * initialize the Reolink API connection class, log in to the controller and request disable the motion detection e-mail alert
 * (this example assumes you have already assigned the correct values to the variables used)
 */
$reolink_connection = new \Reolink_API\Client($user, $password, $camera_ip);
$login            = $reolink_connection->login();
if ($login)
{
  $results          = $reolink_connection->toggleMotionEmail(false); // returns a PHP boolean to signale the success/failure of toggeling the motion e-mail alert
  $logout            = $reolink_connection->$logout();
}

Please refer to the examples/ directory for some more detailed examples which you can use as a starting point for your own PHP code.

API Requests Implementation:

GET:

  • Login
  • Logout
  • Display -> OSD
  • Recording -> Encode (Clear and Fluent Stream)
  • Recording -> Advance (Scheduling)
  • Network -> General
  • Network -> Advanced
  • Network -> DDNS
  • Network -> NTP
  • Network -> E-mail
  • Network -> FTP
  • Network -> Push
  • Network -> WIFI
  • Alarm -> Motion
  • System -> General
  • System -> DST
  • System -> Information
  • System -> Maintenance
  • System -> Performance
  • System -> Reboot
  • User -> Online User
  • User -> Add User
  • User -> Manage User
  • Device -> HDD/SD Card
  • Zoom
  • Focus
  • Image (Brightness, Contrass, Saturation, Hue, Sharp, Mirror, Rotate)
  • Near Infrared Light
  • Advanced Image (Anti-flicker, Exposure, White Balance, DayNight, Backlight, 3D-NR)
  • Image Data -> "Snap" Frame from Video Stream

SET:

  • Display -> OSD
  • Recording -> Encode (Clear and Fluent Stream)
  • Recording -> Advance (Scheduling)
  • Network -> General
  • Network -> Advanced
  • Network -> DDNS
  • Network -> NTP
  • Network -> E-mail
  • Network -> FTP
  • Network -> Push
  • Network -> WIFI
  • Alarm -> Motion
  • System -> General
  • System -> DST
  • System -> Reboot
  • User -> Online User
  • User -> Add User
  • User -> Manage User
  • Device -> HDD/SD Card
  • Zoom
  • Focus
  • Image (Brightness, Contrass, Saturation, Hue, Sharp, Mirror, Rotate)
  • Near Infrared Light
  • Advanced Image (Anti-flicker, Exposure, White Balance, DayNight, Backlight, 3D-NR)

Contribute

If you would like to contribute code (improvements), please open an issue and include your code there or else create a pull request.

Credits

This class is based on the initial work by the following developer:

The Readme is based on:

Important Note

All of the functions in this API client class are not officially supported by Reolink and as such, may not be supported in future versions of the Reolink cameras.