PHP Classes

How to Create a PHP XML Database Using the PackagexmlDB: Manipulate XML files like a database

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 577 All time: 5,340 This week: 660Up
Version License PHP version Categories
xmldb 1.0GNU General Publi...5.0XML, PHP 5
Description 

Author

This class can manipulate XML files like a database.

It provides functionalities to create XML files, as well as to retrieve, update, and delete data records in a simple and efficient way.

The class offers an intuitive interface to interact with the data contained in the XML, manipulating it in memory before saving the changes back to the file, ensuring data integrity and security during the process.

Picture of Rodrigo Reis
Name: Rodrigo Reis <contact>
Classes: 1 package by
Country: Brazil Brazil

Instructions

Please check the example script to learn how to use this package.

Example

<?php

include("xmlDB.class.php");

$xml = new xmlDB("file.xml", "user");

// uncomment the lines below to activate the functions of the class.

// INSERT PROCEDURE:
/*
$user = array();
$user["code"] = 1;
$user["name"] = "John Doe";
$user["email"] = "[email protected]";
$xml ->addItem($user);
*/




// RETRIVE ONDE RECORD:
/*
$user = array();
$user = $xml -> find(1);

foreach ($user as $key => $value) {
    printf("%s: %s <br>", $key, $value);
}
*/




// RETRIVE ALL RECORDS
/*
$user = $xml -> xmlContent;

foreach ($user as $key => $value) {

    foreach ($value as $vKey => $vValue) {
        printf("%s: %s <br>", $vkey, $vvalue);
    }
    print("<br>");
}
*/




// EDIT PROCEDURE:
/*
$user = array();
$user["code"] = 1;
$user["name"] = "Carl Doe";
$user["email"] = "[email protected]";
$xml -> editItem(1, $user);
*/




// DELETE PROCEDURE:
/*
$xml -> removeItem(1);
*/
?>


  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file file.xml Output The XML file to storage data
Accessible without login Plain text file index.php Example The example of use
Accessible without login Plain text file licence.txt Lic. Licence
Plain text file xmlDB.class.php Class The xmlDB class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:577
This week:0
All time:5,340
This week:660Up