-
Notifications
You must be signed in to change notification settings - Fork 17
/
README
117 lines (87 loc) · 4.56 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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 ([email protected]) 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/)