Port of the Java Content Repository (JCR) to PHP.

Related tags

Miscellaneous phpcr
Overview

PHP Content Repository PHPCR Build Status

This repository contains interfaces for the PHPCR standard.

The JSR-283 specification defines an API for a Content Repository (CR). The PHP Content Repository Interfaces aims to provide that API in PHP. PHPCR is part of JSR-333, the next version of the Java Content Repository.

There is a bunch of information here: http://phpcr.github.io

Documentation

Introduction

PHP content repository is an API. That is, it defines a standardized way how to access and manipulate content. As with any general API, the main goal is to decouple the backend from the frontend. If you code against the PHPCR API, your code should run with all PHPCR implementations. David Nuescheler, the lead of JCR, provides the following advantages of using a content repository.

  • Functional Definition of a “Content Repository”
  • Common Vocabulary!
  • No longer learn (dozens of) (ugly) proprietary APIs
  • Write (mostly) portable code, for Document Management, Web Content Management, Source Code Control
  • Compare Repository Functionality
  • No more information silos and vendor Lock-in Content-Centric Infrastructure

PHPCR is adapted from the Java Content Repository (JCR) standard because that is a widely used and well thought through standard. There exist a couple of implementations for PHPCR that you can use. See below for a list of known implementations.

Further reading

Port Status

The PHPCR is following the Java Content Repository JCR API closely where appropriate. In the points where Java and PHP differ, we tried to follow the logic of PHP while keeping the spirit of the original API. The API has the same expressiveness as the Java API. Most of the JSR-283/JSR-333 documentation and code examples should be usable as-is.

Main differences between PHPCR and JCR are

  • PHP has no method overloading. Same-name methods that differ only by parameter number and/or type have been merged into one method.
  • PHP is weak typed, which makes the Value interface and the large number of almost-identical iterators obsolete.

An exhaustive list of the differences between PHPCR and JCR is in the file doc/JCR_TO_PHPCR.txt

Tests

Unit tests

As PHPCR is an API definition, there is not much to test on it without an implementation. Nonetheless, there are a few concrete classes that do have unit tests. Simply run them with phpunit -c tests/

API Tests

An API test suite for the functionality of PHPCR is available at https://github.com/phpcr/phpcr-api-tests/ All implementations have to test against this test suite to make sure they are interchangeable with each other.

Implementations

Jackalope separates the content repository logic from the storage backend. Several backend drivers are currently being developed.

  • Jackalope-Jackrabbit: Mapping requests to a java Jackrabbit instance. To day the most feature complete implementation.
  • Jackalope-DoctrineDBAL: Storing data in a relational database using the Doctrine Database Abstraction Layer.

The following are a work in progress:

  • Jackalope-MongoDB: Storing data in a MongoDB database.
  • Jackalope-Prismic: Storing data in the Prismic.io content repository as a service.
  • Jackalope-Midgard1 (not online afaik): Read access to the midgard 1.0 server.
  • Midgard2: PHPCR interfaces for the midgard2 content repository.

If you work on your own implementation, please let us know so we can add it here right away. Even if its not yet working, others might want to join in and help.

Utilities

  • phpcr-utils: A couple of utility classes and console commands to work with phcpr, independent of the implementation.
  • PHPCR Shell: The PHPCR Shell aims to provide a complete shell interface to any PHPCR repository.
  • Marmelab PHPCR Browser: Angular JS based PHPCR repository browser. Currently only supports Jackalope-Jackrabbit and Jackalope-Doctrine-DBAL.

Dependencies

PHPCR provides a composer.json for Composer and is available through Packagist.

History

The API was originally ported from Java to PHP by Karsten Dambekalns with the help of others for the typo3/flow3 project.

A first attempt at a port of JSR-170 to php has been made by SimPCoRe, but it seems no applications have been published. That version never tried to provide an API, but just implemented the Java interfaces literally.

