Skip to content

What is the mission of this library ? #5

@tgalopin

Description

@tgalopin

While we probably all agree that this library aims to provide user-to-user messaging features, I'm not sure we all have the same idea of what we should really do.

I discussed quite a lot with @ChristianRiesen about this and we worked on an easy to use API for the library. I want to explain here what is our current idea so it can be discussed and adapted to your needs.

1. We don't base the work on the current bundle

We chose to not base our work on the bundle. We didn't want to be restricted in our ideas by the bundle concepts. So even if some ideas will be the same, please keep in mind we want to create a library from scratch.

2. The library and framework implementations

  • FOSMessage is conversation-based and supports multiple participants per conversation.
  • FOSMessage is divided in two parts: the library and its implementation in frameworks (bundle, module, etc.).
  • The library is very simple: it's nothing more than a coherent data structure. We don't provide validation, UI, forms, etc. The developer will use the library as a way to persist and fetch messages in an elegant way.
  • The framework implementation of the library (bundle, module, etc.) may implement more things to help the development.
  • The library won't implement any "inbox/sentbox" system as it's quite complex to define what a sent message is. The framework implementation may implement it in the context of the UI.
  • The library is independant from any framework, any persistance system and any user system.

3. Implementation details

  • The library provides two main components:
    • The Repository to fetch conversations / messages
    • The Sender to start conversations / send messages
  • The library provides other components (for the moment only one) that can be used but are optionnal (they will have a seperated documentation page):
    • The Tagger to tag conversations
  • The library provides a few models: Conversation, Message, PersonInterface (interface for User model), ConversationPerson linking conversations and persons and MessagePerson linking messages and persons ;
  • A TagInterface let the developer implement a tagging system ;
  • Drivers let the developpers choose what persistance system they want to use (we decided in What persistance systems do we have to support for first release? #1 to limit the persistance systems to Doctrine ORM and Mongo ODM)
  • An event dispatcher is available (either a native one to use the library alone or various bridges with famous event dispatchers, for the moment, only Symfony: https://github.com/tgalopin/message/tree/master/src/EventDispatcher)

4. Usage ideas

Here is how we would like to interact with the library, as a developer: https://gist.github.com/tgalopin/33641d43f200e8010c2a

You can note that there is neither any concept of inbox/outbot nor validation or UI. The library as we plan it is a smart but simple data strcture, and nothing more.

I worked a bit on an implementation of what we had in mind with Christian (https://github.com/tgalopin/message) so the code can help you see how the library would work from our perspective.

I am very interested by your opinions about this plan: what do you think the library should be? What was your idea when you thought of a framework-agnostic messaging library? Does this plan fit your needs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions