PHP collab server

I think this is a wonderful community and the library is great. Unfortunately, since my project is running on PHP. It is possible to bundle the client side and have the bundle running without much installation for the client side. However, I find limited resources of collab server and especially on PHP.

I am trying to build one referencing from:

If anyone is interested, let’s work together.

Actually, I am stuck as well. (Sorry, I am not very experienced with NodeJS) Reading from the code,

doSave in instance.js, I see that the document is saved every 10 seconds. But I don’t see how the data saved is coming from. Since the data that is send to the collab server is only step changes. How does the collab server know how to compile and make a json doc from the individual steps?

Sorry for such a rudimentary question.

Hi there,

the basic idea would be to (on the server)

In the website code apply happens during Instance.addEvents which is called from the server.js here.

// read the initial document (or have it somewhere)
let document = Node.fromJSON(schema, json);
// go through all steps you recieved from a client (probably serialized as json)
for (let jsonStep of steps) {
    // get the step from json
    const step = Step.fromJSON(schema, jsonStep);
    const result = step.apply(document)
    if (result.failed) {
     // step did not apply
    } else {
       document = result.doc;

The actual server code will be a bit more involved, especially if you have decorations or something else stored on the server side (you’d use StepMap to update the position of the decorations to the new positions after the steps have been applied) - but for starters the code above should do the trick.

best regards


1 Like