{"id":31696858,"url":"https://github.com/onlyoffice/docs-integration-sdk-php","last_synced_at":"2025-10-08T17:59:47.962Z","repository":{"id":232810853,"uuid":"774258152","full_name":"ONLYOFFICE/docs-integration-sdk-php","owner":"ONLYOFFICE","description":"SDK for integrating ONLYOFFICE Document Server into your own website or application on PHP","archived":false,"fork":false,"pushed_at":"2025-09-08T08:27:48.000Z","size":2264,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-04T18:55:01.825Z","etag":null,"topics":["integratiopn","onlyoffice","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ONLYOFFICE.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-03-19T08:23:19.000Z","updated_at":"2025-08-11T12:04:05.000Z","dependencies_parsed_at":"2024-08-28T08:30:54.857Z","dependency_job_id":"cb3214d8-03ae-42be-ae11-9898938960d9","html_url":"https://github.com/ONLYOFFICE/docs-integration-sdk-php","commit_stats":null,"previous_names":["onlyoffice/docs-integration-sdk-php"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/ONLYOFFICE/docs-integration-sdk-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocs-integration-sdk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocs-integration-sdk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocs-integration-sdk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocs-integration-sdk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ONLYOFFICE","download_url":"https://codeload.github.com/ONLYOFFICE/docs-integration-sdk-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocs-integration-sdk-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278989445,"owners_count":26081257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["integratiopn","onlyoffice","php"],"created_at":"2025-10-08T17:59:44.953Z","updated_at":"2025-10-08T17:59:47.956Z","avatar_url":"https://github.com/ONLYOFFICE.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ONLYOFFICE Docs Integration PHP SDK\n\nONLYOFFICE Docs Integration PHP SDK provides common interfaces and default implementations for integrating ONLYOFFICE Document Server into your own website or application on PHP.\n\n## Prerequisites\n* **PHP**: version 7.4.0 and higher\n\n### Managers\n\n| Manager                       | Description                                                             | Default implementation           |\n| ----------------------------- | ----------------------------------------------------------------------- | -------------------------------- |\n| DocumentManagerInterface | This manager is used for working with files, and string data associated with documents. | DocumentManager (abstract) |\n| FormatsManagerInterface | This manager is used for working with document formats. | FormatsManager |\n| JwtManagerInterface | This manager is used for generating and verifying authorization tokens. | JwtManager (abstract) |\n| SettingsManagerInterface | This manager is used to manage integration application settings. | SettingsManager (abstract) |\n\n### Services\n\n| Service                       | Description                                                             | Default implementation           |\n| ----------------------------- | ----------------------------------------------------------------------- | -------------------------------- |\n| CallbackServiceInterface | This service is used for processing the response of the Document Server. | CallbackService (abstract) |\n| DocEditorConfigServiceInterface | This configuration generation service is used for opening the document editor. | DocEditorConfigService |\n| RequestServiceInterface | This service is used to make requests to the ONLYOFFICE Document Server. | RequestService (abstract) |\n\n## Usage\n1. Implement the methods of the abstract **DocumentManager** class:\n    ```php\n    public function getDocumentKey(string $fileId, bool $embedded = false)\n    {\n        return self::generateRevisionId($fileId);\n    }\n\n    public function getDocumentName(string $fileId)\n    {\n        return \"sample.docx\";\n    }\n\n    public static function getLangMapping()\n    {\n        return null;\n    }\n\n    public static function getFileUrl(string $fileId)\n    {\n        return \"https://example-server.example/fileId/download/\";\n    }\n\n    public static function getCallbackUrl(string $fileId)\n    {\n        return \"https://example-server.example/callback\";\n    }\n\n    public static function getGobackUrl(string $fileId)\n    {\n        return \"https://example-server.example/filelist\";\n    }\n\n    public static function getCreateUrl(string $fileId)\n    {\n        return \"https://example-server.example/fileId\";\n    }\n    ```\n2. Implement the methods of the abstract **JwtManager** class (use third-party libraries for JWT encoding and decoding, whichever is convenient for you):\n    ```php\n    public function encode($token, $key, $algorithm = \"HS256\")\n    {\n        return \"SOME.JWT.STRING\";\n    }\n\n    public function decode($token, $key, $algorithm = \"HS256\")\n    {\n        return json_encode([]);\n    }\n    ```\n3. Implement the methods of the abstract **SettingsManager** class:\n    ```php\n    public function getServerUrl()\n    {\n        return \"https://example-server.example/\";\n    }\n\n    public function getSetting($settingName)\n    {\n        return null;\n    }\n\n    public function setSetting($settingName, $value, $createSetting = false)\n    {\n        // if ($createSetting === true) {\n            // $this-\u003eyourMethodForCreateNewSetting($settingName, $value);\n            // return;\n        // }\n        // $this-\u003eyourMethodForSetNewValueForSetting($settingName, $value);\n    }\n    ```\n4. Implement the methods of the abstract **SettingsManager** class:\n    ```php\n    public function processTrackerStatusEditing()\n    {\n        // $someTrackResult[\"error\"] = 0;\n        // return json_encode($someTrackResult);\n    }\n\n    public function processTrackerStatusMustsave()\n    {\n        // $someTrackResult[\"error\"] = 0;\n        // return json_encode($someTrackResult);\n    }\n\n    public function processTrackerStatusCorrupted()\n    {\n        // $someTrackResult[\"error\"] = 0;\n        // return json_encode($someTrackResult);\n    }\n\n    public function processTrackerStatusClosed()\n    {\n        // $someTrackResult[\"error\"] = 0;\n        // return json_encode($someTrackResult);\n    }\n\n    public function processTrackerStatusForcesave()\n    {\n        // $someTrackResult[\"error\"] = 0;\n        // return json_encode($someTrackResult);\n    }\n    ```\n5. Create a class that implements the **HttpClientInterface** interface (use PHP Client URL Library or any other third-party library to make requests):\n    ```php\n    class YourHttpClient implements HttpClientInterface\n    {\n        public function __construct()\n        {\n            $this-\u003eresponseStatusCode = null;\n            $this-\u003eresponseBody = null;\n        }\n\n        public function getStatusCode()\n        {\n            return $this-\u003eresponseStatusCode;\n        }\n\n        public function getBody()\n        {\n            return $this-\u003eresponseBody;\n        }\n\n        public function request($url, $method = 'GET', $opts = [])\n        {\n            $this-\u003eresponseStatusCode = 200;\n            $this-\u003eresponseBody = \"{\\\"status\\\": \\\"OK\\\"}\";\n        }\n    }\n    ```\n6. Implement the method of the abstract **RequestService** class:\n    ```php\n    public function getFileUrlForConvert()\n    {\n        return \"https://example-server.example/file-url-for-check-convert\";\n    }\n    ```\n7. Use DocEditorConfigService to create a config model for the editors in your own controllers.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonlyoffice%2Fdocs-integration-sdk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonlyoffice%2Fdocs-integration-sdk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonlyoffice%2Fdocs-integration-sdk-php/lists"}