42sol/onlyoffice-laravel

Connector for Laravel for easy Onlyoffcie integration

1.0.17 2025-03-26 14:21 UTC

This package is auto-updated.

Last update: 2025-03-26 14:21:52 UTC


README

Connector between larvel framework and onlyoffcie self-hosted api

Configuration

After installation run

php artisan vendor:publish --tag=onlyoffice-default

Set "host" variable with the address of your only office installation in published configuration file Provide JWT_SECRET generated by your installation of onlyoffice via env variable (assuming one been generated/set during onlyoffice installation).

Development notes

Container configuration

For usage with docker add to your docker-compose file:

    documentserver:
        image: onlyoffice/documentserver
        environment:
            - ALLOW_PRIVATE_IP_ADDRESS=true
            - USE_UNAUTHORIZED_STORAGE=true
            - JWT_ENABLED=false
            - JWT_HEADER=Authorization
            - JWT_SECRET=${JWT_SECRET}

Usage of traefic advised due to complications with traffic routing between containers. Add following to previously mentioned container configuration, update your hosts.etc file with nessesery hosts

        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.$COMPOSE_PROJECT_NAME-office.rule=Host(`*addition to base domain name*.$DOMAIN_NAME`)"
        extra_hosts:
            - "$DOMAIN_NAME=host-gateway"
            - "host.docker.internal=host-gateway"

It is better to set JWT_SECRET via env variable or directly in environment section before running containers. Otherwise it will be generated automatically and will be difficult to obtain.

Also don't forget to add new host (*addition to base domain name*.$DOMAIN_NAME) to extra_hosts section of your php container configuration.

Filesystem configuration

If files you want to open aren't in storage/public forlder then you will have to configure additional symlink and disk in filesystems.php Make shure symlink and 'url' parameter from disk config are leading on the same path.

'files' => [
            'driver' => 'local',
            'root' => storage_path('app/files'),
            'url' => env('APP_URL').'/storage/files',
        ],

 // ...

'links' => [
        //...
        public_path('storage/files') => storage_path('app/files')
    ],