PHPackages                             smalot/vagrantfile - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. smalot/vagrantfile

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

smalot/vagrantfile
==================

Vagrant file generator.

151PHP

Since Mar 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/smalot/vagrantfile)[ Packagist](https://packagist.org/packages/smalot/vagrantfile)[ RSS](/packages/smalot-vagrantfile/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Vagrantfile generator
=====================

[](#vagrantfile-generator)

Helper to easily create `Vagrantfile`.

Implements
==========

[](#implements)

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

use Smalot\Vagrant\Generator\Machine\Network\ForwardedPort;
use Smalot\Vagrant\Generator\Machine\Network\PrivateNetwork;
use Smalot\Vagrant\Generator\Machine\Network\PublicNetwork;
use Smalot\Vagrant\Generator\Provision\Ansible;
use Smalot\Vagrant\Generator\Vagrantfile;

$vagrantfile = new Vagrantfile();

$vagrantfile->getMachine()->setBox('bento/ubuntu-16.04');
$vagrantfile->getMachine()->setBoxCheckUpdate(false);

$vagrantfile->getSsh()->setUsername('ubuntu');
$vagrantfile->getSsh()->setPassword('password');

$forwardedPort = new ForwardedPort();
$forwardedPort->setGuest(80);
$forwardedPort->setHost(8081);
$vagrantfile->getMachine()->getNetwork()->addForwardedPort($forwardedPort);

$privateNetwork = new PrivateNetwork();
$privateNetwork->setDhcp(true);
$vagrantfile->getMachine()->getNetwork()->addPrivateNetwork($privateNetwork);

$publicNetwork = new PublicNetwork();
$publicNetwork->addBridge('en1: Wi-Fi (AirPort)');
$publicNetwork->addBridge('en6: Broadcom NetXtreme Gigabit Ethernet Controller');
$vagrantfile->getMachine()->getNetwork()->addPublicNetwork($publicNetwork);

$ansible = new Ansible();
$ansible->setPlaybook('playbook.yml');
$ansible->setVerbose('v');
$vagrantfile->getMachine()->getProvisions()->add($ansible);

echo $vagrantfile->dump();
```

This sample code will generate this:

```
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
    # The most common configuration options are documented and commented below.
    # For a complete reference, please see the online documentation at
    # https://docs.vagrantup.com.

    config.vm.box = "bento/ubuntu-16.04"
    config.vm.box_check_update = false

    # Create a forwarded port mapping which allows access to a specific port
    # within the machine from a port on the host machine.
    config.vm.network "ForwardedPorted_port", guest: 80, host: 8081

    # Create a private network, which allows host-only access to the machine using
    # a specific IP.
    config.vm.network "private_network", dhcp: true

    # Create a public network, which generally matched to bridged network. Bridged
    # networks make the machine appear as another physical device on your network.
    config.vm.network "public_network", bridge: ["en1: Wi-Fi (AirPort)", "en6: Broadcom NetXtreme Gigabit Ethernet Controller"]

    # View the documentation for the provider you are using for more information
    # on available options.
    config.vm.provision "ansible" do |ansible|
        ansible.verbose = "v"
        ansible.playbook = "playbook.yml"
    end

    config.ssh.username = "ubuntu"
    config.ssh.password = "password"

end

```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### 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 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[krlove/code-generator

Code Generator

702.3M19](/packages/krlove-code-generator)[soloterm/screen

A terminal renderer written in pure PHP.

2508.0k1](/packages/soloterm-screen)

PHPackages © 2026

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