PHPackages                             wizdam/bagit-php - 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. wizdam/bagit-php

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

wizdam/bagit-php
================

BagIt Library for LOCKSS Personal Lockers Network (PLN)

10

Since May 24Compare

[ Source](https://github.com/mokesano/bagit-php)[ Packagist](https://packagist.org/packages/wizdam/bagit-php)[ RSS](/packages/wizdam-bagit-php/feed)WikiDiscussions Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

📦 BagIt PHP — *Wizdam Edition*
==============================

[](#-bagit-php--wizdam-edition)

**A modern, PHP 8.x‑ready library for creating, manipulating and validating [BagIt](https://datatracker.ietf.org/doc/rfc8493/) bags – the standard packaging format for digital preservation in the [LOCKSS Personal Lockers Network (PLN)](https://www.lockss.org/).**

---

 [ ![PHP Version](https://camo.githubusercontent.com/ec4962d225fc7b20184271f15a8fef64bdddb8b798b45a45b961405ee5849989/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d5e382e342d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465) ](https://github.com/mokesano/bagit-php) [ ![License](https://camo.githubusercontent.com/5e28cad15e34f3657f015380cf2cc237437f0c33d6b1bf8a3627672153b2ae1e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c253230332e302d2d6f6e6c792d626c75653f7374796c653d666f722d7468652d6261646765) ](https://github.com/mokesano/bagit-php/blob/main/LICENSE) [ ![Packagist](https://camo.githubusercontent.com/4aade818d0027ddb112b951696bdb60ced558dbac7afe1b6a6466a3ddc497c83/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7061636b61676973742d77697a64616d25324662616769742d2d7068702d4632384431413f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465) ](https://packagist.org/packages/wizdam/bagit-php) [ ![Build](https://camo.githubusercontent.com/17bca7275f057706c0529bd72d3e8688a547ac2f2fff9feb4b87a130563a96db/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c642d70617373696e672d627269676874677265656e3f7374796c653d666f722d7468652d6261646765266c6f676f3d6769746875622d616374696f6e73266c6f676f436f6c6f723d7768697465) ](https://github.com/mokesano/bagit-php/actions) [ ![Security Policy](https://camo.githubusercontent.com/6889b4c6f48c433c02fb696018924ecb82f46325136542adaeb27d0bf3c1387f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73656375726974792d706f6c6963792d696d706f7274616e743f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562) ](https://github.com/mokesano/bagit-php/security/advisories)

 *🔐 Ensure integrity · 📋 Generate manifests · 🌐 Fetch remote content · ✅ Validate bags*

---

📖 About the Project
-------------------

[](#-about-the-project)

BagIt PHP is a **PHP implementation of the [BagIt 0.96 specification](https://wiki.ucop.edu/display/Curation/BagIt)** (now standardized as [RFC 8493](https://datatracker.ietf.org/doc/rfc8493/)). A "bag" is a self‑describing, integrity‑checked container that bundles digital payload files together with their metadata – making it ideal for archival storage, network transfer, and long‑term digital preservation.

This **Wizdam Edition** is a complete modernization of the original [scholarslab/BagItPHP](https://github.com/scholarslab/BagItPHP) library, fully refactored for **PHP 8.4+** compatibility, PSR‑4 autoloading, and seamless integration with Composer. It is purpose‑built to support the **LOCKSS PLN (Private LOCKSS Network)** ecosystem, where integrity‑verified content packages are critical for distributed preservation workflows.

---

✨ Key Features
--------------

[](#-key-features)

🔧 Feature📝 Description**Bag Compilation**Create new bags from scratch with a single constructor call**Manifest Generation**Automatically generate `manifest-{sha1,md5}.txt` and `tagmanifest-{sha1,md5}.txt`**Tag File Handling**Read and write `bagit.txt`, `bag-info.txt` and custom tag files**Remote Fetching**Download files listed in `fetch.txt` via HTTP (optional)**Validation**Full integrity checking – checksum verification, required file/directory presence**Compression**Export bags as `.tgz` (gzip) or `.zip` archives**Dual Hash Support**Choose between **SHA‑1** and **MD5** hashing algorithms on the fly**Extended Bag Mode**Optional creation of `bag-info.txt`, `fetch.txt`, and tag manifests**PHP 8.4+ Native**Fully compatible with modern PHP – type‑safe, deprecation‑free**PSR‑4 Autoloading**PSR‑4 namespaced under `Wizdam\BagIt` for immediate Composer autoloading---

🚀 Installation
--------------

[](#-installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

```
composer require wizdam/bagit-php
```

### Manual Installation

[](#manual-installation)

Clone the repository and include the autoloader:

```
git clone https://github.com/mokesano/bagit-php.git
cd bagit-php
composer install
```

### Requirements

[](#requirements)

- **PHP** ≥ 8.4
- **PEAR `Archive_Tar`** ≥ 1.4 (automatically pulled by Composer)

---

⚡ Quick Start
-------------

[](#-quick-start)

### 🆕 Create a New Bag

[](#-create-a-new-bag)

```
