PHPackages                             swordapp/swordappv2-php-library - 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. [API Development](/categories/api)
4. /
5. swordapp/swordappv2-php-library

ActiveLibrary[API Development](/categories/api)

swordapp/swordappv2-php-library
===============================

SWORD v2 PHP API library

1623315[1 issues](https://github.com/swordapp/swordappv2-php-library/issues)PHP

Since Apr 15Pushed 1y ago3 watchersCompare

[ Source](https://github.com/swordapp/swordappv2-php-library)[ Packagist](https://packagist.org/packages/swordapp/swordappv2-php-library)[ RSS](/packages/swordapp-swordappv2-php-library/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

```
Welcome to the SWORD v2 PHP client library!
-------------------------------------------
Version: 0.1

The SWORDAPP v2 PHP client library is a PHP library designed to assist with
the creation of SWORD deposit tools. The client library allows PHP code to
easily make use of the two SWORD functions:

 - GETting a Service Document
 - POSTing a package or file into a repository
 - PUTting an updated file into a repository
 - DELETEing a file or item from a repository

The library was originally written by Stuart Lewis (stuart@stuartlewis.com) as
part of the JISC funded SWORD2 project. Limited support for the library is
availble via the sword-app-tech email list:

 - https://lists.sourceforge.net/lists/listinfo/sword-app-tech

The latest version of the library can be downloaded from GitHub:

 - https://github.com/stuartlewis/swordappv2-php-library/

Licence
-------
The library is licenced with the New BSD Licence. See the file LICENCE in the
distribution directory.

SWORD Compatibility
-------------------
This version of the library is compatible with SWORD version 2.0

Prerequisites
-------------
This library requires:

 - PHP version 5
    + CURL extension
    + SimpleXML extension
    + ZIP extension (for the packager only)

How to use the library
----------------------
The easiest way to understand the library is to look at the
test/test-swordappclient.php file which exercises all the functions and
variables of the library.

The main methods to use are from swordappclient.php:

 - servicedocument($sac_url, $sac_u, $sac_p, $sac_obo)
 - deposit($sac_url, $sac_u, $sac_p, $sac_obo, $sac_fname, $sac_packaging= '', $sac_contenttype = '', $sac_inprogress = false)
 - depositMultipart($sac_url, $sac_u, $sac_p, $sac_obo, $sac_package, $sac_inprogress = false)
 - depositAtomEntry($sac_url, $sac_u, $sac_p, $sac_obo, $sac_fname, $sac_inprogress = false)
 - completeIncompleteDeposit($sac_url, $sac_u, $sac_p, $sac_obo)
 - retrieveContent($sac_url, $sac_u, $sac_p, $sac_obo, $sac_accept_packaging = "")
 - retrieveDepositReceipt($sac_url, $sac_u, $sac_p, $sac_obo, $sac_accept_packaging = "")
 - replaceFileContent($sac_url, $sac_u, $sac_p, $sac_obo, $sac_fname, $sac_packaging= '', $sac_contenttype = '', $sac_metadata_relevant = false)
 - replaceMetadata($sac_url, $sac_u, $sac_p, $sac_obo, $sac_fname, $sac_inprogress = false)
 - replaceMetadataAndFile($sac_url, $sac_u, $sac_p, $sac_obo, $sac_package, $sac_inprogress = false)
 - addExtraFileToMediaResource($sac_url, $sac_u, $sac_p, $sac_obo, $sac_fname, $sac_contenttype = '', $sac_metadata_relevant = false)
 - addExtraPackage($sac_url, $sac_u, $sac_p, $sac_obo, $sac_fname, $sac_packaging = '', $sac_contenttype, $sac_inprogress = false)
 - addExtraAtomEntry($sac_url, $sac_u, $sac_p, $sac_obo, $sac_fname, $sac_inprogress = false)
 - addExtraMultipartPackage($sac_url, $sac_u, $sac_p, $sac_obo, $sac_package, $sac_inprogress = false)
 - deleteContainer($sac_url, $sac_u, $sac_p, $sac_obo)
 - deleteResourceContent($sac_url, $sac_u, $sac_p, $sac_obo)
 - retrieveAtomStatement($sac_url, $sac_u, $sac_p, $sac_obo)
 - retrieveOAIOREStatement($sac_url, $sac_u, $sac_p, $sac_obo)

The functions return a SWORDAPPServiceDocument, a SWORDAPPEntry, a
SWORDAPPResponse or a SWORDAPPErrorDocument object as appropriate.
These classes can then be interrogated (e.g. $servicedocument->sac_workspaces).

The main function parameters are:

 - $sac_url: The URL to interact with (e.g. service document URL, deposit URL, etc)
 - $sac_u: The username
 - $sac_p: The password
 - $sac_obo: The on-behalf-of user name (optional, can be left empty)
 - $sac_fname: Filename to deposit
 - $sac_packaging: THe packaging format of the package being deposited
 - $sac_inprogress: Whether or not the deposit should be considered 'in-progress'

The SWORD v2 specification can be seen at:

 - http://swordapp.org/sword-v2/sword-v2-specifications/

Packages
--------
Deposits can be made using packages.  By default, all SWORD v2 interfaces
should accept Atom Multipart pacakges.  These can be generated using the
'package_atom_multipart.php' class.

Some repositories will accept METS+SWAP packages.  These can be generated
using the 'package_mets_swap.php' class.

Examples
--------
An example website that can also be used for testing is included in
test/website/index.php

Configure your web server to serve that directory (and child directories)
to try the application.

Example uses of the packagers, and the SWORD client can be seen in the
/test directory.

Changes
-------
0.1 (18th October 2011)
 - First release, forked from version 1 of the library
   (https://github.com/stuartlewis/swordapp-php-library/)
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.6% 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/832684358c36675f38f95853b9b7e12041b93d060bd494ae5f4a41fa9de4ea35?d=identicon)[stuartlewis](/maintainers/stuartlewis)

---

Top Contributors

[![stuartlewis](https://avatars.githubusercontent.com/u/135022?v=4)](https://github.com/stuartlewis "stuartlewis (127 commits)")[![jwhitney](https://avatars.githubusercontent.com/u/342343?v=4)](https://github.com/jwhitney "jwhitney (6 commits)")[![MrRob100](https://avatars.githubusercontent.com/u/43947674?v=4)](https://github.com/MrRob100 "MrRob100 (3 commits)")[![thiagolepidus](https://avatars.githubusercontent.com/u/79112589?v=4)](https://github.com/thiagolepidus "thiagolepidus (3 commits)")[![bensteinberg](https://avatars.githubusercontent.com/u/3776423?v=4)](https://github.com/bensteinberg "bensteinberg (2 commits)")[![mtrojan-ub](https://avatars.githubusercontent.com/u/26873381?v=4)](https://github.com/mtrojan-ub "mtrojan-ub (1 commits)")[![asmecher](https://avatars.githubusercontent.com/u/200411?v=4)](https://github.com/asmecher "asmecher (1 commits)")[![quoideneuf](https://avatars.githubusercontent.com/u/1626547?v=4)](https://github.com/quoideneuf "quoideneuf (1 commits)")[![rcaap-fccn](https://avatars.githubusercontent.com/u/9481918?v=4)](https://github.com/rcaap-fccn "rcaap-fccn (1 commits)")

### Embed Badge

![Health badge](/badges/swordapp-swordappv2-php-library/health.svg)

```
[![Health](https://phpackages.com/badges/swordapp-swordappv2-php-library/health.svg)](https://phpackages.com/packages/swordapp-swordappv2-php-library)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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