monicahq/laravel-sabre
Composer 安装命令:
composer require monicahq/laravel-sabre
包简介
Sabre DAV server adapter for Laravel.
README 文档
README
Laravel-Sabre is an adapter to use Sabre.io DAV Server on Laravel.
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.
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 == 'admin@admin.com'; })
License
Author: Alexis Saettler
This project is part of MonicaHQ.
Copyright © 2019–2022.
Licensed under the MIT License. View license.
monicahq/laravel-sabre 适用场景与选型建议
monicahq/laravel-sabre 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 456.76k 次下载、GitHub Stars 达 58, 最近一次更新时间为 2019 年 03 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「laravel」 「sabre」 「dav」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 monicahq/laravel-sabre 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 monicahq/laravel-sabre 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 monicahq/laravel-sabre 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple cache abstraction layer implementing PSR-16
A reader and writer for the Atom format
A reader and writer for the Atom format
Fork of scroller123/xml-atom
Alfabank REST API integration
Sabre API Client
统计信息
- 总下载量: 456.76k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 58
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-01