PHP Classes

PHP KeePassX Writer: Create database of passwords for KeePass

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 59 All time: 10,493 This week: 488Up
Version License PHP version Categories
kpx-writer-php 1.0.0GNU Lesser Genera...5PHP 5, Files and Folders, Unix, Security


This package can create database of passwords for KeePass.

Each site may be included in a group. The class can also be used to define a hierarchy of groups and have a icon image be associated with each group.

It can take the definitions of user account to access sites and the respective passwords and creates a database file for use with the KeePass browser extension.

The resulting password database file is generated using the KeePass utility program that can be run from the command line interface shell.

Innovation Award
PHP Programming Innovation award nominee
January 2021
Number 12
KeePass is a password management application that allows its users to securely store passwords that can be used to access certain sites.

With this application, users do not need to remember and type those passwords every time they need to access a site that is protected by requiring its users to enter a password.

This package allows PHP scripts to run from the command line to create a database file with given site passwords.

Manuel Lemos
Picture of Colin McKinnon
  Performance   Level  
Name: Colin McKinnon <contact>
Classes: 5 packages by
Country: United Kingdom
Age: ???
All time rank: 144867 in United Kingdom
Week rank: 307 Up9 in United Kingdom Up
Innovation award
Innovation award
Nominee: 4x




$kpx=new KeePassWriter(
getenv("HOME") . "/sample.kdbx", // database to create
"letmein", // passphrase for new database
20, // timeout for writing to keepassxc-cli (optional)
'/usr/bin/keepassxc-cli'); // path to binary (optional)

// groups are created automatically, but if we want to assign notes
// or specific icons then we use 'addgroup'
// addgroup($path, $notes, $icon=false)
$kpx->addgroup("/home", "Home folder", KPX_ICON_HOME);
$kpx->addgroup("/infrastructure/network", "Switches etc", KPX_ICON_NETWORK_BOXES);
$kpx->addgroup("/infrastructure/linux", "Linux hosts", KPX_ICON_TUX);
$kpx->addgroup("/infrastructure/external", "3rd Party services", KPX_ICON_CLOUD);
$kpx->addgroup("/infrastructure/Microsoft", "MS Windows hosts", KPX_ICON_MSWINDOWS);
$kpx->addgroup("/applications", "In-house apps", KPX_ICON_YELLOW_DOC);
$kpx->addgroup("/database", "Admin accounts", KPX_ICON_DB_BURGER_KEY);
$kpx->addgroup("/encryption", "Encryption keys", KPX_ICON_KEYRING);

// add some entries
// additem($path, $title, $username, $secret, $url, $notes)
$kpx->additem("/infrastructure/linux", ""
, "root", "sw0rd1sh", "ssh://"
, "Assunming the host is configured to allow root logins via ssh");
$kpx->additem("/infrastructure/network", "admin@"
, "admin", "pass123", "ssh://admin@"
, "Admin user on Cisco");

// we can display the generated XML....
// $kpx->writedata(STDOUT);


  Files folder image Files  
File Role Description
Files folder imageinclude (2 files)
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  include  
File Role Description
  Accessible without login Plain text file Class Class source
  Accessible without login Plain text file Conf. Configuration script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,493
This week:488Up