PHPackages                             mimicak/camera-capture - 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. [Image &amp; Media](/categories/media)
4. /
5. mimicak/camera-capture

ActiveLibrary[Image &amp; Media](/categories/media)

mimicak/camera-capture
======================

A standalone PHP library for capturing still images from IP cameras using snapshot URLs or MJPEG streams. Ideal for surveillance, automation, or IoT applications where lightweight, server-side image capture is needed without browser interaction.

1.0.6(10mo ago)08MITPHP

Since Jun 23Pushed 10mo agoCompare

[ Source](https://github.com/MimicAk/camera-capture)[ Packagist](https://packagist.org/packages/mimicak/camera-capture)[ RSS](/packages/mimicak-camera-capture/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (8)Used By (0)

CameraCapture PHP Library
=========================

[](#cameracapture-php-library)

The `CameraCapture` PHP library provides a flexible and extensible way to capture images from IP cameras, such as Hikvision and generic HTTP snapshot cameras. It uses a factory pattern to support multiple camera types and includes robust error handling, authentication, and MIME type validation.

Features
--------

[](#features)

- **Modular Design**: Supports multiple camera types (e.g., Hikvision, generic HTTP snapshot) via a factory pattern.
- **Extensible**: Easily add new camera types by registering them with the `CameraFactory`.
- **Authentication**: Supports HTTP Basic and Digest authentication.
- **SSL/TLS Support**: Configurable HTTP/HTTPS protocols with SSL verification options.
- **Type Safety**: Uses constants from `CameraTypes` to avoid configuration errors.
- **Error Handling**: Throws detailed exceptions for network issues, invalid responses, or misconfigurations.
- **Flexible Configuration**: Supports type-specific options and customizable timeouts.

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

[](#requirements)

- PHP 7.4 or higher
- PHP extensions: `curl`, `fileinfo`
- Composer (recommended for autoloading)

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

[](#installation)

### Using Composer (Recommended)

[](#using-composer-recommended)

1. Add the library to your project:

    ```
    composer require your-vendor/camera-capture
    ```

    *Note*: Replace `your-vendor/camera-capture` with the actual package name if published to Packagist, or use a custom repository.
2. Ensure your `composer.json` includes autoloading:

    ```
    "autoload": {
        "psr-4": {
            "CameraCapture\\": "src/"
        }
    }
    ```
3. Run `composer dump-autoload` to generate the autoloader.

### Manual Installation

[](#manual-installation)

1. Clone or download the library to your project directory.
2. Place the `src/` directory in your project.
3. Manually include the required files: ```
    require_once __DIR__ . '/src/CameraInterface.php';
    require_once __DIR__ . '/src/AbstractCamera.php';
    require_once __DIR__ . '/src/Exception/CameraCaptureException.php';
    require_once __DIR__ . '/src/CameraType/HttpSnapshotCamera.php';
    require_once __DIR__ . '/src/CameraType/HikvisionCamera.php';
    require_once __DIR__ . '/src/CameraFactory.php';
    require_once __DIR__ . '/src/CameraTypes.php';
    require_once __DIR__ . '/src/CameraCapture.php';
    ```

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

The following example demonstrates how to initialize the library, add cameras, capture images, and manage camera instances.

```