Comments
  • _and() and _or() methods of QueryObjectModelFactoryInterface don't get documented

    _and() and _or() methods of QueryObjectModelFactoryInterface don't get documented

    These two functions don't get documented by phpdoctor: http://phpcr.github.com/doc/html/phpcr/query/qom/queryobjectmodelfactoryinterface.html

    Maybe because of the leading underscores?

    opened by nacmartin 16
  • Small improvements

    Small improvements

    improved constants with php 5.6 constant features updated phpunit version to 5.7 removed deprecation in tests updated .styleci short array syntax updated tests autoloading

    I think there is potencial BC break: In NodeTypeInterface is namespace http://www.jcp.org/mix/1.0 but I think it isn't correct. Right namespace is http://www.jcp.org/jcr/mix/1.0. I fixed this but it's because break for developers which use this constants :)

    opened by pavelvondrasek 12
  • inheritance error

    inheritance error

    in version 2.1.2 it is ok, but in 2.1.3 there is error due to https://bugs.php.net/bug.php?id=63359&edit=1

    Compile Error: Cannot inherit previously-inherited or override constant JCR_CONTENT from interface PHPCR\Version\VersionInterface

    opened by marek-l 10
  • decide on event listener observation

    decide on event listener observation

    EventListenerInterface is supposed to be a callback when something coming from any PHPCR client is done on the repository. This only makes sense when having a constantly running process, and only when having multithreading so the polling can happen in the background. This makes probably no sense for PHP. I wonder if we should drop that interface or leave it for the future, when things like ReactPHP become more popular and if multithreading becomes an option...

    At least we should probably split the 2 features and allow implementations to only implement the event journal. This means we need an additional capability to allow clients to properly distinguish what will be possible.

    opened by dbu 10
  • [POC] Make query constants a final class

    [POC] Make query constants a final class

    I am having to serialize allowed query operators to strings and back again, and I notice that PHPCR has classes for constants, e.g. PropertyType, but for some reason the class which has the query constants is an interface (QueryObjectModelConstantsInterface)

    Is there a reason for this?

    In particular I want to have access to a nameFromValue method as with PropertyType and OnParentVersion.

    opened by dantleech 9
  • add PrincipalInterface and cleanup docs

    add PrincipalInterface and cleanup docs

    @sixty-nine and i reviewed this section and we added a "principal" interface because there seems to be nothing fitting in php.

    does it make sense like this?

    note that for jackalope-jackrabbit, we can't really implement it right now, it first needs to be supported by the jackrabbit davex component. but we need to clean things up so that jsr-333 can ship with valid interfaces.

    /cc @bergie, @lsmith77, @chregu

    opened by dbu 9
  • Need for square brackets in fulltext search QOM

    Need for square brackets in fulltext search QOM

    It was said in Issue #13 that you should never need to put brackets in QOM. However, when doing

    $qomFactory->fulltextSearch('title', 'The', '[nt:unstructured]');
    

    You still need them, because the same line without square brackets makes jackrabbit throw:

    HTTP 400: Query:
    SELECT * FROM [nt:unstructured] WHERE CONTAINS(nt:(*)unstructured.title, 'Team') AND [phpcr:class] = 'Sandbox\MainBundle\Document\EditableStaticContent' ORDER BY path ASC; expected: ,
    
    opened by nacmartin 8
  • JSR-333 updates

    JSR-333 updates

    Once this is merged, also update http://java.net/jira/browse/JSR_333-59

    Done

    • Item::revert instead of Item::refresh
    • LockInfo timeOutHint versus timeoutHint
    • unregisterNamespace => unregisterNamespaceByURI
    • NodeInterface
      • getNodeNames
      • getPropertyWithDefault
      • setMixins
      • rename
      • addNodeAutoNamed
      • covered by getPropertyValue($name, $type)
        • getPropertyAs
        • getPropertyAsString
        • getPropertyAsStringArray
    • RepositoryManagerInterface (new interface)
    • SessionInterface
      • getNode(absPath, depthHint)
      • getProperties
    • WorkspaceInterface
      • removeItem
    • NodeTypeInterface
      • getSupertypeNames
    • EventFilter (new interface)
    • ObservatiomManager
      • - addEventLister(eventTypes, absPath, etc...)
      • - getEventJournal(eventTypes, absPath, etc...)
      • + addEventLister(EventFilter)
      • + getEventJournal(EventFilter)
    opened by dbu 7
  • QueryObjectModelFactoryInterface::selector accepts null selector name

    QueryObjectModelFactoryInterface::selector accepts null selector name

    Both JCR and PHPCR API docs clearly says selector name is non null: https://github.com/phpcr/phpcr/blob/master/src/PHPCR/Query/QOM/QueryObjectModelFactoryInterface.php#L88

    Either allow non-null and document why, or keep it consistent with JCR API.

    opened by piotras 7
  • Getting seemingly random InvalidQueryExceptions

    Getting seemingly random InvalidQueryExceptions

    Hi there!

    I'm using PHPCR with a Jackrabbit behind it in a form, using the Doctrine\Bundle\PHPCRBundle\Form\Type\DocumentType.

    Every once in a while queries start the fail with an error message like the following:

    HTTP 400: Query:
    SELECT * FROM [nt:unstructured] AS e WHERE (ISSAMENODE(e, [/cms/pages/(*)3EZByVAb/7BoOQynn]) AND (e.[phpcr:class] = 'App\Content\Document\Document' OR e.[phpcr:classparents] = 'App\Content\Document\Document'))
    

    Can you give me any pointers if that's an error on my site and/or what to do about it?

    I've tried a few different queries and the only thing that seemed to work was changing the ISSAMENODE part to

    ISSAMENODE(e, '/cms/pages/3EZByVAb/7BoOQynn')

    but I really don't what know what I'm doing here regarding the query language 😅

    Regards

    opened by muffe 6
  • doc cleanups

    doc cleanups

    this is mainly removing the namespace if the target class is in the same namespace and adding namespace where it was missing. the test suite still works and phpstorm also sees no error so i think it should be fine.

    opened by dbu 6
  • [WIP] adjustments while implementing ACL

    [WIP] adjustments while implementing ACL

    Principal is something from java.security, so its not jcr specific at all. meaning there is no infrastructure to build principals.

    i guess we either need a factory method on the AccessControlManager or provide the trivial implementation in PHPCR directly so people can use new.

    i wonder how the java side of this actually works, if its using all that fancy stuff to in the end do a string comparison because the principal name and the username used in the jackrabbit connection.

    ready wip/poc 
    opened by dbu 3
  • There is no way to change the type of a property

    There is no way to change the type of a property

    The Property class in the JCR API accepts Value objects, Value objects are of a specified type, and setting them with setValue will change the value of the node. PHPCR is missing this missing this feature:

    http://www.day.com/specs/jsr170/javadocs/jcr-1.0/javax/jcr/Property.html#setValue(javax.jcr.Value)

    We should probably add a ->setType method.

    Next Version 
    opened by dantleech 1
  • make QueryResultInterface countable

    make QueryResultInterface countable

    implementing this interface would be convenient for handling search results and should neither be expensive to execute nor difficult to implement.

    this would be a BC break for all implementations, so it has to wait until we realease a next minor version.

    Next Version 
    opened by dbu 1
