{"id":36425522,"url":"https://github.com/muckiware/restic","last_synced_at":"2026-01-16T22:59:55.302Z","repository":{"id":264671555,"uuid":"893776182","full_name":"muckiware/restic","owner":"muckiware","description":"PHP framework for to use restic as backup function","archived":false,"fork":false,"pushed_at":"2026-01-08T12:22:00.000Z","size":43077,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T19:34:51.101Z","etag":null,"topics":["backup","restic","restic-backup"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muckiware.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-25T07:34:28.000Z","updated_at":"2026-01-08T12:22:03.000Z","dependencies_parsed_at":"2024-12-29T10:33:48.762Z","dependency_job_id":"248abf33-03ca-4fd4-a756-d2e69eb5b7ab","html_url":"https://github.com/muckiware/restic","commit_stats":null,"previous_names":["muckiware/restic"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/muckiware/restic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muckiware%2Frestic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muckiware%2Frestic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muckiware%2Frestic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muckiware%2Frestic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muckiware","download_url":"https://codeload.github.com/muckiware/restic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muckiware%2Frestic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28487064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T22:54:02.790Z","status":"ssl_error","status_checked_at":"2026-01-16T22:50:10.344Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["backup","restic","restic-backup"],"created_at":"2026-01-11T17:59:43.371Z","updated_at":"2026-01-16T22:59:55.294Z","avatar_url":"https://github.com/muckiware.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# muckiware/restic\nPHP client for [restic](https://github.com/restic/restic) backup tool. This library provides a simple way to create and manage backups with restic. It uses repositories as storage for backups.\n\u003cdiv align=\"center\"\u003e\n\n[![Latest Stable Version](http://poser.pugx.org/muckiware/restic/v)](https://packagist.org/packages/muckiware/restic)\n[![Total Downloads](http://poser.pugx.org/muckiware/restic/downloads)](https://packagist.org/packages/muckiware/restic)\n[![PHP Version Require](http://poser.pugx.org/muckiware/restic/require/php)](https://packagist.org/packages/muckiware/restic)\n[![Dependents](http://poser.pugx.org/muckiware/restic/dependents)](https://packagist.org/packages/muckiware/restic)\n[![License](https://img.shields.io/github/license/shopware/shopware.svg)](https://github.com/shopware/shopware/blob/trunk/LICENSE)\n\n\u003c/div\u003e\n\n# Requirements\n- PHP 8.1 or higher\n- Composer\n- Restic as binary or installed on the system, see https://restic.readthedocs.io/en/stable/020_installation.html\n- Restic version 0.15.0 or higher\n- AWS account with S3 bucket, if you want to use Amazon S3 as external storage for the backup repository\n# Installation\n```bash\ncomposer require muckiware/restic\n```\n# Usage\nHow to use the library. This php client interacts with the restic binary to create, manage and restore backups in and of a repository. The first step is always to create a backup repository as storage for the backup data. After that, you can create backups in this repository and check the backup data. And at least if its necessary, you can restore the backup data.\n\n## Location of backup repository\nThe backup repository can be located on the local file system, or on an external S3 storage. Currently this library supports AWS / AmazonS3 as external storage for the backup repository. More details about the Amazon Bucket configuration in the restic documentation https://restic.readthedocs.io/en/latest/080_examples.html#setting-up-restic-with-amazon-s3\n## Overview commands\nThis gives you an overview of the possible methods of the framework. The default value for repositoryLocationTypes is local.\n### MuckiRestic\\Library\\Backup\\Backup::_[method]_;\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Backup;\n\nclass MyClass\n{\n    public function myMethod(): void\n    {\n        try {\n        \n            $backupClient = Backup::create();\n            //configuration settings\n            ...\n            $backupClient-\u003e[method]\n            ...\n```\n| Method             | Parameter variable name [type of variable]                                                                            | Description                                                               |\n|:-------------------|:------------------------------------------------------------------------------------|:--------------------------------------------------------------------------|\n| createRepository() | $overwrite[bool], \u003cbr/\u003e$repositoryLocationTypes[RepositoryLocationTypes] (optional) | Creates a new backup repository                                           |\n| createBackup()     | $repositoryLocationTypes[RepositoryLocationTypes] (optional)                        | Creates a backup with and creates a new snapshot in the backup repository |\n| checkBackup()      | $repositoryLocationTypes[RepositoryLocationTypes] (optional)                        | Checks a repository and reads all data for testing                        |\n\n### MuckiRestic\\Library\\Backup\\Manage::_[method]_;\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Manage;\n\nclass MyClass\n{\n    public function myMethod(): void\n    {\n        try {\n        \n            $manageClient = Manage::create();\n            //configuration settings\n            ...\n            $manageClient-\u003e[method]\n            ...\n```\n| Method               | Parameter variable name [type of variable]                   | Description                                                                     |\n|:---------------------|:-------------------------------------------------------------|:--------------------------------------------------------------------------------|\n| getSnapshots()       | $repositoryLocationTypes[RepositoryLocationTypes] (optional) | Get a list of all snapshots in specific repository                              |\n| removeSnapshots()    | $repositoryLocationTypes[RepositoryLocationTypes] (optional) | Removes snapshots by snapshot ids                                               |\n| removeSnapshotById() | $repositoryLocationTypes[RepositoryLocationTypes] (optional) | Removes a snapshot by specific snapshot id                                      |\n| executePrune()       | $repositoryLocationTypes[RepositoryLocationTypes] (optional) | Performance a clean up of old items after a remove command. Its saved hd space. |\n| getRepositoryStats() | $repositoryLocationTypes[RepositoryLocationTypes] (optional) | Get a list of statistic values of a specific repository                         |\n\n### MuckiRestic\\Library\\Restore::_[method]_;\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Restore;\n\nclass MyClass\n{\n    public function myMethod(): void\n    {\n        try {\n        \n            $restoreClient = Restore::create();\n            //configuration settings\n            ...\n            $restoreClient-\u003e[method]\n            ...\n```\n| Method             | Parameter variable name [type of variable]                                                                            | Description                              |\n|:-------------------|:------------------------------------------------------------------------------------|:-----------------------------------------|\n| createRestore() | $overwrite[bool], \u003cbr/\u003e$repositoryLocationTypes[RepositoryLocationTypes] (optional) | Creates a restore of a specific snapshot |\n\n## Create a new backup repository\nYou will need first the backup object of the library, for to use the **createRepository** method. Import this class with `use MuckiRestic\\Library\\Backup;`. The Backup-class has a static `create`-method for to get the Backup object, like this `$backupClient = Backup::create();`. With this create, you have access to all the Backup methods. The `$backupClient-\u003ecreateRepository()` method initialize a new repository and  need the required parameters _password_ and the _repositoryPath_. The repositoryPath is where the backup data will be stored and the password is used to encrypt the backup data. It's required for all operations on the repository. It has to be set by the two setting methods `$backupClient-\u003esetRepositoryPassword('1234')` and `$backupClient-\u003esetRepositoryPath('./path_to_repository')`\u003cbr\u003e\nOptionally you can set the path for the restic binary, with `$backupClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386')`. This is necessary if the restic binary is not installed in the local system. \n\nThe method `createRepository()` returns the object `ResultEntity`.\n\nThe method `getOutput` of the object `ResultEntity` returns the output of the restic command. If an error occurs, an exception will be thrown.\n### Example for local repository\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Backup;\n\nclass BackupService\n{\n    public function createRepository(): void\n    {\n        try {\n        \n            $backupClient = Backup::create();\n            $backupClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $backupClient-\u003esetRepositoryPassword('12345%ASDEee'); //required\n            $backupClient-\u003esetRepositoryPath('./path_to_repository'); //required\n\n            echo $backupClient-\u003ecreateRepository()-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n### Example for Amazon S3 storage\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Core\\RepositoryLocationTypes;\nuse MuckiRestic\\Library\\Backup;\n\nclass BackupService\n{\n    public function createRepository(): void\n    {\n        try {\n        \n            $backupClient = Backup::create();\n            $backupClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $backupClient-\u003esetRepositoryPassword('12345%ASDEee'); //required\n            $backupClient-\u003esetAwsAccessKeyId('AABBCCDDYUI4T123WIZY'); //required\n            $backupClient-\u003esetAwsSecretAccessKey('xLqWLrN1yfrJ+r2zlnpoMY3eDXdHmdnne8T+Y2XZ'); //required\n            $backupClient-\u003esetAwsRegion('eu-central-1'); //required\n            $backupClient-\u003esetAwsS3Endpoint('s3:https://s3.amazonaws.com/my-restic-bucket'); //required\n            $backupClient-\u003esetAwsS3BucketName('my-restic-bucket'); //required\n\n            echo $backupClient-\u003ecreateRepository(RepositoryLocationTypes::AWSS3)-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n## Create a backup\nNext step, create a backup into the repository by using the method `$backupClient-\u003ecreateBackup()`. Also, this method will returns the object `ResultEntity`. The backup path is required for the backup operation. It has to be set by the method `$backupClient-\u003esetBackupPath('./path_to_backup_folder')`.\u003cbr\u003e\nEvery backup process creates a new **snapshot** of the backup data in the repository. These **snapshots** are represented by an individually hash string.\n### Example for local repository\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Backup;\n\nclass BackupService\n{\n    public function createBackup(): void\n    {\n        try {\n        \n            $backupClient = Backup::create();\n            $backupClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $backupClient-\u003esetRepositoryPassword('12345%ASDEee'); //required\n            $backupClient-\u003esetRepositoryPath('./path_to_repository'); //required\n            $backupClient-\u003esetBackupPath('./path_to_backup_folder'); //required\n            \n            echo $backupClient-\u003ecreateBackup()-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n### Example for Amazon S3 storage\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Core\\RepositoryLocationTypes;\nuse MuckiRestic\\Library\\Backup;\n\nclass BackupService\n{\n    public function createBackup(): void\n    {\n        try {\n        \n            $backupClient = Backup::create();\n            $backupClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $backupClient-\u003esetRepositoryPassword('12345%ASDEee'); //required\n            $backupClient-\u003esetBackupPath('./path_to_backup_folder'); //required\n            $backupClient-\u003esetAwsAccessKeyId('AABBCCDDYUI4T123WIZY'); //required\n            $backupClient-\u003esetAwsSecretAccessKey('xLqWLrN1yfrJ+r2zlnpoMY3eDXdHmdnne8T+Y2XZ'); //required\n            $backupClient-\u003esetAwsRegion('eu-central-1'); //required\n            $backupClient-\u003esetAwsS3Endpoint('s3:https://s3.amazonaws.com/my-restic-bucket'); //required\n            $backupClient-\u003esetAwsS3BucketName('my-restic-bucket'); //required\n            \n            echo $backupClient-\u003ecreateBackup(RepositoryLocationTypes::AWSS3)-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n## Check the backup\nAfter the backup process, it makes sense to check the backup data. The method `$backupClient-\u003echeckBackup()` will return the object `ResultEntity`. The method `getOutput` of the object `ResultEntity` returns the output of the restic command simple as string. If an error occurs, an exception will be thrown.\n### Example for local repository\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Backup;\n\nclass BackupService\n{\n    public function createBackup(): void\n    {\n        try {\n        \n            $backupClient = Backup::create();\n            $backupClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $backupClient-\u003esetRepositoryPassword('1234'); //required\n            $backupClient-\u003esetRepositoryPath('./path_to_repository'); //required\n            \n            echo $backupClient-\u003echeckBackup()-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n### Example for Amazon S3 storage\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Core\\RepositoryLocationTypes;\nuse MuckiRestic\\Library\\Backup;\n\nclass BackupService\n{\n    public function createBackup(): void\n    {\n        try {\n        \n            $backupClient = Backup::create();\n            $backupClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $backupClient-\u003esetRepositoryPassword('1234'); //required\n            $backupClient-\u003esetAwsAccessKeyId('AABBCCDDYUI4T123WIZY'); //required\n            $backupClient-\u003esetAwsSecretAccessKey('xLqWLrN1yfrJ+r2zlnpoMY3eDXdHmdnne8T+Y2XZ'); //required\n            $backupClient-\u003esetAwsRegion('eu-central-1'); //required\n            $backupClient-\u003esetAwsS3Endpoint('s3:https://s3.amazonaws.com/my-restic-bucket'); //required\n            $backupClient-\u003esetAwsS3BucketName('my-restic-bucket'); //required\n            \n            echo $backupClient-\u003echeckBackup(RepositoryLocationTypes::AWSS3)-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n## Manage backups\nThe library provides methods for to manage backups. Import this class with `use MuckiRestic\\Library\\Manage;`.\n## Get list of snapshots\nYou can get list of all snapshots of a repository with the method `$manageClient-\u003egetSnapshots()`. The method `getSnapshots` returns the object `ResultEntity`. The method `getOutput` of the object `ResultEntity` returns the output of the restic command simple as string. If an error occurs, an exception will be thrown.\n### Example for local repository\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Manage;\n\nclass ManageService\n{\n    public function getSnapshotList(): void\n    {\n        try {\n        \n            $manageClient = Manage::create();\n            $manageClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $manageClient-\u003esetRepositoryPassword('1234'); //required\n            $manageClient-\u003esetRepositoryPath('./path_to_repository'); //required\n            \n            echo $manageClient-\u003egetSnapshots()-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n### Example for Amazon S3 storage\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Core\\RepositoryLocationTypes;\nuse MuckiRestic\\Library\\Manage;\n\nclass ManageService\n{\n    public function getSnapshotList(): void\n    {\n        try {\n        \n            $manageClient = Manage::create();\n            $manageClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $manageClient-\u003esetRepositoryPassword('1234'); //required\n            $manageClient-\u003esetAwsAccessKeyId('AABBCCDDYUI4T123WIZY'); //required\n            $manageClient-\u003esetAwsSecretAccessKey('xLqWLrN1yfrJ+r2zlnpoMY3eDXdHmdnne8T+Y2XZ'); //required\n            $manageClient-\u003esetAwsRegion('eu-central-1'); //required\n            $manageClient-\u003esetAwsS3Endpoint('s3:https://s3.amazonaws.com/my-restic-bucket'); //required\n            $manageClient-\u003esetAwsS3BucketName('my-restic-bucket'); //required\n            \n            echo $manageClient-\u003egetSnapshots(RepositoryLocationTypes::AWSS3)-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n## Remove snapshot by id\nYou can remove a snapshot of a repository by id with the method `$manageClient-\u003egetSnapshots()`. The method `getSnapshots` returns the object `ResultEntity`. The method `getOutput` of the object `ResultEntity` returns the output of the restic command simple as string. If an error occurs, an exception will be thrown.\n### Example\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Manage;\n\nclass ManageService\n{\n    public function getSnapshotList(): void\n    {\n        try {\n        \n            $manageClient = Manage::create();\n            $manageClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $manageClient-\u003esetRepositoryPassword('1234'); //required\n            $manageClient-\u003esetRepositoryPath('./path_to_repository'); //required\n            $manageClient-\u003esetSnapshotId('snapshot_id'); //required\n            \n            echo $manageClient-\u003eremoveSnapshotById()-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n### Example for Amazon S3 storage\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Core\\RepositoryLocationTypes;\nuse MuckiRestic\\Library\\Manage;\n\nclass ManageService\n{\n    public function getSnapshotList(): void\n    {\n        try {\n        \n            $manageClient = Manage::create();\n            $manageClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $manageClient-\u003esetRepositoryPassword('1234'); //required\n            $manageClient-\u003esetSnapshotId('snapshot_id'); //required\n            $manageClient-\u003esetAwsAccessKeyId('AABBCCDDYUI4T123WIZY'); //required\n            $manageClient-\u003esetAwsSecretAccessKey('xLqWLrN1yfrJ+r2zlnpoMY3eDXdHmdnne8T+Y2XZ'); //required\n            $manageClient-\u003esetAwsRegion('eu-central-1'); //required\n            $manageClient-\u003esetAwsS3Endpoint('s3:https://s3.amazonaws.com/my-restic-bucket'); //required\n            $manageClient-\u003esetAwsS3BucketName('my-restic-bucket'); //required\n            \n            echo $manageClient-\u003eremoveSnapshotById(RepositoryLocationTypes::AWSS3)-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n## Remove old snapshots\nYou can remove old snapshots of a repository with the method `$manageClient-\u003eremoveSnapshots()`. This is kind a like a cleanup run for the repository. The method `removeSnapshots` returns as always the object `ResultEntity`. The method `getOutput` of the object `ResultEntity` returns the output of the restic command simple as string. If an error occurs, an exception will be thrown.\u003cbr\u003e\nThis cleanup run needs to be setup with the keep-parameters, which defined the number of daily, weekly, monthly and yearly snapshots to keep. The method `setKeepDaily(int $keepDaily)`, `setKeepWeekly(int $keepWeekly)`, `setKeepMonthly(int $keepMonthly)` and `setKeepYearly(int $keepYearly)` are used to set the keep-parameters.\n### default keep-parameters\n| Parameter | value |\n|:----------|:------|\n| $keepDaily    | 7     |\n| $keepWeekly    | 5     |\n| $keepMonthly    | 12    |\n| $keepYearly    | 75    |\nMore details about the keep-parameters you can find in the restic documentation https://restic.readthedocs.io/en/latest/060_forget.html#removing-snapshots-according-to-a-policy\n### Example for local repository\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Manage;\n\nclass ManageService\n{\n    public function removeOldSnapshots(): void\n    {\n        try {\n        \n            $manageClient = Manage::create();\n            $manageClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $manageClient-\u003esetRepositoryPassword('1234'); //required\n            $manageClient-\u003esetRepositoryPath('./path_to_repository'); //required\n            $manageClient-\u003esetKeepDaily(1); //optional\n            $manageClient-\u003esetKeepWeekly(2); //optional\n            $manageClient-\u003esetKeepMonthly(4); //optional\n            $manageClient-\u003esetKeepYearly(5); //optional\n            \n            echo $manageClient-\u003eremoveSnapshots()-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n### Example for Amazon S3 storage\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Core\\RepositoryLocationTypes;\nuse MuckiRestic\\Library\\Manage;\n\nclass ManageService\n{\n    public function removeOldSnapshots(): void\n    {\n        try {\n        \n            $manageClient = Manage::create();\n            $manageClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $manageClient-\u003esetRepositoryPassword('1234'); //required\n            $manageClient-\u003esetKeepDaily(1); //optional\n            $manageClient-\u003esetKeepWeekly(2); //optional\n            $manageClient-\u003esetKeepMonthly(4); //optional\n            $manageClient-\u003esetKeepYearly(5); //optional\n            $manageClient-\u003esetAwsAccessKeyId('AABBCCDDYUI4T123WIZY'); //required\n            $manageClient-\u003esetAwsSecretAccessKey('xLqWLrN1yfrJ+r2zlnpoMY3eDXdHmdnne8T+Y2XZ'); //required\n            $manageClient-\u003esetAwsRegion('eu-central-1'); //required\n            $manageClient-\u003esetAwsS3Endpoint('s3:https://s3.amazonaws.com/my-restic-bucket'); //required\n            $manageClient-\u003esetAwsS3BucketName('my-restic-bucket'); //required\n            \n            echo $manageClient-\u003eremoveSnapshots(RepositoryLocationTypes::AWSS3)-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n## Restore a backup\nYou can restore a backup from a repository with the method `$restoreClient-\u003erestoreBackup()`. The method `restoreBackup` returns also the object `ResultEntity`. The method `getOutput` of the object `ResultEntity` returns the output of the restic command simple as string. If an error occurs, an exception will be thrown.\u003cbr\u003e\nAs default the method `restoreBackup` will restore the latest snapshot. Optionally you can set the snapshot hash with the method `setRestoreItem(string $snapshotHash)`. The snapshot hash you can get from the method `getSnapshots`.\u003cbr\u003e\n### Example for local repository\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Library\\Restore;\n\nclass RestoreService\n{\n    public function createRestore(): void\n    {\n        try {\n        \n            $restoreClient = Restore::create();\n            $restoreClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $restoreClient-\u003esetRepositoryPassword('1234'); //required\n            $restoreClient-\u003esetRepositoryPath('./path_to_repository'); //required\n            $restoreClient-\u003esetRestoreTarget('./path_to_restore_folder'); //required\n            $restoreClient-\u003esetRestoreItem('snapshot_hash'); //optional\n            \n            echo $restoreClient-\u003ecreateRestore()-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n\n### Example for Amazon S3 storage\n```php\n\u003c?php declare(strict_types=1);\n\nuse MuckiRestic\\Core\\RepositoryLocationTypes;\nuse MuckiRestic\\Library\\Restore;\n\nclass RestoreService\n{\n    public function createRestore(): void\n    {\n        try {\n        \n            $restoreClient = Restore::create();\n            $restoreClient-\u003esetBinaryPath('./bin/restic_0.17.3_linux_386'); //optional\n            $restoreClient-\u003esetRepositoryPassword('1234');\n            $restoreClient-\u003esetRestoreTarget('./path_to_restore_folder');\n            $restoreClient-\u003esetRestoreItem('snapshot_hash'); //optional\n            $restoreClient-\u003esetAwsAccessKeyId('AABBCCDDYUI4T123WIZY'); //required\n            $restoreClient-\u003esetAwsSecretAccessKey('xLqWLrN1yfrJ+r2zlnpoMY3eDXdHmdnne8T+Y2XZ'); //required\n            $restoreClient-\u003esetAwsRegion('eu-central-1'); //required\n            $restoreClient-\u003esetAwsS3Endpoint('s3:https://s3.amazonaws.com/my-restic-bucket'); //required\n            $restoreClient-\u003esetAwsS3BucketName('my-restic-bucket'); //required\n            \n            echo $restoreClient-\u003ecreateRestore(RepositoryLocationTypes::AWSS3)-\u003egetOutput();\n        \n        } catch (\\Exception $e) {\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n\n## Use as cli app\nCheckout the App folder for to run as cli command\n```shell\nbin/console muwa:restic:client --help\n```\nGet version of restic binary\n```shell\nbin/console muwa:restic:client --Version\n```\n### Init a new backup repository\n```shell\nbin/console muwa:restic:client --Init \u003cRepository\u003e \u003cPassword\u003e\n```\n- _Repository_ - Free of choice, where the backup data will be stored.\u003cbr\u003e\n- _Password_ - Password for the backup repository, which is used to encrypt the backup data. It's required for all operations on the repository.\n  Init a new backup repository\n### Create a backup\n```shell\nbin/console muwa:restic:client --Backup \u003cRepository\u003e \u003cPassword\u003e \u003cBackup\u003e\n```\n- _Repository_ - Path to the backup repository\u003cbr\u003e\n- _Password_ - Password for the backup repository.\n- _Backup_ - Path to data which should be backed up. This can be a single file or a folder. If the path is a folder, all files and subfolders will be backed up.\n### Check the backup, by getting a list of all snapshots\n```shell\nbin/console muwa:restic:client --Snapshots \u003cRepository\u003e \u003cPassword\u003e\n```\n- _Repository_ - Path to the backup repository\u003cbr\u003e\n- _Password_ - Password for the backup repository.\n### Remove specific snapshot\n```shell\nbin/console muwa:restic:client --Snapshots \u003cRepository\u003e \u003cPassword\u003e -r --snapshotId \u003cSnapshotId\u003e\n```\n- _Repository_ - Path to the backup repository\u003cbr\u003e\n- _Password_ - Password for the backup repository.\n### Remove old snapshots\n```shell\nbin/console muwa:restic:client --Forget \u003cRepository\u003e \u003cPassword\u003e\n```\n- _Repository_ - Path to the backup repository\u003cbr\u003e\n- _Password_ - Password for the backup repository.\n# Testing\nRun phpunit tests\n```shell\n./vendor/bin/phpunit --configuration=phpunit.xml\n./vendor/bin/phpunit --configuration=phpunit_without_integration.xml\n```\nRun phpstan tests\n```shell\ncomposer run-script phpstan\n```\n# License\nMIT License (MIT). Please see LICENSE File for more information.\n\n# Notice\nIf you run muckiware/restic on a ddev/Docker environment, you could get a **read/error** of the backup files. In this case, check the mutagen status, and enable the mutagen sync. This library is only checked on a Linux and MacOS environment. All components are also available for Windows, but no warranty that is also working on a Windows environment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuckiware%2Frestic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuckiware%2Frestic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuckiware%2Frestic/lists"}