PHPackages                             smalot/dockerfile - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. smalot/dockerfile

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

smalot/dockerfile
=================

Dockerfile generator

v0.3(11y ago)224MITPHPPHP &gt;=5.3.0

Since Nov 23Pushed 11y ago1 watchersCompare

[ Source](https://github.com/smalot/dockerfile)[ Packagist](https://packagist.org/packages/smalot/dockerfile)[ RSS](/packages/smalot-dockerfile/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (4)Used By (0)

Dockerfile Generator
====================

[](#dockerfile-generator)

This library will help you to generate a *Dockerfile* programmatically.

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

use \Smalot\Docker\Dockerfile\Dockerfile;
use \Smalot\Docker\Dockerfile\Instruction\Run;
use \Smalot\Docker\Dockerfile\Instruction\Expose;
use \Smalot\Docker\Dockerfile\Source\File;

$dockerFile = new Dockerfile('debian:wheezy', 'Sebastien MALOT ');

$cmds = array(
    'apt-get update',
    'DEBIAN_FRONTEND=noninteractive apt-get -y upgrade',
    'DEBIAN_FRONTEND=noninteractive apt-get -y install supervisor pwgen',
    'DEBIAN_FRONTEND=noninteractive apt-get -y install git apache2 libapache2-mod-php5 php5-mysql php5-pgsql php5-gd php-pear php-apc curl',
    'curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin',
    'mv /usr/local/bin/composer.phar /usr/local/bin/composer',
);

$layer = new Run($cmds, 'Install packages');
$dockerFile->addLayer($layer);

$layer = new Expose(array(80, 443), 'Expose Ports');
$dockerFile->addLayer($layer);

$writer = new File('Dockerfile');
$dockerFile->write($writer);
```

Notes
-----

[](#notes)

Excluding *FROM* and *MAINTAINER* instructions, which are passed to the constructor, other ones are passed to the writer in the same order as added to the Dockerfile object.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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 ~0 days

Total

3

Last Release

4240d ago

### Community

Maintainers

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

---

Top Contributors

[![smalot](https://avatars.githubusercontent.com/u/1424035?v=4)](https://github.com/smalot "smalot (14 commits)")

---

Tags

generatordockerdockerfile

### Embed Badge

![Health badge](/badges/smalot-dockerfile/health.svg)

```
[![Health](https://phpackages.com/badges/smalot-dockerfile/health.svg)](https://phpackages.com/packages/smalot-dockerfile)
```

###  Alternatives

[wsdltophp/packagegenerator

Generate hierarchical PHP classes based on a WSDL

4382.0M24](/packages/wsdltophp-packagegenerator)[spatie/docker

Run a docker container in your PHPUnit tests

486135.8k13](/packages/spatie-docker)[ryoluo/sail-ssl

Laravel Sail plugin to enable SSL (HTTPS) connection with Nginx.

192775.1k3](/packages/ryoluo-sail-ssl)[testcontainers/testcontainers

Testcontainers implementation in PHP

208312.6k31](/packages/testcontainers-testcontainers)[aschmelyun/fleet

Run multiple Laravel Sail websites on your local environment

33379.3k](/packages/aschmelyun-fleet)[contributte/bootstrap

Extra contrib to nette/boostrap

121.5M3](/packages/contributte-bootstrap)

PHPackages © 2026

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