PHPackages                             cvuorinen/raspicam-php - 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. cvuorinen/raspicam-php

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

cvuorinen/raspicam-php
======================

Control Raspberry Pi camera module with PHP

v1.0.1(8y ago)334239MITPHPPHP &gt;=5.4.0

Since Dec 14Pushed 8y ago2 watchersCompare

[ Source](https://github.com/cvuorinen/raspicam-php)[ Packagist](https://packagist.org/packages/cvuorinen/raspicam-php)[ Docs](https://github.com/cvuorinen/raspicam-php)[ RSS](/packages/cvuorinen-raspicam-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Raspicam PHP
============

[](#raspicam-php)

[![Build Status](https://camo.githubusercontent.com/e35c072016073003444f1f1a2eaa8eab7fd6b4d8fcd4c5a6b0f11f0c7bea5b19/68747470733a2f2f7472617669732d63692e6f72672f6376756f72696e656e2f726173706963616d2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/cvuorinen/raspicam-php)

Raspicam PHP is a library to control the [Raspberry Pi Camera Module](https://www.raspberrypi.org/documentation/raspbian/applications/camera.md) with PHP. It is a wrapper around the command line tool [raspistill](https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md).

Requirements
============

[](#requirements)

You need a Raspberry Pi running Raspbian and the Camera Module. On the Raspberry Pi you also need to have PHP and composer installed.

First, install and enable the Camera on the Raspberry Pi: [Instructions](https://www.raspberrypi.org/documentation/configuration/camera.md)

If you don't have PHP installed on the Raspberry Pi yet, you can install it by running:

```
sudo apt-get install php5
```

Then install [composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx):

```
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
```

Install
=======

[](#install)

First check requirements above.

Install with composer:

```
composer require cvuorinen/raspicam-php
```

Add to your php file (adjust path accordingly if file not in project root):

```
require 'vendor/autoload.php';
```

Usage
=====

[](#usage)

Take picture
------------

[](#take-picture)

```
use Cvuorinen\Raspicam\Raspistill;

$camera = new Raspistill();

$camera->takePicture('pic.jpg');
```

### Fluent interface

[](#fluent-interface)

```
use Cvuorinen\Raspicam\Raspistill;

$camera = new Raspistill();
$camera->timeout(1)
    ->rotate(90)
    ->exposure(Raspistill::EXPOSURE_NIGHT)
    ->quality(85);

$camera->takePicture('pic.jpg');
```

### Constructor options array

[](#constructor-options-array)

```
use Cvuorinen\Raspicam\Raspistill;

$camera = new Raspistill([
    'timeout' => 1,
    'rotate' => 90,
    'exposure' => Raspistill::EXPOSURE_NIGHT,
    'quality' => 85,
]);

$camera->takePicture('pic.jpg');
```

Timelapse
---------

[](#timelapse)

```
use Cvuorinen\Raspicam\Raspistill;

$camera = new Raspistill();

// take picture every ten seconds for two minutes
$camera->startTimelapse('image%04d.jpg', 10, 120);
```

More complex examples can be found in the [examples](examples) directory.

Documentation
=============

[](#documentation)

Documentation can be found in the the [docs](docs) directory.

Troubleshooting
===============

[](#troubleshooting)

Since Raspicam PHP is just a wrapper around `raspistill`, you should first make sure that it works without issues. This can be done by calling it directly, for example creating a PHP script with just `passthru("raspistill -o /tmp/test.jpg");` and calling it the same way as the script that uses Raspicam PHP.

Depending on how you are going to execute your PHP code, you might have to adjust some permissions. The executing user needs access to `/dev/vchiq` on the Pi. If you are executing from command-line as the default user, it should just work.

If you are executing through a web server like Apache, you need to adjust the permissions so that the web server user (`www-data` in case of Apache) has permission to access it by adding the user to the group `video` (with e.g. `sudo usermod -a -G video www-data`).

Also make sure that the user has permission to write to the file/directory where you are saving the images. The filename is relative to PHP [current working directory](http://php.net/manual/en/function.getcwd.php), but absolute paths can also be used.

License
=======

[](#license)

Released under the MIT License (MIT). See [LICENSE](LICENSE) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~656 days

Total

2

Last Release

3144d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b637f75abd791a5d136972b6252dc6f0986120e06148c528c9b699cbd71838d6?d=identicon)[cvuorinen](/maintainers/cvuorinen)

---

Top Contributors

[![cvuorinen](https://avatars.githubusercontent.com/u/1764167?v=4)](https://github.com/cvuorinen "cvuorinen (58 commits)")

---

Tags

videophotocameraraspberryhardwareraspberry piraspistillraspistillyuvraspividtimelapse

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cvuorinen-raspicam-php/health.svg)

```
[![Health](https://phpackages.com/badges/cvuorinen-raspicam-php/health.svg)](https://phpackages.com/packages/cvuorinen-raspicam-php)
```

###  Alternatives

[php-ffmpeg/php-ffmpeg

FFMpeg PHP, an Object Oriented library to communicate with AVconv / ffmpeg

5.0k21.7M165](/packages/php-ffmpeg-php-ffmpeg)[danog/madelineproto

Async PHP client API for the telegram MTProto protocol.

3.4k855.0k18](/packages/danog-madelineproto)[vimeo/vimeo-api

Official PHP library for the Vimeo API.

4637.1M32](/packages/vimeo-vimeo-api)[vimeo/laravel

A Vimeo bridge for Laravel

4161.5M4](/packages/vimeo-laravel)[opentok/opentok

OpenTok is a platform for creating real time streaming video applications, created by TokBox.

1413.0M10](/packages/opentok-opentok)[char0n/ffmpeg-php

PHP wrapper for FFmpeg application

495225.1k1](/packages/char0n-ffmpeg-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
