-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
172 lines (135 loc) · 6.31 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
Welcome to the SWORDAPP PHP client library!
-------------------------------------------
Version: 1.0
The SWORDAPP 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 file into 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
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 1.3
Prerequisites
-------------
This library requires:
- PHP version 5
+ CURL extension
+ SimpleXML extension
+ ZIP extension (for the packager only)
To test the library run the following from the command line to request a
service document and deposit a package:
- php test-swordappclient.php
In order to use this test script you will need a username and password for a
SWORD repository. If you don't have one, you can sign up for one at
http://dspace.swordapp.org/jspui/register Once you have done so, enter your
email address and password in to the test-swordappclient.php script.
The library also comes with a packager to convert a file and metadata into
a package (zip file) containing the metadata encoded in METS and SWAP along
with the file.
You can create a test deposit package by running:
- php test-packager-mets_swap.php
How to use the library
----------------------
The easiest way to understand the library is to look at the
test-swordappclient.php file which exercises all the functions and variables of
the library.
The two main methods of use are from swordappclient.php:
- function servicedocument(url, username, password, on-behalf-of-user)
- function deposit(url, username, password, on-behalf-of-user, filename,
[format_namespace, package_type, noop, verbose])
The functions return a SWORDAPPServiceDocument, a SWORDAPPEntry or a
SWORDAPPErrorDocument object as appropriate. These classes can then be
interogated (e.g. $servicedocument->sac_workspaces).
Examples
--------
Example SWORD applications are included in the examples directory:
- examples/imap-email/ An example client that reads emails from an IMAP
mail folder, and deposits them using SWORD.
Changes
-------
1.1 (dd mmmm yyyy)
- Added support to set the publisher in pacakger_mets_swap.php
- Ensure zip packages are overwritten when created by the packager
(Thanks to Andrea Schweer)
- Typo updates and small fix in logic
(Thanks to Jesús García Crespo)
1.0 (21 April 2011)
- Removed hard coded language from SWAP/METS packager. Can now be set
by setLanguage function.
- Fixed issue with chunked encoding and the lack of a Content-Length header
when depositing to Apache-based servers
- Clarified wording of licence used in README
- Fixed typo in error reporting of filename in pacakger_mets_swap.php
(Thanks to Alec Smecher)
- Fixed setting of Type in packager_mets_swap.php
(Thanks to Andrea Schweer)
- Added option to store dcterms subject in package
(Thanks to James Verity Clemence)
- Added options to store provenance and rights information in package
- Fixing invalid METS packages
(Thanks to Gareth Waller)
0.9 (5th October 2009)
- Fixed typos in test-packager-mets_swap.php that meant it didn't create a
proper package
- Added some validation to the SWAP/METS packager to allow it to cope with
filenames containing ampersands
- Changed swordappservicedocument to build the servcedocument from the xml
response rather than having the swordappclient do the work. This allows
the service document to be parsed at a later time.
- Changed the swordappclient deposit method to stream the file being
deposited straight from disk rather than via memory to avoid using
excessive memory and potentially exceeding the PHP memory limit.
0.8 (28th July 2009)
- Added example IMAP email application (/examples/imap-email/imap-email.php)
0.7 (23rd June 2009)
- Added X-No-Op and X-Verbose facility to deposits in deposit method
- Added 'Content-Disposition: filename=' in the deposit method
0.6 (29th April 2009)
- Corrected typo in deposit entry document http status response text
- Entry documents now do not require src and type attributes in the content
- Extended the METS/SWAP packager to contain more than one file
- Fixed swordappentry bug with undefined constants
- Fixed variable name typo in SWAP/METS packager in the the exception
thrown by the create method
- Client now accepts responses in the 2xx range, rather than just 201
0.5 (12th December 2008)
- Upgraded support to SWORD version 1.3. Support for version 1.2 deprecated
- Changed sword:level to sword:version
- Added user-agent header to all transactions
- Added support for nested service documents into collection.php
- Added support for maxUplaodSize in service documents
- Added support for acceptPackaging in service documents
- Deposit process now sets X-Packaging header
- atom:generator now ready from entry, not from entry/source
- Error documents created when deposits fail
- Renamed swordappdeposit.php to swordappentry.php
- Added new class swordapperrordocument.php to handle error documents
0.4 (30th November 2008)
- Fixes bug where atom documents using atom as a default namespace are not
parsed correctly
- Corrected typo in format namespace variable name
- Changed README and test-swordappclient.php to make user sign up for their
own SWORD user on a repository
0.3 (3rd November 2008)
- Classes SWORDAPPServiceDocument and SWORDAPPDeposit now store the
raw XML returned for debudding ($sac_xml)
- The deposit function now accepts optional parameters for format-namespace
and content-disposition
- MD5 checksums are now created for deposited files and the Content-MD5 header
set
- Added copyrightHolder and bibliographicCitation elements to mets/swap
packager
0.2 (28th October 2008)
- Added exception handling to swordappclient.php
- Created packager-mets_swap.php
- Renamed test files
0.1 (20th September 2008)
- First release