Git Product home page Git Product logo

php-owncloud-api's Introduction

Object Oriented PHP Owncloud API

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License

An object oriented API to consume from PHP. The idea of this API is to manage all the files download, upload and sharing.

It is still on development, for now we only have this:

  • File Sharing
  • Get all shared files and folders
  • Get a shared file
  • Create a new share
  • Delete a share

The API was tested with Owncloud 6.*

Todo

  • Manage by webdav files, listings, download, upload, etc.
  • Create a object entity to manage the File.
  • Internationalization of message errors.
  • Test, test, test, test

Installation

Through composer, simply run :

$ php composer.phar require gpilla/php-owncloud-api:dev-master

Or edit your composer.json:

// composer.json
{
    "require": {
        "gpilla/php-owncloud-api": "dev-master"
    }
}

For development

$ git clone https://github.com/gpilla/php-owncloud-api.git
$ cd php-owncloud-api
$ php composer.phar install --dev

In the contrib folder there is a hook for checking phpunit and phpcs before commiting.

Basic usage

FileManagement

Is based on league/flysystem and the API is here: http://flysystem.thephpleague.com/api/

(It will be changed)

Examples:

Read a file

// As everytime instantiate the API
$api = new Owncloud\Api('http://host.foobar.com/', 'user', 'password');
$api->fileManagement()->read('path/to/the/test/file.txt');

FileSharing

Get all shares

See: http://doc.owncloud.org/server/6.0/admin_manual/sharing_api/get_all_shares.html

Usage:

$api = new Api('http://somewhere.com', 'user', 'password');
$shares = $api->fileSharing()->getAllShares();

Get one share

$api = new Api('http://somewhere.com', 'user', 'password');
// You should send the share ID as parameter
$share = $api->fileSharing()->getShare(1);

Create a new share

$api = new Api('http://somewhere.com', 'user', 'password');
$share = $api->fileSharing()->createNewShare(
    'path/to/file/or/folder'
    , ['shareType' => Owncloud\Api\FileSharing::SHARE_TYPE_PUBLIC_LINK]
);

Delete a share

$api = new Api('http://somewhere.com', 'user', 'password');
// You should send the share ID as parameter
$share = $api->fileSharing()->deleteShare(1);

php-owncloud-api's People

Contributors

gpilla avatar

Watchers

Budi K avatar  avatar

Forkers

rezox

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.