PHPackages                             csun-metalab/sword-api-uploader - 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. csun-metalab/sword-api-uploader

ActiveLibrary[API Development](/categories/api)

csun-metalab/sword-api-uploader
===============================

Allows for the uploading of documents in a Laravel application to a repository that uses the SWORD API

1.0.0(8y ago)0173MITPHPPHP &gt;=5.5.9

Since May 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/PioneeringTechLab/sword-api-uploader)[ Packagist](https://packagist.org/packages/csun-metalab/sword-api-uploader)[ RSS](/packages/csun-metalab-sword-api-uploader/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

📦 SWORD API Uploader 📦
======================

[](#package-sword-api-uploader-package)

Allows for the uploading of documents in a Laravel project to a repository that uses the SWORD API.

This package is built for version 5.0 of Laravel and above.

📕 Table of Contents
-------------------

[](#closed_book-table-of-contents)

- [Installation](#wrench-installation)
- [Global Environment Variables](#earth_americas-global-environment-variables)
- [Global Deposit Behavior Variables](#seat-global-deposit-behavior-variables)
- [Thesis File Path Environment Variables](#mortar_board-thesis-file-path-environment-variables)
- [Regular File Path Environment Variables](#page_facing_up-regular-file-path-environment-variables)
- [Usage](#computer-usage)
- [Underlying SWORD API Functionality](#electric_plug-underlying-sword-api-functionality)

🔧 Installation
--------------

[](#wrench-installation)

To install from Composer, use the following command:

```
composer require csun-metalab/sword-api-uploader

```

Now, add the following lines to your `.env` file to configure your connection to the repository:

```
SWORD_SERVICE_DOC=
SWORD_DEPOSIT=
SWORD_USERNAME=
SWORD_PASSWORD=

```

You'll also need to add other lines further down as defined in either the [Thesis File Path Environment Variables](#thesis-file-path-environment-variables) or [Regular File Path Environment Variables](#regular-file-path-environment-variables) section based on the type of deposit you're performing.

Next, add the service provider to your `providers` array in Laravel as follows:

```
'providers' => [
   //...

   CSUNMetaLab\SwordUploader\Providers\SwordServiceProvider::class,

   // You can also use the following depending on Laravel convention:
   // 'CSUNMetaLab\SwordUploader\Providers\SwordServiceProvider',

   //...
],

```

Add the `Sword` facade to your `aliases` array in Laravel as follows:

```
'aliases' => [
   //...

   'Sword' => CSUNMetaLab\SwordUploader\Facades\Sword::class,

   // You can also use the following depending on Laravel convention:
   // 'Sword' => 'CSUNMetaLab\SwordUploader\Facades\Sword',
],

```

Finally, run the following Artisan command to publish the configuration file:

```
php artisan vendor:publish

```

The configuration file will be in `config/sword.php` and you can modify those values further with the `config()` helper function before the deposit takes place.

The packaging and deposit functionality use those configuration values in order to figure out the service document, credentials, repository identifier, and the relevant directories on the filesystem.

🌎 Global Environment Variables
------------------------------

[](#earth_americas-global-environment-variables)

The environment variables you added to your `.env` file are the following:

### SWORD\_SERVICE\_DOC

[](#sword_service_doc)

This is the identifier for the service document the repository uses for SWORD uploads/deposits.

### SWORD\_DEPOSIT

[](#sword_deposit)

This is the identifer for the repository where SWORD uploads/deposits will be performed.

### SWORD\_USERNAME

[](#sword_username)

This is the username that will be used for authentication during SWORD operations.

### SWORD\_PASSWORD

[](#sword_password)

This is the password that will be used for authentication during SWORD operations.

💺 Global Deposit Behavior Variables
-----------------------------------

[](#seat-global-deposit-behavior-variables)

You only need to add these environment variables if you want to override the default behavior during deposit operations.

### SWORD\_CONTENT\_TYPE

[](#sword_content_type)

Allows you to change the content type of deposits. The default is `application/zip`.

### SWORD\_PACKAGING

[](#sword_packaging)

Allows you to change the packaging format of deposits. The default is `http://purl.org/net/sword-types/METSDSpaceSIP` (METS format for a DSpace repository).

### SWORD\_ON\_BEHALF\_OF

[](#sword_on_behalf_of)

Allows you to set the `X-On-Behalf-Of` header during deposits. The default is an empty string.

### SWORD\_NO\_OP

[](#sword_no_op)

Allows you to set the `X-No-Op` header during deposits. The default is `false`.

### SWORD\_VERBOSE

[](#sword_verbose)

Allows you to set the `X-Verbose` header during deposits. The default is `false`.

🎓 Thesis File Path Environment Variables
----------------------------------------

[](#mortar_board-thesis-file-path-environment-variables)

You need to add these environment variables if you are performing deposits for theses or academic dissertations.

Add the following values to your `.env` file and then configure them appropriately based on their descriptions:

```
# Root directories where final thesis drafts and supplemental files are located
# These directories will be used when packaging files to send to the repository
SWORD_THESIS_DOCUMENT_ROOT_IN=
SWORD_THESIS_SUPPLEMENTAL_ROOT_IN=

# Root directories where the packaged archive and the METS file will be written
# out to on the filesystem after being packaged (before sending to the repo)
SWORD_THESIS_PACKAGE_ROOT_OUT=
SWORD_THESIS_METS_ROOT_OUT=

```

### SWORD\_THESIS\_DOCUMENT\_ROOT\_IN

[](#sword_thesis_document_root_in)

This is the directory on the filesystem that holds the single thesis document file (PDF, DOCX, etc) that will be packaged.

### SWORD\_THESIS\_SUPPLEMENTAL\_ROOT\_IN

[](#sword_thesis_supplemental_root_in)

This is the directory on the filesystem that holds any supplemental files associated with the theses.

### SWORD\_THESIS\_PACKAGE\_ROOT\_OUT

[](#sword_thesis_package_root_out)

This is the directory on the filesystem to where the package (ZIP file containing a thesis plus any of its supplemental files) will be written.

### SWORD\_THESIS\_METS\_ROOT\_OUT

[](#sword_thesis_mets_root_out)

This is the directory on the filesystem to where the metadata (mets.xml) file that describes properties associated with the thesis will be written.

📄 Regular File Path Environment Variables
-----------------------------------------

[](#page_facing_up-regular-file-path-environment-variables)

You need to add these environment variables if you are performing non-thesis deposits for regular files (such as class syllabi).

Add the following values to your `.env` file and then configure them appropriately based on their descriptions:

```
# Root directory and subdirectory where the files to deposit are located. The
# subdirectory must be within the root directory.
SWORD_FILE_ROOT_IN=
SWORD_FILE_SUBDIR_IN=

# Root directory where the packaged archive will be written out on the filesystem
# before depositing in the repository
SWORD_PACKAGE_ROOT_OUT=

```

### SWORD\_FILE\_ROOT\_IN

[](#sword_file_root_in)

This is the directory on the filesystem where the subdirectory is located

### SWORD\_FILE\_SUBDIR\_IN

[](#sword_file_subdir_in)

This is the directory on the filesystem containing the files that will be deposited

### SWORD\_PACKAGE\_ROOT\_OUT

[](#sword_package_root_out)

This is the directory on the filesystem where the package (ZIP file containing the file to deposit) will be written.

💻 Usage
-------

[](#computer-usage)

Coming Soon!

🔌 Underlying SWORD API Functionality
------------------------------------

[](#electric_plug-underlying-sword-api-functionality)

The underlying SWORD API functionality for packaging and depositing documents originally comes from `swordapp-php-library` created by Stuart Lewis.

You can find the code specific to the library here:

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3279d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef2f088dbe515e7505204053ba4b89fab631db23d7638297853dc697adf7ddc4?d=identicon)[matthewfritz](/maintainers/matthewfritz)

![](https://www.gravatar.com/avatar/5c86fd91fdf698dd5c9ceffd3dce175a6ae3000d00f4c00bf65b2e97f19072a1?d=identicon)[csun-metalab](/maintainers/csun-metalab)

![](https://www.gravatar.com/avatar/eb2e4b7e97c47122102e9eca3a2707f31d812f27d774197f62f27f130d128e49?d=identicon)[luisjg](/maintainers/luisjg)

---

Top Contributors

[![matthewfritz](https://avatars.githubusercontent.com/u/1715181?v=4)](https://github.com/matthewfritz "matthewfritz (35 commits)")[![luisjg](https://avatars.githubusercontent.com/u/16617588?v=4)](https://github.com/luisjg "luisjg (2 commits)")

### Embed Badge

![Health badge](/badges/csun-metalab-sword-api-uploader/health.svg)

```
[![Health](https://phpackages.com/badges/csun-metalab-sword-api-uploader/health.svg)](https://phpackages.com/packages/csun-metalab-sword-api-uploader)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

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

A PHP wrapper for Twilio's API

1.6k92.9M270](/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.1M453](/packages/google-gax)

PHPackages © 2026

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