Download the PHP package laudis/graphaware-neo4j-php-client-legacy without Composer

On this page you can find all versions of the php package laudis/graphaware-neo4j-php-client-legacy. 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 graphaware-neo4j-php-client-legacy

Legacy GraphAware Neo4j PHP Client

⚠️ Warning ⚠️

This is a legacy api. This project exists to ️allow people to quickly get up and running with newer versions of neo4j in existing projects. For the newest drivers and latest features, please visit the neo4j php client on the neo4j-php github page.

Key features

Neo4j Version Support

Version Tested
3.0 + Yes
4.0 + Yes

Neo4j Feature Support

Feature Supported?
Auth Yes
Remote Cypher Yes
Transactions Yes
High Availability Yes
Embedded JVM support No
Binary Protocol Yes

Requirements

Getting Help

You can:

Implementations

Installation and basic usage

Installation

Add the library to your composer dependencies :

Require the composer autoloader, configure your connection by providing a connection alias and your connection settings :

You're now ready to connect to your database.

NB: The build method will process configuration settings and return you a Client instance.

Basic Usage

Sending a Cypher Query

Sending a Cypher Query with parameters

Reading a Result

A Record object contains the values of one record from your Cypher query :

Cypher statements and Stacks

Ideally, you would stack your statements and issue them all at once in order to improve performance.

You can create Cypher statement stacks that act as a Bag and run this stack with the client, example :

Tagging your Cypher statements

Sometimes, you may want to retrieve a specific result from a Stack, an easy way to do this is to tag your Cypher statements.

The tag is passed via the 3rd argument of the run or push methods :

Working with Result sets

Basics

The run method returns you a single Result object. Other methods where you can expect multiple results returns a ResultCollection object which is Traversable.

The Result object contains the records and the summary of the statement, the following methods are available in the API :

Summary

The ResultSummary contains the Statement, the Statistics and the QueryPlan if available :

Record Values

Each record contains one row of values returned by the Cypher query :

The client takes care of the hydration of Graph objects to PHP Objects, so it is for Node, Relationship and Path :

Node
Relationship
Path

Handling Results (from v3 to v4)

There are 3 main concepts around this topic :

  1. a Result
  2. a Record
  3. a RecordValue

Let's take a look at a query we do in the browser containing multiple possibilities of types :

screen shot 2016-05-11 at 20 54 34bis

Result

A Result is a collection of Record objects, every row you see in the browser is a Record and contains Record Values.

Record

In contrary to the previous versions of the client, there is no more automatic merging of all the records into one big record, so you will need to iterate all the records from the Result :

Record Value

Every record contains a collection of Record Values, which are identified by a key, the key is the identifier you give in the RETURN clause of the Cypher query. In our example, a Record will contain the following keys :

In order to access the value, you make use of the get() method on the Record object :

The type of the value is depending of what you return from Neo4j, in our case the following values will be returned :

Meaning that :

Node, Relationship and Path objects have then further methods, so if you know that the node returned by the identifier n has a countries property on it, you can access it like this :

The Record object contains three methods for IDE friendlyness, namely :

This does not offer something extra, just that the docblocks hint the IDE for autocompletion.

Extra: ResultCollection

When you use Stack objects for sending multiple statements at once, it will return you a ResultCollection object containing a collection of Results. So you need to iterate the results before accessing the records.

Working with Transactions

The Client provides a Transaction object that ease how you would work with transactions.

Creating a Transaction

At this stage, nothing has been sent to the server yet (the statement BEGIN has not been sent), this permits to stack queries or Stack objects before commiting them.

Stack a query

Again, until now nothing has been sent.

Run a query in a Transaction

Sometimes you want to get an immediate result of a statement inside the transaction, this can be done with the run method :

If the transaction has not yet begun, the BEGIN of the transaction will be done automatically.

You can also push or run Stacks

Commit and Rollback

if you have queued statements in your transaction (those added with the push methods) and you have finish your job, you can commit the transaction and receive the results :

After a commit, you will not be able to push or run statements in this transaction.

Working with multiple connections

Generally speaking, you would better use HAProxy for running Neo4j in a cluster environment. However sometimes it makes sense to have full control to which instance you send your statements.

Let's assume a environment with 3 neo4j nodes :

By default, the $client->run() command will send your Cypher statements to the first registered connection in the list.

You can specify to which connection to send the statement by specifying its alias as 4th argument to the run parameter :

The client is also aware of the manually configured master connection, so sending your writes can be easier with :

Helper Methods

Returns an array of Label objects.

Event Dispatching

3 types of events are dispatched during the run methods :

Registering listeners

Example :

The event dispatcher is available via the client with the $client->getEventDispatcher methods.

Settings

Timeout (deprecated)

You can configure a global timeout for the connections :

The timeout by default is 5 seconds.

This feature is deprecated and will be removed in version 5. See Http client settings below.

TLS

You can enable TLS encryption for the Bolt Protocol by passing a Configuration instance when building the connection, here is a simple example :

HTTP client settings

We use HTTPlug to give you full control of the HTTP client. Version 4 of the Neo4jClient comes with Guzzle6 by default to preserve backward compatibility. Version 5 will give you the option to choose whatever client you want. Read more about HTTPlug in their documentation.

To configure your client you may add it to Configuration. Below is an example using php-http/curl-client.

License

The library is released under the MIT License, refer to the LICENSE file bundled with this package.


All versions of graphaware-neo4j-php-client-legacy with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
ext-bcmath Version *
ext-mbstring Version *
graphaware/neo4j-common Version ^3.4
laudis/graphaware-neo4j-bolt-legacy Version ^2.0
symfony/event-dispatcher Version ^2.7 || ^3.0 || ^4.0
myclabs/php-enum Version ^1.4
php-http/httplug Version ^2.2.0
php-http/message-factory Version ^1.0
php-http/client-common Version ^2.3
php-http/discovery Version ^1.13
laudis/neo4j-php-client Version v2.0.x-dev
php-http/message Version ^1.11
php-http/guzzle6-adapter Version ^2.0
ext-json Version *
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 laudis/graphaware-neo4j-php-client-legacy contains the following files

Loading the files please wait ....