承接 gmoigneu/laravel-jackrabbit 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gmoigneu/laravel-jackrabbit

Composer 安装命令:

composer require gmoigneu/laravel-jackrabbit

包简介

Laravel 5.x package providing Jackrabbit backend capabilities with Doctrine-PHPCR-ODM mappings

README 文档

README

Laravel 5.x package providing Jackrabbit backend capabilities with Doctrine-PHPCR-ODM mappings.

Prerequisites

  • Apache Sling 7 or Apache Jackrabbit 2.3.6+

Jackalope is currently not working with Jackrabbit Oak and thus not in Apache Sling 8

Download Sling Launchpad 7 on Maven repository.

More info on :

Installation

composer require gmoigneu/laravel-jackrabbit

Configuration

Publish the config file & edit it with your Jackrabbit details:

php artisan vendor:publish

Usage

JCR Session

// Init session
$session = \App::make('phpcr.session');

// Save a new testNode
$rootNode = $session->getNode("/");
$testNode = $rootNode->addNode("testNode");
$session->save();

// Get the newly created node
$testNode = $session->getNode("/testNode");
dd($testNode);

Document Manager

Create a new model :

<?php namespace App\Models;

use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;

/**
 * @PHPCR\Document(referenceable=true)
 */
class Post
{

    /**
     * @PHPCR\Uuid()
     */
    protected $uuid;

    /**
     * @PHPCR\Id()
     */
    protected $slug;

    /**
     * @PHPCR\ParentDocument()
     */
    protected $parent;

    /**
     * @PHPCR\NodeName
     */
    protected $title;

    public function setParent($parent)
    {
        $this->parent = $parent;
        return $this;
    }

    public function setTitle($title)
    {
        $this->title = $title;
        return $this;
    }

    public function getTitle()
    {
        return $this->title;
    }

}

Register your new type with :

$ php artisan doctrine:phpcr:register-system-node-types                                                                     
Successfully registered system node types.

Use your model wherever you want :

// Get the document manager
$dm = \App::make('phpcr.manager');

// Get the root node
$root = $dm->find(null, '/');

// Create a post
$post = new Post();
$post->setParent($root);
$post->setTitle('Example Post');

$dm->persist($post);
$dm->flush();

$post = $dm->find(null, 'Example Post');
dd($post);

Credits

Based on the work of Workers

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-08