Download the PHP package twigger/unioncloud without Composer

On this page you can find all versions of the php package twigger/unioncloud. 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 unioncloud

PHP UnionCloud API Wrapper

Toby Twigger ([email protected]) on behalf of Bristol SU (https://www.bristolsu.org.uk).

Scrutinizer Code Quality Build Status

Installation

Add twigger/unioncloud as a require dependency in your composer.json file:

Require composer's autoload, and point your scripts to the UnionCloud namespace

Laravel

Support for Laravel is supplied out of the box

Configuration

Publish the UnionCloud configuration

Add the following to your .env file

If you're using the version 1 authentication (AWS), you will instead need the following:

If you're using Laravel <5.5, you'll also need to register the service provider in the array in

To resolve the UnionCloud instance from the Laravel service container

This will be set with your authentication parameters and base URL.

Usage

Setup

Create a new UnionCloud Wrapper:

This takes an associative array of authentication parameters. For example,

Set all relevant global configuration values. These are currently the base URL and the debug option.

Making Requests

Any requests made take the following format:

If your IDE supports DocBlocks, you should have hints at all available resources and methods.

Resource to interact with

These take the plural form of the resource name in camelCase. For example,

A resource specific request class will be returned, containing all methods available to that resource.

Request specific configurations

This allows you to change the specifics of your API call. The following methods are available

Specific API call

You may now make a call to the correct API endpoint. The Request class contains instructions for the BaseRequest class as to how to create the API request. For example, you may call the search() function in the UserRequest class. This takes an array of parameters to search by.

Look at your IDE hints to determine which methods are available to you.

Format to recieve the response in

To make interacting with UnionCloud as simple as possible, you may request different types of response class. You may recieve one of the following:

Chaining

In order to achieve clean code, chaining is allowed. The following line will search for a user called Toby and return the first user as a UserResource class. We assume $unionCloud contains a UnionCloud class which has the correct authentication parameters passed.

We could also specify the mode to search by.

Or if we wanted to check the request was successful:

Using ResourceClasses

To make developing with UnionCloud easier, we provide data in a ResourceClass. There is a ResourceClass per resource, which may contain helpful functions to interact with that resource. For example, the UserResource class may contain a function called isOver18(), which will check if the user is over 18.

To access variables present in a resource class, just treat them as class properties. Given $user contains a populated UserResource class, the following may be used to look at information about a particular user

Casting

To further improve workflows, we automatically cast certain parameters to a specific type. For example, a date field will be shows as a Carbon instance, and a name field will be correctly capitalised.

Basic Casting

You don't have to worry about casting manually unless you're developing or modifying a Resource class.

In the Resource class, there is a variable called $casts. This defines the resource attribute keys, and the format we should cast it to. Currently the available options are

We will pass each usergroup membership into the resource constructor to produce a resource class for each membership.

Always use camelCase for specifying attributes!

Advanced Casting

For some API calls, two or more resources are returned in the same array. For example, the following may be returned:

In this case, use the $customCasts array. Each key should contain the new attribute you want to create and the new resource class to insert into that attribute, seperated with a pipe. The value should be an array of mappings, from the current attributes to the new resource attributes. In the above example, if we wanted the data to look like

we could specify the following cast

Pagination

Pagination only applies if the API has been set up to handle pagination. By this, we mean in the API Instructions (the method in the specific Request Class), the function $this->enablePagination() has been called.

The developer using this repo must also request pagination functionality for each api call. This can be done by, for example

This will return a UserRequest class.

The following methods are now available to be used:

Contributing

This is an unfinished repository, any any contributions would be welcomed! The following is an incomplete list of things to be done.

Repository Documentation

The automatically generated phpDocumentor documentation may be found on Github Pages phpDoc Documentation


All versions of unioncloud with dependencies

PHP Build Version
Package Version
Requires nesbot/carbon Version ^2.24
guzzlehttp/guzzle Version ^6.3|^7.0
ext-json Version *
aws/aws-sdk-php Version ^3.0@dev
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 twigger/unioncloud contains the following files

Loading the files please wait ....