All Projects → monicahq → laravel-sabre

monicahq / laravel-sabre

Licence: MIT license
Sabre.io DAV server adapter for Laravel

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to laravel-sabre

Radicale
A simple CalDAV (calendar) and CardDAV (contact) server.
Stars: ✭ 2,268 (+6772.73%)
Mutual labels:  caldav, cardav
tsdav
WebDAV, CALDAV, and CARDDAV client for Nodejs and the Browser
Stars: ✭ 33 (+0%)
Mutual labels:  caldav, dav
kcaldav
a simple, safe, and minimal CalDAV server
Stars: ✭ 63 (+90.91%)
Mutual labels:  caldav
Qownnotes
QOwnNotes is a plain-text file notepad and todo-list manager with markdown support and Nextcloud / ownCloud integration.
Stars: ✭ 2,357 (+7042.42%)
Mutual labels:  caldav
docker-sogo
Run sogo in a docker container.
Stars: ✭ 20 (-39.39%)
Mutual labels:  caldav
davx5-ose
DAVx⁵ is an open-source CalDAV/CardDAV suite and sync app for Android. You can also access your online files (WebDAV) with it.
Stars: ✭ 160 (+384.85%)
Mutual labels:  caldav
kalle
Kalle is a blitz.js based appointment scheduling tool that allows you to schedule an appointment with customers, collegues or friends within seconds.
Stars: ✭ 71 (+115.15%)
Mutual labels:  caldav
python-jicson
python ics to json lib
Stars: ✭ 11 (-66.67%)
Mutual labels:  caldav
calcardbackup
calcardbackup: moved to https://codeberg.org/BernieO/calcardbackup
Stars: ✭ 67 (+103.03%)
Mutual labels:  caldav
alexa-skill
A modular spring-boot application for alexa (amazon) skill.
Stars: ✭ 15 (-54.55%)
Mutual labels:  caldav
node-red-contrib-ical-events
Node-RED module to get events from a iCal Calender (Google e.g.), icloud or Caldav Server via kalender-events
Stars: ✭ 38 (+15.15%)
Mutual labels:  caldav
antimony
The Antimony programming language
Stars: ✭ 83 (+151.52%)
Mutual labels:  sabre
Sabre
Sabre is a configurable server jar for Minestom
Stars: ✭ 27 (-18.18%)
Mutual labels:  sabre

Sabre adapter for Laravel

Laravel-Sabre is an adapter to use Sabre.io DAV Server on Laravel.

Latest Version Downloads Workflow Status Quality Gate Coverage Status

Installation

You may use Composer to install this package into your Laravel project:

composer require monicahq/laravel-sabre

You don't need to add this package to your service providers.

Support

This package supports Laravel 5.6 and newer, and has been tested with php 7.1 and newer versions.

Configuration

If you want, you can publish the package config file to config/laravelsabre.php:

php artisan vendor:publish --provider="LaravelSabre\LaravelSabreServiceProvider"

If desired, you may disable LaravelSabre entirely using the enabled configuration option:

'enabled' => env('LARAVELSABRE_ENABLED', true),

Change the path configuration to set the url path where the Sabre server will answer to.

Usage

Use LaravelSabre\LaravelSabre class to add node collection and plugins to the Sabre server.

In the example above, DAVServiceProvider is a service provider that has been added to the list of providers in config/app.php file.

Nodes

LaravelSabre::nodes() is used to add nodes collection to the Sabre server.

It may be an array, or a callback function, like in this example here:

Example:

use LaravelSabre\LaravelSabre;
use Sabre\DAVACL\PrincipalCollection;
use Sabre\DAVACL\PrincipalBackend\PDO as PrincipalBackend;

class DAVServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        LaravelSabre::nodes(function () {
            return $this->nodes();
        });
    }

    /**
     * List of nodes for DAV Collection.
     */
    private function nodes() : array
    {
        $principalBackend = new PrincipalBackend();

        return [
            new PrincipalCollection($principalBackend),
        ];
    }
}

Plugins

You can use either:

  • LaravelSbre::plugins() to define a new array of plugins to add to the Sabre server. It may be a callback function.
  • or LaravelSbre::plugin() to add 1 plugin to the list of plugins.

Example:

use LaravelSabre\LaravelSabre;
use LaravelSabre\Http\Auth\AuthBackend;
use Sabre\DAV\Auth\Plugin as AuthPlugin;
use Sabre\CardDAV\Plugin as CardDAVPlugin;

class DAVServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        LaravelSabre::plugins(function () {
            return $this->plugins();
        });
    }

    /**
     * List of Sabre plugins.
     */
    private function plugins()
    {
        // Authentication backend
        $authBackend = new AuthBackend();
        yield new AuthPlugin($authBackend);

        // CardDAV plugin
        yield new CardDAVPlugin();
    }
}

Auth

Use the LaravelSabre::auth() method with the Authorize::class middleware gate, to allow access to some people, based on some criteria.

Example:

LaravelSabre::auth(function () {
    return auth()->user()->email == '[email protected]';
})

License

Author: Alexis Saettler

This project is part of MonicaHQ.

Copyright © 2019–2022.

Licensed under the MIT License. View license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].