Download the PHP package caseyamcl/wosclient without Composer

On this page you can find all versions of the php package caseyamcl/wosclient. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wosclient

Client for DDN Web Object Scalar (WOS) HTTP API

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads

This library is a portable HTTP client for the DDN Web Object Scalar storage system HTTP API.

Unlike the official DDN PHP client, this library communicates with the WOS device over HTTP, and does not require the installation of any PHP C extensions.

Install

This library requires PHP v5.5 or newer. It has been tested with PHP7. If you wish to run tests, you must run v5.6 or newer.

I also recommend installing the ext-curl PHP extension.

Via Composer

Note: By default, this library uses Guzzle v6.0. However, if you do not wish to use Guzzle 6, you can create your own implementation by implementing the WosClientInterface yourself (details below).

Usage

This library uses PSR-4 autoloading. If you are not using Composer or another PSR-4 autoloader, you will need to manually include all of the files in the src/ directory (but I highly discourage this; use an autoloader!).

If you know the URL to your WOS API and your WOS Policy name or ID, you can create a WosClient instance by calling the WosClient::build() constructor. Pass in the URL to your WOS API and your WOS Policy name or ID:

The WosClient contains several public methods for interacting with the object storage API:

All of these methods optionally accept an array of Guzzle HTTP request options as the last method parameter. If you pass any options in this way, they will override all default and computed request options. If you pass in HTTP headers in this way, they will be merged with the default headers (see Guzzle Docs).

Using responses

The WosClient::getObject() method returns an instance of WosClient\WosObject:

The WosClient::getMetadata() and the WosObject::getMetadata() methods return an instance of WosClient\WosObjectMetadata:

The WosClient::putObject() and WosClient::reserveObject() methods return an instance of WosClient\WosObjectId:

Streaming large objects

The WOS supports objects up to 5 terabytes in size!

If the object you are retrieving from the WOS server is very large, it is not a good idea to read the entire thing into memory at once.

Fortunately, by default, this library will stream data from the WOS server, instead of downloading it into memory. The library uses the PSR-7 StreamableInterface to accomplish this.

To stream a large file, simply seek through it rather than converting it to a string:

Another way to stream data from your WOS server is to specify the $range parameter of the WosClient::getObject() to retrieve only chunks of the large object at a time:

Handling errors

This library converts all application-layer runtime errors into instances of WosClient\Exception\WosException. There are three sub-classes:

Example:

Note that WosServerException is ONLY thrown when the server emits a response with the x-ddn-status header present, and the header is a non-zero value.

It is NOT thrown in the event of any other HTTP transmission error (such as network timeout, or an internal WOS server error). You can catch these types of HTTP errors separately, by catching Guzzle exceptions:

The Guzzle library contains a number of different exception classes for specific error cases, in case you wish to be more specific about your exception handling.

Instantiating with a custom Guzzle 6 client instance

You may wish to use your own Guzzle 6 Client instance to make requests to the WOS server. Some examples of why you may wish to do this include:

To use a custom Guzzle client instance, simply use the main constructor for the WosClient\WosClient class instead of the build() constructor.

The base_uri parameter MUST be set in your Guzzle client class, or the library will throw a \RuntimeException during object construction. This value must be the URL for one of your WOS nodes.

You also may wish to set the x-ddn-policy header, so that you do not need to specify it in each request:

Creating a different WOS Client implementation

You may wish to write your own implementation for the interfaces included in this library. The only dependency in this case is that you must include the "psr/http-message": "~1.0" package.

If your implementation uses a PSR-7 compliant HTTP library, you only need to implement the WosClient\WosClientInterface. You can use the built-in implementations of all other classes.

If, however, your implementation does NOT implement PSR-7, you will need to implement the following interfaces:

Each interface file contains pretty good documentation for how its methods should behave.

Note that you should only throw exceptions in specific cases:

Change log

Please see CHANGELOG for more information about what has changed recently.

Testing

To run tests, be sure that you have installed all of the dependencies in the require-dev portion of the composer.json file.

Run unit tests:

This library also includes a simple console utility to test the client against your own WOS device. The test suite writes two tiny objects to the WOS and then deletes them:

Run the PHP CodeSniffer to detect style errors:

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of wosclient with dependencies

PHP Build Version
Package Version
Requires php Version ~5.5|~7.0
psr/http-message Version ~1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package caseyamcl/wosclient contains the following files

Loading the files please wait ....