Download the PHP package the-don-himself/twitter-graph without Composer

On this page you can find all versions of the php package the-don-himself/twitter-graph. 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 twitter-graph

twitter-graph

Sample code of an example graph database implementation of Twitter using the The-Don-Himself/gremlin-ogm library.

Create A Schema

Note: Not all gremlin compatible databases support schemas, in the event you are using one just skip this part.

First we deal with vertexes (a few places I called them vertices, similar to indices and indexes)

Vertexes

`

Edges

And an edge

`

The beauty of this library is that it only helps you write gremlin commands but does not stop you from interfacing with Gremlin directly, for example as in the case of the Follows Edge above, the library will produce gremlin commands to create an edge between two vertexes if you can pass to it a unique identifier such as user_id, house_id, taxi_id, etc. If you want to added an edge by other ways you can simply write a gremlin command and submit it directly through $graph_connection->send(' my awesome gremlin command ;');

The follows edges class is really simple, in that it simply creates an edge linking two vertexes by user_id, in real life examples you'd probably create the edge but have added properties like followed_on, via_app, introduced_by and so on. Just add those properties to the class and let the library serialize them for you.

Create Schema

When creating vertex and edge classes, look at the code from \TheDonHimself\TwitterGraph\Commands, They include;

SchemaCheckCommand; SchemaCreateCommand; PopulateCommand; VertexesCountCommand; VertexesDropCommand; EdgesCountCommand; EdgesDropCommand; GremlinTraversalCommand;

SchemaCheckCommand runs some checks to ensure that you did not duplicate names of properties and labels or indexes while SchemaCreateCommand actually iterates through you graph classes and send gremlin commands to create them. PopulateCommand populates the graph with data either from an API as with the case of the sample TwitterGraph or from a databases if you use Doctrine ORM (RDBMS) and/or Doctrine ODM (MongoDB). GremlinTraversalCommand let you send a gremlin command through the CLI e.g php bin/graph twittergraph:gremlin:traversal --traversal="g.V().count()".

Traverse The Graph

The library is almost a seamless transition from the Gremlin API. The most important thing here is the TraversalBuilder from \TheDonHimself\Traversal\TraversalBuilder which returns ready to execute gremlin commands, for example to get back a users vertex from Twitter you can build a Traversal as follows

`

Take special note of the single and double quotes

Echoing this command will show you this `

If you want to use bindings in the case of script parameterization (highly recommended) you can do this.

`

Again please take special note of the single and double quotes

Echoing this command will show you this `

Re: check possible traversal steps in at the code from \TheDonHimself\Traversal\Step,

Let' get a little bit more complex now, fetching a user's feed

`

Echoing this command will show you this `

That's it for now, there is so much more that this simple library can do, please look in the sample TwitterGraph folder to quickly get started with a sample graph of your Twitter friends, followers, likes, tweets and retweets by running this command. The library comes with a preconfigured readonly Twitter App for this.

Tests

Currently, I've not written any test suites but you can test the library by using a sample Twitter Graph that comes preconfigured with this library. Only the following Graph Databases have been tested to work though will test more when I get the time/resources

Simple configure any of them in their respective yaml files in the root folder then execute the following

`

then

`

Azure Cosmos DB

Please Note: Schema create command not applicable for CosmosDB

example:

`

JanusGraph on Compose

example:

`

JanusGraph Self-Hosted

example:

`

GraphQL

You might also be interested in graphql2gremlin, an attempt to create a standard around transforming GraphQL queries to Gremlin Traversals.


All versions of twitter-graph with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
abraham/twitteroauth Version ^1.0
symfony/console Version ^5.0 || ^4.0 || ^3.0
symfony/yaml Version ^5.0 || ^4.0 || ^3.0
the-don-himself/gremlin-ogm Version ^0.5
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 the-don-himself/twitter-graph contains the following files

Loading the files please wait ....