2017 © Pedro Peláez
 

library laravel-jackrabbit

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

image

gmoigneu/laravel-jackrabbit

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

  • Sunday, November 8, 2015
  • by gmoigneu
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel 5.x package providing Jackrabbit backend capabilities with Doctrine-PHPCR-ODM mappings., (*1)

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, (*2)

Download Sling Launchpad 7 on Maven repository., (*3)

More info on : - https://sling.apache.org/news/sling-launchpad-8-released.html - https://github.com/jackalope/jackalope-jackrabbit/issues/98#issuecomment-154832686, (*4)

Installation

composer require gmoigneu/laravel-jackrabbit

Configuration

Publish the config file & edit it with your Jackrabbit details:, (*5)

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 :, (*6)

<?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 :, (*7)

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

Use your model wherever you want :, (*8)

// 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, (*9)

The Versions

08/11 2015

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

by Guillaume Moigneu