phpcr - standard content repository for php
DESCRIPTION
Content repositories session from the PHP track at FrOSCon 2011.TRANSCRIPT
![Page 1: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/1.jpg)
PHPCR
Standard Interface for Content Repositories
![Page 3: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/3.jpg)
github.com/bergie/noflo
github.com/bergie/phpflo
![Page 4: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/4.jpg)
Same API, multiple repositories
● Jackalope● Apache Jackrabbit:
Java-based repository server, accessible through WebDAV
● Doctrine: pure-PHP repository library
● github.com/jackalope/jackalope
● Midgard● GObject-oriented
repository library accessible through PHP extension
● Python, JavaScript, Java, ...
● github.com/bergie/phpcr-midgard2
![Page 5: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/5.jpg)
Why use Midgard?
![Page 6: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/6.jpg)
Developers write against a single API
Implementations can be chosen based on deployment needs
![Page 7: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/7.jpg)
“Products in MySQL, blog entries in CouchDB”
![Page 8: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/8.jpg)
Standard: JSR-283Day Management AG, Switzerland 10-August-2009
Release note
Product: Specification for Content Repository for Java(tm) Technology API 2.0Version: 2.0 Type: Full Release----------------------------------------------------------------------
This package consists of the following components:
1) Specification documents: spec/2) Applicable Licenses: license/3) API Source code: src/4) pre-built API .jar-file: lib/5) generated javadoc: docs/
For questions or comments feel free to use [email protected]
Further information about JSR 283 can be found athttp://www.jcp.org/en/jsr/detail?id=283
![Page 9: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/9.jpg)
Content Management Interoperability Services
● JCR-like API using HTTP and Atom (or SOAP)
● Quite complicated, but language-agnostic
● OASIS spec since 2010● Good implementations in
enterprise document management systems
● Proponents include Microsoft, Nuxeo and Alfresco
![Page 10: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/10.jpg)
The next version of JCR will also include PHP scripting bindings, i.e. PHPCR
![Page 11: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/11.jpg)
PHPCR is a collection of interfaces
![Page 12: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/12.jpg)
...and API testsbergie@AirDrone:~/Projects/phpcr-midgard2/api-test$ phpunit PHPUnit 3.5.5 by Sebastian Bergmann.
I.IIISSSSSSSSS..S.............E..ESSSSSSSSSSSSSSSSSSSSSSSSEE 60 / 552.........FFSSSSSSSSSSSSS.....E...........................I.. 120 / 552EEI...EEEE......F..........F..........F..........F.......... 180 / 552F..........F..........F......................F..........F... 240 / 552.......F..........F..........F........ES.............S...... 300 / 552....F.EE..I...E..II......F..............................I... 360 / 552..........E.I..I.........I............................E.E... 420 / 552...EE.............................E......................... 480 / 552........I....................E.EFEF...I.I.IEI..FEE.FF.FFF..F 540 / 552S.....SSSSSS
Time: 03:53, Memory: 148.50Mb
There were 27 errors:
1) PHPCR\Tests\Query\QueryManagerTest::testGetQueryPHPCR\Query\InvalidQueryException: Unsupported 'xpath' language
/home/bergie/Projects/phpcr-midgard2/src/Midgard2CR/Query/QueryManager.php:24/home/bergie/Projects/phpcr-midgard2/src/Midgard2CR/Query/QueryManager.php:62/home/bergie/Projects/phpcr-midgard2/api-test/suite/tests/06_Query/QueryManagerTest.php:37...
FAILURES!Tests: 536, Assertions: 2331, Failures: 25, Errors: 27, Incomplete: 18, Skipped: 56.
![Page 13: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/13.jpg)
Repository capabilities
● Tree access● Access by UUID● Workspaces● Versioning● Multi-value properties● Queries: SQL2, QOM
● XML import and export
● Permissions● Capability discovery● Observation● Locking &
Transactions
![Page 14: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/14.jpg)
“Simple stuff should be easy, but complex stuff should still be possible”
![Page 15: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/15.jpg)
In PHPCR, all content is stored in a tree of nodes
Nodes have a name, a type, and a set of properties
Nodes can also have child nodes
![Page 16: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/16.jpg)
Including PHPCR in your application
● PHP 5.3 namespaced code● Use PSR-0 standard autoloader
![Page 17: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/17.jpg)
Connecting to a repository: Midgard
![Page 18: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/18.jpg)
Connecting to a repository: Jackrabbit
● Start Jackrabbit:$ java -jar jackrabbit-standalone-2.2.5.jar
● Connect to repository:
![Page 19: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/19.jpg)
This is the only repository-specific part
![Page 20: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/20.jpg)
Working with the tree
![Page 21: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/21.jpg)
About Node types● Node types determine what properties and what kind of
child nodes a node can have● Some built-in types: nt:file, nt:folder, nt:resource, nt:unstructured
● Node types can be amended with “mixin” types, like mix:lastModified, mix:language
● Most repositories allow you to define your own types● Recommendation:
Start with nt:unstructured, add more strict definitions when you know your data model
![Page 22: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/22.jpg)
Queries: SQL2
![Page 23: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/23.jpg)
Queries: Query Object Model
![Page 24: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/24.jpg)
Versioning: enable
![Page 25: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/25.jpg)
Versioning: commit
![Page 26: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/26.jpg)
Versioning: restore
![Page 27: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/27.jpg)
Export and import
![Page 28: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/28.jpg)
Export and import
![Page 29: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/29.jpg)
Some projects looking at PHPCR
![Page 30: PHPCR - Standard Content Repository for PHP](https://reader034.vdocument.in/reader034/viewer/2022052619/5558c355d8b42a235c8b45db/html5/thumbnails/30.jpg)
Some projects looking at PHPCR