Releases(2.1.6)
Ip2region is a offline IP location library with accuracy rate of 99.9% and 0.0x millseconds searching performance. DB file is ONLY a few megabytes with all IP address stored. binding for Java,PHP,C,Python,Nodejs,Golang,C#,lua. Binary,B-tree,Memory searching algorithm

Ip2region是什么? ip2region - 准确率99.9%的离线IP地址定位库,0.0x毫秒级查询,ip2region.db数据库只有数MB,提供了java,php,c,python,nodejs,golang,c#等查询绑定和Binary,B树,内存三种查询算法。 Ip2region特性

Lion 12.6k Dec 30, 2022
A PHP library for all things Minecraft: Java Edition

Phpcraft A PHP library for all things Minecraft: Java Edition. This project has been abandoned! The limited subset of 1.8.x - 1.15.x that has been imp

null 16 Nov 29, 2022
High performance view templating API for PHP applications using tags & expressions inspired by Java JSTL and C compiler

View Language API Table of contents: About Expressions Tags Configuration Compilation Installation Unit Tests Examples Reference Guide About This API

Lucian Gabriel Popescu 0 Jan 9, 2022
PHP_Depend is an adaptation of the established Java development tool JDepend. This tool shows you the quality of your design in terms of extensibility, reusability and maintainability.

