PHPackages                             shift31/hostbase - 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. [Database &amp; ORM](/categories/database)
4. /
5. shift31/hostbase

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

shift31/hostbase
================

A highly scalable host and network database with full-text search and a RESTful API

0.2.0(11y ago)661MITPHPPHP &gt;=5.5

Since Mar 19Pushed 11y ago1 watchersCompare

[ Source](https://github.com/shift31/hostbase)[ Packagist](https://packagist.org/packages/shift31/hostbase)[ RSS](/packages/shift31-hostbase/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

Hostbase
========

[](#hostbase)

**A highly scalable host and network database with full-text search and a RESTful API**

- [Overview](#overview)
    - [Technology](#technology)
- [Installation](#installation)
    - [Development Server (Vagrant)](#development-server-vagrant)
- [Configuration](#configuration)
- [Usage](#usage)
    - [REST API endpoints](#rest-api-endpoints)
    - [Command Line Interface](#command-line-interface)
    - [Importers](#importers)
    - [API Client Library for PHP](#api-client-library-for-php)
- [Security](#security)
- [To-do](#to-do)

***Hostbase is currently under development, however it is quite usable.*** I created this project to help teach myself the Laravel framework, study REST API development, and apply enterprise architecture patterns. ~@bgetsug

Overview
--------

[](#overview)

Hostbase is a systems and network administration tool for cataloging hosts, subnets, and IP addresses. It is designed to support private or public cloud operations of any size. Whether you have a few dozen or a few thousand hosts across multiple environments and data centers, Hostbase can provide the foundation of a service-oriented architecture for tracking the lifecycle of hosts and networks. Instead of storing duplicate host information across your continuous integration server, deployment tools, provisioning system, or other CMDB, Hostbase can provide a single, centralized interface for storing and retrieving this information dynamically.

### Technology

[](#technology)

Hostbase uses Couchbase Server to store data with whatever schema you choose, so you're not locked in to any particular data models other than the primary concepts of hosts, subnets, and IPs. These objects are stored as JSON documents in a single Couchbase bucket. Using the Couchbase plug-in for Elasticsearch, data is streamed in real-time from Couchbase to Elasticsearch. This allows for full-text search using [Elasticsearch/Lucene query string syntax](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html). For example, let's assume you "tag" your hosts by role, environment, and data center. To retrieve a list of all hosts of the 'web\_server' role, in the 'QA' environment, in the 'dallas01' data center, the search query might be as simple as: `env:qa AND role:web_server AND datacenter:dallas01`.

In addition to Couchbase and Elasticsearch, Hostbase requires a web server with PHP 5.5 or greater. All search and CRUD operations are available through a RESTful web service.

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

[](#installation)

*A rough overview (everything on a single machine)...*

1. Download and install [Couchbase Server](http://www.couchbase.com/download)
2. On your Couchbase server:
    - Create (or keep) the 'default' bucket. This will be used for sessions / cache.
    - Create a bucket called 'hostbase' (you can call it whatever you want, but the default config supports this naming convention)
3. Download and install [Elasticsearch 1.3.0](http://www.elasticsearch.org/downloads/page/2/).
4. On your Elasticsearch server, create an index called 'hostbase' with at least 1 shard...replicas are optional but recommended. The data can always be re-indexed by replicating from Couchbase again.
5. Install the [Couchbase Plug-in for Elasticsearch](http://www.couchbase.com/couchbase-server/connectors/elasticsearch)
6. Configure Couchbase XDCR to replicate the 'hostbase' bucket to the Elasticsearch cluster
7. Install PHP 5.5 and the web server of your choice (tested with Apache)
8. Install the [Couchbase PHP Client Library](http://www.couchbase.com/communities/php/getting-started)
9. Download/clone this whole repository to the directory of your choice, and configure your web server to serve it as you would any other Laravel-based project. See  for more info. You can also download it with [Composer](http://getcomposer.org) by running `composer create-project shift31/hostbase -s dev`.
10. From the project root, run: `composer install`

Optional, but recommended, download the [CLI](https://github.com/shift31/hostbase-cli) ([PHAR](https://github.com/shift31/hostbase-cli/raw/master/hostbase.phar))

### Development Server (Vagrant)

[](#development-server-vagrant)

**For development or trial purposes, save yourself some installation time and use [Vagrant](http://vagrantup.com). *You'll need 1.5 GB free RAM.***

```
git clone https://github.com/shift31/hostbase.git
cd hostbase
vagrant up
vagrant ssh
cd /vagrant
composer install
```

Configuration
-------------

[](#configuration)

See  for background information on configuring a Laravel-based project.

1. Edit app/config/app.php accordingly.
2. Edit app/config/database.php with your Couchbase server info (if you're running Couchbase on a separate host).
3. Edit app/config/elasticsearch.php as needed. See  for details.
4. If you don't want to use Couchbase's memcached functionality for sessions/cache, edit app/config/session.php and app/config/cache.php accordingly.

Usage
-----

[](#usage)

There's no web UI or bulk raw data (JSON, CSV) import tool yet. So if you have a lot of hosts, your best bet is to use the PHP Client Library and write your own importer. Feel free to explore the importers below for examples.

### REST API endpoints

[](#rest-api-endpoints)

URIActionCommentsGET hostsHostController@indexLists all hostsPOST hostsHostController@storeGET hosts/{host}HostController@showPUT hosts/{host}HostController@updatePATCH hosts/{host}HostController@updateDELETE hosts/{host}HostController@destroyGET subnetsSubnetController@indexLists all subnetsPOST subnetsSubnetController@storeGET subnets/{subnet}SubnetController@showPUT subnets/{subnet}SubnetController@updatePATCH subnets/{subnet}SubnetController@updateDELETE subnets/{subnet}SubnetController@destroyGET ipaddressesIpAddressController@indexLists all IP addressesPOST ipaddressesIpAddressController@storeGET ipaddresses/{ipaddress}IpAddressController@showPUT ipaddresses/{ipaddress}IpAddressController@updatePATCH ipaddresses/{ipaddress}IpAddressController@updateDELETE ipaddresses/{ipaddress}IpAddressController@destroy- Must receive JSON (`Content-Type: application/json`)
    - /hosts
        - Example:

            ```
            {
                "fqdn": "hostname.domain.tld",
                "hostname": "hostname",
                "domain": "domain.tld",
                "adminCredentials": {
                    "username": "admin_username",
                    "password": "admin_password"
                }
            }
            ```
        - Required fields:

            - fqdn
            - hostname (automatically generated from FQDN if not specified)
            - domain (automatically generated from FQDN if not specified)
        - Special (optional) fields:

            - adminCredentials - Passwords will be encrypted prior to storage in the database, and decrypted on retrieval via the API
    - /subnets
        - Example:

            ```
            {
                "network": "10.0.0.0",
                "netmask": "255.255.255.0",
                "gateway": "10.0.0.254",
                "cidr": "24"
            }
            ```
        - Required fields:

            - network
            - netmask
            - gateway
            - cidr
    - /ipaddresses
        - Example:

            ```
            {
                "subnet": "10.0.0.0/24",
                "ipAddress": "10.0.0.1",
                "host": "hostname.domain.tld"
            }
            ```
        - Required fields:

            - subnet
            - ipAddress
- Search, where the 'q' parameter is an elasticsearch/lucene query string:
    - /hosts?q=
    - /subnets?q=
    - /ipaddresses?q=
    - Other parameters:
        - limit (defaults to 10,000; sets the 'size' of Elasticsearch results)
        - showData ('1' = true \[default\], '0' = false)

#### cURL examples

[](#curl-examples)

##### Store a host

[](#store-a-host)

```
curl -H 'Content-Type: application/json' http://hostbase.192.168.33.10.xip.io/hosts -d '
{
    "fqdn": "hostname.domain.tld",
    "hostname": "hostname",
    "domain": "domain.tld",
    "adminCredentials": {
        "username": "admin_username",
        "password": "admin_password"
    }
}' | python -m json.tool
```

##### Show a host

[](#show-a-host)

`curl http://hostbase.192.168.33.10.xip.io/hosts/hostname.domain.tld | python -m json.tool`

##### Update a host (add a field)

[](#update-a-host-add-a-field)

`curl -X PUT -H 'Content-Type: application/json' http://hostbase.192.168.33.10.xip.io/hosts/hostname.domain.tld -d '{ "foo": "bar" }' | python -m json.tool`

##### Update a host (delete a field)

[](#update-a-host-delete-a-field)

`curl -X PUT -H 'Content-Type: application/json' http://hostbase.192.168.33.10.xip.io/hosts/hostname.domain.tld -d '{ "foo": null }' | python -m json.tool`

##### Delete a host

[](#delete-a-host)

`curl -X DELETE http://hostbase.192.168.33.10.xip.io/hosts/hostname.domain.tld | python -m json.tool`

### Command Line Interface

[](#command-line-interface)

The CLI leverages the [API client library](#api-client-library-for-php), so you can administer your Hostbase server from anywhere PHP is installed.

### Importers

[](#importers)

- PuppetDB:
- SoftLayer:

### API Client Library for PHP

[](#api-client-library-for-php)

Security
--------

[](#security)

***If your host and network data is sensitive, it is up to you to provide the firewalls, VPNs, and associated authentication methods to protect your data.***

Basic authentication will be implemented soon, but until then it is recommended (at the very least) to only operate Hostbase server/client on a private network.

To-do / ?
---------

[](#to-do--)

- Tests
- Implement HTTP Basic Authentication with users stored in Hostbase and/or LDAP
- Ansible Playbook to help automate installation
- Integrations
    - Script to periodically update Hostbase from Puppet Facts...likely using Facter output, run via Cron
    - Puppet function to allow querying of Hostbase from Puppet manifests
    - Hiera backend to allow querying of Hostbase from Hiera
- Command line tool to aid initial configuration (driven by Laravel's artisan command)
- API
    - Pagination
    - Sorting
    - Bulk operations
- ...

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

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

Total

2

Last Release

4122d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.4

0.2.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a0e0acacc177f3fa8a27ea5064d5d31b249f0cbf08ef985af77de8499b35ced?d=identicon)[shift31](/maintainers/shift31)

---

Top Contributors

[![bgetsug](https://avatars.githubusercontent.com/u/1869022?v=4)](https://github.com/bgetsug "bgetsug (107 commits)")

### Embed Badge

![Health badge](/badges/shift31-hostbase/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[api-platform/schema-generator

Various tools to generate a data model based on Schema.org vocables

4714.2M7](/packages/api-platform-schema-generator)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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