Download the PHP package owncloud/ocis-php-sdk without Composer

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

Build Status Coverage Code Smells Quality Gate Status Security Rating

ocis-php-sdk

This SDK allows you to interact with ownCloud Infinite Scale (oCIS) storage using PHP.

Documentation

You can find a rendered version of the API documentation in our dev docs.

To render the documentation locally, use the phpDocumentor to run it in the local repo. E.g.:

After that you will find the documentation inside the docs folder.

Installation via Composer

Add "owncloud/ocis-php-sdk" to the require block in your composer.json and then run composer install.

[!WARNING]
The ocis-php-sdk currently relies on a development version of the "owncloud/libre-graph-api-php" package. To ensure proper dependency resolution, it is necessary to set "minimum-stability": "dev" and "prefer-stable": true in your composer.json file.

Alternatively, you can simply run the following from the command line:

Getting started

Ocis has two types of access token, one which is used to interact with drive, group, user, shares etc.(OICD access token) and another which can be used to interact with education endpoints (education access token).

Create an Ocis object using the service Url and an OIDC access token:

Or create an Ocis object to interact with education endpoints using the service Url and an education access token:

At least one access token should be provided to use the SKD.

Acquiring an OICD access token is out of scope of this SDK, but you can find examples for that below.

Also refreshing OICD tokens is not part of the SDK, but after you got a new token, you can update the Ocis object:

Education access token is set when starting the ocis graph server. You can get it using following snippet

Drives (spaces)

Drives can be listed using the getAllDrives or the getMyDrives method.

The Drive class is responsible for most file/folder related actions, like listing files, creating folders, uploading files, etc.

Drive Permission

Users/Groups can be invited to drives by specifying permissions. The Drive class has methods to invite Users/Groups, update permission roles and expiration dates, remove users and groups, etc.

Drive invitations are only possible on project drives.

Notifications

Notifications can be listed using the getNotifications method, which will return an array of Notification objects representing all active notifications.

The Notification object can retrieve details of the corresponding notification and mark it as read (delete).

Sharing

Given the correct permissions, an OcisResource can be shared with a group or a user. To define the access permissions of the receiver every share has to set SharingRole(s).

Education User

Education Users can only be created, listed and deleted using education access token. If you want to use other APIs you need to use the OICD access token.

Requirements

Acquiring an Access Token

For an easier experience in acquiring an access token, several PHP OIDC client libraries are available. The following code snippet showcases how to retrieve an access token with the facile-it/php-openid-client library.

Install PHP dependencies

You can install the facile-it/php-openid-client library using composer:

Required PHP Libraries

Code Snippet to Fetch an Access Token

If you're working in a development environment where you might need to bypass SSL verification (though this is not advised for production environments), here's how:

To test, simply open a browser and head to http://url-of-this-file.

Development

Integration tests

To run the tests locally

  1. Install and setup docker (min version 24) and docker compose (min version 2.21).
  2. Ensure that the following php dependencies are installed for executing the integration tests:

  3. add these lines to your /etc/hosts file:

  4. run whole tests

  5. run single test

    If something goes wrong, use make clean to clean the created containers and volumes.


All versions of ocis-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
sabre/dav Version ^4.6
owncloud/libre-graph-api-php Version dev-main#0e5491aa123a6db48b2f00f90e734961ee8c4aba
ext-json Version *
ext-curl Version *
ext-dom Version *
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 owncloud/ocis-php-sdk contains the following files

Loading the files please wait ....