Download the PHP package gdbots/ncr without Composer

On this page you can find all versions of the php package gdbots/ncr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ncr

ncr-php

Node Content Repository for php. Using this library assumes that you've already created and compiled your own pbj classes using the Pbjc and are making use of the "gdbots:ncr:mixin:*" mixins from gdbots/schemas.

If your project is using Symfony use the gdbots/ncr-bundle-php to simplify the integration.

Nodes and Edges

A node or vertex is a noun/entity in your system. An article, tweet, video, person, place, order, product, etc. The edges are the relationships between those things like "friends", "tagged to", "married to", "published by", etc.

This library doesn't provide you with a graph database implementation. It's concerned with persisting/retrieving nodes and edges. Graph traversal would still need to be provided by another library. It is recommended that data be replicated or projected out of the Ncr (or layered on top like GraphQL) into something suited for that purpose (e.g. Neo4j, Titan ElasticSearch).

NodeRef

A NodeRef is a qualified identifier to a node/vertex. It is less verbose than a MessageRef as it is implied that node labels must be unique within a given vendor namespace and therefore can be represented in a more compact manner.

NodeRef Format: vendor:label:id The "vendor:label" portion is a SchemaQName

Examples:

acme:article:41e4532f-2f58-4b9d-afc8-e9c2cbcb4aba twitter:tweet:789234931599835136 youtube:video:EG0wQRsXLi4

Nodes do not actually have a node_ref field, they have an _id field. The NodeRef is derived by taking the SchemaQName of the node's schema along with its _id. The NodeRef is an immutable value object which is used in various places without needing to actually have the node instance.

Ncr

The Ncr is the service responsible for node persistence. It is intentionally limited to basic key/value storage operations (e.g. put/get/find by index) to ensure the underlying implementation can be swapped out with little effort or decorated easily (caching layers for example).

Available repository implementations:

Review the Gdbots\Ncr\Ncr interface for reference on the available methods.

Ncr::findNodeRefs

The Ncr is a simple key/value store which means querying is limited to the id of the item or a secondary index. An example of a secondary index would be the email or username of a user, the slug of an article or the isbn of a book.

An IndexQuery is used to findNodeRefs that match a query against a secondary index.

An example of using a IndexQuery:

Not all storage engines can enforce uniqueness on a secondary index so the interface also cannot make that assumption. Because of this the findNodeRefs may return more than one value. It is up to your application logic to deal with that.

Ncr::pipeNodes

Getting data out of the Ncr should be dead simple, it's just json after all. Use the pipeNodes or pipeNodeRefs methods to export data. The gdbots/ncr-bundle-php provides console commands that make use of this to export and reindex nodes.

Exporting nodes using pipeNodes:

NcrCache

NcrCache is a first level cache which is ONLY seen and used by the current request. It is used to cache all nodes returned from get node request(s). This cache is used during Pbjx request processing or if the Ncr is running in the current process and is using the MemoizingNcr.

This cache should not be used when asking for a consistent result.

NcrCache is NOT an identity map and the Ncr is NOT an ORM. In some cases you may get the same exact object but it's not a guarantee so don't do something like this:

If you need to check equality, use the message interface:

NcrLazyLoader

NcrCache and other request interceptors make use of this service to batch load nodes only if they are requested. An example of this is when loading an article you may want to fetch the author or related items, but not always. Rather than force the logic to exist in the loading of an article, something else can manage that.

Lazy loading is generally application specific so this library provides some tools to make is easier.

Example lazy loading:

NcrSearch

The Ncr provides the reliable storage and retrieval of Nodes. NcrSearch is in most cases a separate storage provider. For example, DynamoDb for Ncr and ElasticSearch for NcrSearch. In fact, the only implementation we have right now is ElasticSearch.

When using the gdbots/ncr-bundle-php you can enable the indexing with a simple configuration option. The bundle also provides a reindex console command.

Searching nodes is generally done in a request handler. Here is an example of searching nodes:


All versions of ncr with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
gdbots/pbjx Version ^4.1
psr/cache Version ^1|^2|^3
psr/log Version ^1|^2|^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gdbots/ncr contains the following files

Loading the files please wait ....