Download the PHP package get-stream/stream-doctrine without Composer

On this page you can find all versions of the php package get-stream/stream-doctrine. 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 stream-doctrine

Stream Doctrine

Build Status Code Coverage Code Quality Latest Stable Version License

stream-doctrine is a package that integrates you Doctrine entities with Stream.

You can sign up for a Stream account at https://getstream.io/get_started.

Note there is also a lower level PHP - Stream integration library which is suitable for all PHP applications.

 💡 This library is built for the Feeds product. The Chat product can be found here.

Build Activity Streams, News Feeds, and More

You can build:

Installation

Composer

Composer will install our latest version automatically.

PHP compatibility

Current releases require PHP 8.0 or higher, and depend on doctrine/orm version 2.14 or higher.

See the GitHub build configuration for details of how it is built and tested against different PHP versions.

GetStream.io Dashboard

Now, login to GetStream.io and create an application in the dashboard.

Retrieve the API key, API secret, and API app id, which are shown in your dashboard.

Stream-Doctrine setup

Setup

To register this plugin into Doctrine ORM, you need to register a ModelListener on the EntityManager like this:

Features of Stream-Doctrine

Entity integration

Stream-Doctrine provides instant integration with Doctrine entities - implementing the interface and adding an EntityListener will give you automatic tracking of your models to user feeds.

For example:

Every time a Pin is created it will be stored in the feed of the user that created it, and when a Pin instance is deleted then it will get removed as well.

Automatically!

Activity Fields

Models are stored in feeds as activities. An activity is composed of at least the following data fields: actor, verb, object, time. You can also add more custom data if needed.

object is a reference to the entity instance itself actor is a reference to the user attribute of the instance verb is a string representation of the class name time is a DateTimeInterface object of when the activity happened. Mostly this will be the created_at or similar attribute of the entity.

A few assumptions are made on the entity class in order to be able to implement the ActivityInterface:

  1. the Entity has an identifier (which goes for every entity).
  2. the Entity has a *-to-one relationship to some user or "actor".
  3. the Entity has a timestamp column (created_at for example).

You can change how a entity instance is stored as activity by implementing specific methods as explained later.

An example of a complete Activity typed entity is shown below:

You can change every activity* method according to your needs or entity implementation.

Activity Extra Data

Often, you'll want to store more data than just the basic fields, for use with custom ranking or aggregation, for example. You achieve this by implementing the method in the entity.

NOTE: The data will be serialized using the json_encode function, so it needs to be valid input for that.

Feed Manager

stream-doctrine comes with a FeedManager class (implementing FeedManagerInterface) that helps with all common feed operations. The FeedManager needs a configured GetStream\Stream\Client object when instantiating it.

Pre-Bundled Feeds

To get you started the manager has feeds pre configured. You can add more feeds if your application needs it. The three feeds are divided in three categories.

User Feed:

The user feed stores all activities for a user. Think of it as your personal Facebook page. You can easily get this feed from the manager.

News Feed:

The news feeds store the activities from the people you follow. You can setup the names of the newsfeeds using:

Then you can access those feeds in an ArrayAccess kind of way:

Both user feed and news feeds are shorthand methods for:

Notification Feed:

The notification feed can be used to build notification functionality.

Notification feed

Below we show an example of how you can read the notification feed.

By default the notification feed will be empty. You can specify which users to notify when your model gets created. In the case of a retweet you probably want to notify the user of the parent tweet.

Another example would be following a user. You would commonly want to notify the user which is being followed.

Follow Feed

To create the news feeds you need to notify the system about follow relationships. The manager comes with methods to let a user's news feeds follow another user's feed. This code lets the current user's news feeds follow the target_user's personal feed.

Displaying the Newsfeed

Activity Enrichment

When you read data from feeds with activities created by stream-doctrine, an activity will look like this:

This is far from ready for usage in your template. We call the process of loading references from the database: enrichment. An example is shown below.

Customizing Enrichment

Sometimes you'll want to customize how enrichment works. If you store references to model instances as custom fields (using the activityExtraData() method) you can use the Enrich class to take care of it for you:

Tell the enricher to enrich the parent_tweet field into a full entity object:

Full documentation and Low level APIs access

When needed you can also use the low level PHP API directly. Documentation is available at the Stream website.

Copyright and License Information

Copyright (c) 2014-2022 Stream.io Inc, and individual contributors. All rights reserved.

See the file "LICENSE" for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.


All versions of stream-doctrine with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
doctrine/orm Version ^2.14.1
get-stream/stream Version ^7.0.1
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 get-stream/stream-doctrine contains the following files

Loading the files please wait ....