PHPCRStandard Interface for Content Repositories
http://bergie.iki.fihenri.bergius@iki.fi    @bergie
github.com/bergie/noflogithub.com/bergie/phpflo
Same API, multiple repositories●    Jackalope                        ●                                         Midgard    ...
Why use Midgard?
Developers write against a single APIImplementations can be chosen based on          deployment needs
“Products in MySQL, blog entries in CouchDB”
Standard: JSR-283Day Management AG, Switzerland                        10-August-2009Release noteProduct:         Specific...
Content Management            Interoperability Services●   JCR-like API using HTTP and    Atom (or SOAP)●   Quite complica...
The next version of JCR will also include  PHP scripting bindings, i.e. PHPCR
PHPCR is a collection of interfaces
...and API testsbergie@AirDrone:~/Projects/phpcr-midgard2/api-test$ phpunitPHPUnit 3.5.5 by Sebastian Bergmann.I.IIISSSSSS...
Repository capabilities●    Tree access              ●                                 XML import and●    Access by UUID  ...
“Simple stuff should be easy, but complex stuff            should still be possible”
In PHPCR, all content is stored in a tree of nodes    Nodes have a name, a type, and a set of                  properties ...
Including PHPCR in your application●    PHP 5.3 namespaced code●    Use PSR-0 standard autoloader
Connecting to a repository: Midgard
Connecting to a repository: Jackrabbit●    Start Jackrabbit:    $ java -jar jackrabbit-standalone-2.2.5.jar●    Connect to...
This is the only repository-specific part
Working with the tree
About Node types●   Node types determine what properties and what kind of    child nodes a node can have●   Some built-in ...
Queries: SQL2
Queries: Query Object Model
Versioning: enable
Versioning: commit
Versioning: restore
Export and import
Export and import
Some projects looking at PHPCR
Some projects looking at PHPCR
Questions?henri.bergius@iki.fi       @bergie
Upcoming SlideShare
Loading in...5
×

PHPCR - Standard Content Repository for PHP

3,020

Published on

Content repositories session from the PHP track at FrOSCon 2011.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,020
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
15
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

PHPCR - Standard Content Repository for PHP

  1. 1. PHPCRStandard Interface for Content Repositories
  2. 2. http://bergie.iki.fihenri.bergius@iki.fi @bergie
  3. 3. github.com/bergie/noflogithub.com/bergie/phpflo
  4. 4. Same API, multiple repositories● Jackalope ● Midgard ● Apache Jackrabbit: ● GObject-oriented Java-based repository repository library server, accessible accessible through through WebDAV PHP extension ● Doctrine: pure-PHP ● Python, JavaScript, repository library Java, ...● github.com/jackalope/jackalope ● github.com/bergie/phpcr-midgard2
  5. 5. Why use Midgard?
  6. 6. Developers write against a single APIImplementations can be chosen based on deployment needs
  7. 7. “Products in MySQL, blog entries in CouchDB”
  8. 8. Standard: JSR-283Day Management AG, Switzerland 10-August-2009Release noteProduct: Specification for Content Repository for Java(tm) Technology API 2.0Version: 2.0Type: 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 jsr-283-comments@jcp.orgFurther information about JSR 283 can be found athttp://www.jcp.org/en/jsr/detail?id=283
  9. 9. 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
  10. 10. The next version of JCR will also include PHP scripting bindings, i.e. PHPCR
  11. 11. PHPCR is a collection of interfaces
  12. 12. ...and API testsbergie@AirDrone:~/Projects/phpcr-midgard2/api-test$ phpunitPHPUnit 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.....SSSSSSTime: 03:53, Memory: 148.50MbThere were 27 errors:1) PHPCRTestsQueryQueryManagerTest::testGetQueryPHPCRQueryInvalidQueryException: 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.
  13. 13. Repository capabilities● Tree access ● XML import and● Access by UUID export● Workspaces ● Permissions● Versioning ● Capability discovery● Multi-value properties ● Observation● Queries: SQL2, QOM ● Locking & Transactions
  14. 14. “Simple stuff should be easy, but complex stuff  should still be possible”
  15. 15. 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
  16. 16. Including PHPCR in your application● PHP 5.3 namespaced code● Use PSR-0 standard autoloader
  17. 17. Connecting to a repository: Midgard
  18. 18. Connecting to a repository: Jackrabbit● Start Jackrabbit: $ java -jar jackrabbit-standalone-2.2.5.jar● Connect to repository:
  19. 19. This is the only repository-specific part
  20. 20. Working with the tree
  21. 21. 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
  22. 22. Queries: SQL2
  23. 23. Queries: Query Object Model
  24. 24. Versioning: enable
  25. 25. Versioning: commit
  26. 26. Versioning: restore
  27. 27. Export and import
  28. 28. Export and import
  29. 29. Some projects looking at PHPCR
  30. 30. Some projects looking at PHPCR
  31. 31. Questions?henri.bergius@iki.fi @bergie
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×