PHP Depend Documentation PHP Depend for enterprise Available as part of the Tidelift Subscription. The maintainers of PHP Depend and thousands of othe

PHP_Depend 837 Dec 14, 2022
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP

Lodash-PHP Lodash-PHP is a port of the Lodash JS library to PHP. It is a set of easy to use utility functions for everyday PHP projects. Lodash-PHP tr

Lodash PHP 474 Dec 31, 2022
Commands and implementations for common tasks for the PHP Content Repository (PHPCR) API.

PHPCR Utilities Commands and implementations for common tasks for the PHP Content Repository (PHPCR) API. If you are using or implementing PHPCR you p

PHPCR 65 Nov 20, 2022
A redacted PHP port of Underscore.js with additional functions and goodies – Available for Composer and Laravel

Underscore.php The PHP manipulation toolbelt First off : Underscore.php is not a PHP port of Underscore.js (well ok I mean it was at first). It's does

Emma Fabre 1.1k Dec 11, 2022
A simple, type-safe, zero dependency port of the javascript fetch WebApi for PHP.

A simple, type-safe, zero dependency port of the javascript fetch WebApi for PHP.

Matias Navarro Carter 105 Jan 4, 2023
Back the fun of reading - PHP Port for Arc90′s Readability

PHP Readability Library If you want to use an up-to-date version of this algorithm,check this newer project: https://github.com/andreskrey/readability

明城 517 Nov 18, 2022
An improved version of the PHP port of KuzuhaScript

KuzuhaScriptPHP+ (くずはすくりぷとPHP+) An improved version of the PHP port of KuzuhaScript (くずはすくりぷと). To my knowledge, it works with PHP version 4.1.0 and a

Heyuri 4 Nov 16, 2022
A PHP port of Ruby's Liquid Templates

Liquid template engine for PHP Liquid is a PHP port of the Liquid template engine for Ruby, which was written by Tobias Lutke. Although there are many

Alexander Guz 141 Nov 4, 2022
This is a port of the original WireGuard UI bits as implemented by Netgate in pfSense 2.5.0 to a package suitable for rapid iteration and more frequent updating on future releases of pfSense.

This is a port of the original WireGuard*** UI bits as implemented by Netgate in pfSense 2.5.0 to a package suitable for sideloading and more frequent updating on future releases of pfSense. This also includes some improvments such as a proper status page (found under Status / WireGuard Status) and improved assigned interface handling.

R. Christian McDonald 195 Dec 23, 2022
A class for easy connection to the zarinpal port

Payment class with ZarinPal A class to simplify payment operations and confirm payment of ZarrinPal payment gateway service ( به فارسی بخوانید ) Insta

Mohammad Qasemi 7 Jul 15, 2022
uaDetect – A multi-language port of Browserscope's user agent parser

uaDetect is a lightweight for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

Fadjrir Herlambang 1 Jan 7, 2022
PHP Meminfo is a PHP extension that gives you insights on the PHP memory content

MEMINFO PHP Meminfo is a PHP extension that gives you insights on the PHP memory content. Its main goal is to help you understand memory leaks: by loo

Benoit Jacquemont 994 Dec 29, 2022
Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)

COPS COPS stands for Calibre OPDS (and HTML) Php Server. See : COPS's home for more details. Don't forget to check the Wiki. Why ? In my opinion Calib

Sébastien Lucas 1.3k Jan 1, 2023
Repman - PHP Repository Manager: packagist proxy and host for private packages

Repman - PHP Repository Manager Repman is a PHP repository manager. Main features: free and open source works as a proxy for packagist.org (speeds up

Repman 438 Jan 2, 2023
This is the code repository for The Art of Modern PHP 8, published by Packt.

The Art of Modern PHP 8 This is the code repository for The Art of Modern PHP 8, published by Packt. Your practical and essential guide to getting up

Packt 35 Jan 2, 2023
Backend repository of libreoupas project, fully written in PHP, using the datas provided by the University.

libreoupas-engine/fst-nancy Description libreoupas est un site Internet permettant aux étudiant de la Faculté des Strasbourg illkirsh d'avoir accès au

Clément Colné 5 Jan 6, 2022