PHP Classes

Darknet PHP Image Recognition Library: Classify and detect objects in images with Darknet

Recommend this page to a friend!
  Info   View files Example   View files View files (22)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 241 This week: 1All time: 7,997 This week: 109Up
Version License PHP version Categories
php-darknet 1.0.2Custom (specified...7.4Algorithms, Graphics, Artificial inte..., P..., F...


This package can classify and detect objects in images with Darknet library

It uses the Darknet Open Source neural network framework written in C and CUDA to classify an object in an image.

The package can also detect previously classified objects in given images. It uses a YOLO (You Only Look Once) algorithm to detects all the object in a image or a frame in a single shot. It supports YOLO v2, v3 and v4.

Innovation Award
PHP Programming Innovation award winner
February 2021

Prize: One official elePHPant Plush Mascott
Neural networks are means to implement artificial intelligence solutions that are based on learning patterns and recognizing them, like for instance recognizing a certain type of object in a picture.

This package provides a solution for recognizing objects in pictures using the Darknet library to implement the YOLO (You Only Look Once) algorithm.

Manuel Lemos
Picture of Shubham Chaudhary
  Performance   Level  
Name: Shubham Chaudhary <contact>
Classes: 3 packages by
Country: India India
Age: 32
All time rank: 3585239 in India India
Week rank: 132 Up17 in India India Up
Innovation award
Innovation award
Nominee: 3x

Winner: 2x


php-darknet Darknet Logo

php-ffi experiment

php7.4 interface to the lib-darknet for object detection.


composer require ghostjat/darknet




Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation.

  • It offers a simple API.
  • High performance, due to the fact that it uses native interface elements.
  • Fast learning by the user, due to the simplicity of its API. # yolo v2, v3, v4 #

If running on cpu you may use FASTEST cfg & weight for real time object detection on MS COCO dataset.

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

use darknet\core;
$dn = new core(core::YOLOFASTEST);


CPU:- Intel(R) Core(TM) i3-2370M CPU @ 2.40GHz 64bit
Dataset:- MS-COCO Classes:- 80

| YOLO | Time (ms) | CPU | Mem(mb)(max) | |-----------|-----------------|-----------|---------------| | Tiny-v2 | 0.85933095 (max)| 78 | 143.59 | | | 0.62237596 (min)| | | |-----------|-----------------|-----------|---------------| | Tiny-v3 | 0.93895602 (max)| 90 | 125.9 | | | 0.60306811 (min)| | | |-----------|-----------------|-----------|---------------| | Main-v3 | 15.4672219 (max)| 98 | 964.5 | | | 14.0677847 (min)| | | |-----------|-----------------|-----------|---------------| | Tiny-v4 | 0.85933095 (max)| 82 | 151.9 | | | 0.62237596 (min)| | | |-----------|-----------------|-----------|---------------| | FASTEST | 0.20039399 (max)| 20 | 97.47 | | | 0.11836814 (min)| | | |-----------|-----------------|-----------|---------------| | FASTEST-xl| 0.80017591 (max)| 69 | 131.85 | | | 0.22637511 (min)| | | Synopsis

WARNING: This module is in its early stages and should be considered a Work in Progress. The interface is not final and may change in the future.


<p align="center"> php-darknet <img src="" alt="gp"/> <img src ="" alt ="dog"/> <img src ="" alt ="egale"/> <img src ="" alt ="giraffe"/> <img src="" alt="person"/> </p>

Sample code:

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

use darknet\core;
$lib = '/home/ghost/bin/c-lib/darknet/data/';
$img = ['eagle.jpg','giraffe.jpg','horses.jpg','person.jpg','kite.jpg'];
$dn = new core();
foreach ($img as $value) {


Shubham Chaudhary <>

  Files folder image Files  
File Role Description
Files folder imageexample (3 files)
Files folder imagesrc (2 files, 2 directories)
Files folder imagetemp (1 directory)
Plain text file composer.json Data Auxiliary data
Image file darknet.png Icon Icon image
Plain text file LICENSE Lic. License text
Plain text file Doc. Documentation

  Files folder image Files  /  example  
File Role Description
  Plain text file react.php Class Class source
  Plain text file simple.php Example Example script
  Plain text file swoole.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imagecfg (2 files)
Files folder imageException (1 file)
  Plain text file core.php Class Class source
  Plain text file dn_api_4.h Data Auxiliary data

  Files folder image Files  /  src  /  cfg  
File Role Description
  Plain text file yolo-fastest-xl.cfg Data Auxiliary data
  Plain text file yolo-fastest.cfg Data Auxiliary data

  Files folder image Files  /  src  /  Exception  
File Role Description
  Plain text file coreException.php Class Class source

  Files folder image Files  /  temp  
File Role Description
Files folder imageout (10 files)

  Files folder image Files  /  temp  /  out  
File Role Description
  Image file 11.jpg Screen Screenshot
  Image file 11.png Screen screenshot-1
  Image file dog.jpg Screen Auxiliary data
  Image file eagle.jpg Data Auxiliary data
  Image file giraffe.jpg Data Auxiliary data
  Image file gp.jpg Data Auxiliary data
  Image file horses.jpg Data Auxiliary data
  Image file IMG-20180512-WA0003.jpg Data Auxiliary data
  Image file kite.jpg Data Auxiliary data
  Image file person.jpg Screen Icon image

 Version Control Unique User Downloads Download Rankings  
This week:1
All time:7,997
This week:109Up