Coder Social home page Coder Social logo

jackalope-prismic's Introduction

Jackalope Build Status

Implementation of the PHP Content Repository API (PHPCR) using a relational database to persist data.

Jackalope uses the http://prismic.io service for storage.

For the moment, it is less feature complete, performant and robust than Jackalope-Jackrabbit.

Discuss on [email protected] or visit #jackalope on irc.freenode.net

License

This code is dual licensed under the MIT license and the Apache License Version 2.0. Please see the file LICENSE in this folder.

Preconditions

  • php >= 5.3
  • One of the following databases, including the PDO extension for it:
    • MySQL >= 5.1.5 (we need the ExtractValue function)
    • PostgreSQL
    • SQLite

Installation

The recommended way to install jackalope is through composer. You can of course do without, but then you will need to resolve the dependencies manually.

$ mkdir my-project
$ cd my-project
$ curl -s http://getcomposer.org/installer | php
$ ./composer.phar init
$ ./composer.phar require jackalope/jackalope-prismic
$ ./composer.phar install

Create a repository

Create a login on http://prismic.io and follow the instructions there.

Enable the commands

There are a couple of useful commands to interact with the repository.

To use the console, copy cli-config.php.dist to cli-config.php and configure the connection parameters. Then you can run the commands from the jackalope directory with ./bin/jackalope

NOTE: If you are using PHPCR inside of Symfony, the DoctrinePHPCRBundle provides the commands inside the normal Symfony console and you don't need to prepare anything special.

You have many useful commands available from the phpcr-utils. To get a list of all commands, type:

$ ./bin/jackalope

To get more information on a specific command, use the help command. To learn more about the phpcr:workspace:export command for example, you would type:

$ ./bin/jackalope help phpcr:workspace:export

Bootstrapping

Jackalope relies on autoloading. Namespaces and folders are compliant with PSR-0. You should use the autoload file generated by composer: vendor/autoload.php

If you want to integrate jackalope into other PSR-0 compliant code and use your own classloader, find the mapping in vendor/composer/autoload_namespaces.php

Before you can use jackalope with a database, you need to set the database up. Create a database as described above, then make sure the command line utility is set up (see above "Enable the commands"). Now you can run:

$ bin/jackalope jackalope:init:dbal

Once these steps are done, you can bootstrap the library. A minimalist sample code to get a PHPCR session with the prismic backend:

$uri = 'https://%s.prismic.io/api';
$workspace  = 'lesbonneschoses'; // phpcr workspace to use

$factory = new \Jackalope\RepositoryFactoryPrismic();
$repository = $factory->getRepository(array('jackalope.prismic_uri' => $uri));

// dummy credentials to comply with the API
$credentials = new \PHPCR\SimpleCredentials(null, null);
$session = $repository->login($credentials, $workspace);

Usage

The entry point is to create the repository factory. The factory specifies the storage backend as well. From this point on, there are no differences in the usage (except for supported features, that is).

// see Bootstrapping for how to get the session.

$rootNode = $session->getNode("/");

See PHPCR Tutorial for a more detailed tutorial on how to use the PHPCR API.

Performance tweaks

Advanced configuration

Logging

Jackalope supports logging, for example to investigate the number and type of queries used. To enable logging, provide a logger instance to the repository factory:

$factory = new \Jackalope\RepositoryFactoryPrismic();
$logger = new Jackalope\Transport\Logging\DebugStack();
$options = array(
  'jackalope.uri' => $uri,
  'jackalope.logger' => $logger,
);
$repository = $factory->getRepository($options);

//...

// at the end, output debug information
var_dump($logger->calls);

You can also wrap a PSR-3 compatible logger like monolog with the Psr3Logger class.

Note that when using jackalope in Symfony2, the logger is integrated in the debug toolbar.

Implementation notes

See doc/architecture.md for an introduction how Jackalope is built. Have a look at the source files and generate the phpdoc.

Running the tests

Jackalope-prismic is integrated with the phpcr-api-tests suite that tests all PHPCR functionality.

If you want to run the tests, please see the README file in the tests folder.

Things left to do

The best overview of what needs to be done are the skipped API tests. Have a look at ImplementationLoader to see what is currently not working and start hacking :-)

Also have a look at the issue trackers of this project and the base jackalope/jackalope.

Contributors

jackalope-prismic's People

Contributors

adou600 avatar apiciuspoulet avatar beberlei avatar burgov avatar chirimoya avatar chregu avatar cryptocompress avatar damz avatar dantleech avatar dbu avatar dotzoki avatar ebi avatar iambrosi avatar justinrainbow avatar krizon avatar lapistano avatar lex009 avatar lsmith77 avatar mhor avatar nacmartin avatar nicam avatar ornicar avatar petesiss avatar rivaros avatar rndstr avatar seldaek avatar toflar avatar uwej711 avatar vdrnn avatar waldvogel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jackalope-prismic's Issues

figure out a better mapping from id's to paths

option 1)

use bookmarks, but bookmarks names do not allow adding slashes, so we cannot do any deeper structures. also they are maintained by the administrator.

option 2)

use a custom property. i think its possible to define custom node types with required fields in prismic but if publishers need to maintain a tree structure, they need some UI to help them manage this easier.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.